comparison xrogue/potions.c @ 228:b67b99f6c92b

Daemons and fuses now return void. Functions for starting and stopping daemons and fuses now expect the type 'void (*func)()'. Only a few functions in XRogue needed to be modified to fit. Determining the type of the argument is left for a later date. Building with GCC5 should now produce less than 200 lines of warnings per game.
author John "Elwin" Edwards
date Sat, 05 Mar 2016 20:49:37 -0500
parents f54901b9c39b
children 7c1cb43f346e
comparison
equal deleted inserted replaced
227:696277507a2e 228:b67b99f6c92b
25 int add_dexterity(int change); 25 int add_dexterity(int change);
26 int add_intelligence(int change); 26 int add_intelligence(int change);
27 int add_strength(int change); 27 int add_strength(int change);
28 int add_wisdom(int change); 28 int add_wisdom(int change);
29 29
30 int res_charisma(int howmuch); 30 void res_charisma(int howmuch);
31 int res_constitution(int howmuch); 31 void res_constitution(int howmuch);
32 int res_dexterity(int howmuch); 32 void res_dexterity(int howmuch);
33 int res_intelligence(int howmuch); 33 void res_intelligence(int howmuch);
34 int res_wisdom(int howmuch); 34 void res_wisdom(int howmuch);
35 35
36 /* 36 /*
37 * add_abil is an array of functions used to change attributes. It must be 37 * add_abil is an array of functions used to change attributes. It must be
38 * ordered according to the attribute definitions in rogue.h. 38 * ordered according to the attribute definitions in rogue.h.
39 */ 39 */
46 /* 46 /*
47 * res_abil is an array of functions used to change attributes. It must be 47 * res_abil is an array of functions used to change attributes. It must be
48 * ordered according to the attribute definitions in rogue.h. 48 * ordered according to the attribute definitions in rogue.h.
49 */ 49 */
50 50
51 int (*res_abil[NUMABILITIES])() = { 51 void (*res_abil[NUMABILITIES])() = {
52 res_intelligence, res_strength, res_wisdom, res_dexterity, 52 res_intelligence, res_strength, res_wisdom, res_dexterity,
53 res_constitution, res_charisma 53 res_constitution, res_charisma
54 }; 54 };
55 55
56 /* 56 /*
943 * res_dexterity: 943 * res_dexterity:
944 * Restore player's dexterity 944 * Restore player's dexterity
945 * if called with zero the restore fully 945 * if called with zero the restore fully
946 */ 946 */
947 947
948 int 948 void
949 res_dexterity(int howmuch) 949 res_dexterity(int howmuch)
950 { 950 {
951 short save_max; 951 short save_max;
952 int ring_str; 952 int ring_str;
953 953
954 if (howmuch < 0) return(0); 954 if (howmuch < 0) return;
955 955
956 /* Discount the ring value */ 956 /* Discount the ring value */
957 ring_str = ring_value(R_ADDHIT); 957 ring_str = ring_value(R_ADDHIT);
958 pstats.s_dext -= ring_str; 958 pstats.s_dext -= ring_str;
959 959
968 if (ring_str) { 968 if (ring_str) {
969 save_max = max_stats.s_dext; 969 save_max = max_stats.s_dext;
970 pstats.s_dext += ring_str; 970 pstats.s_dext += ring_str;
971 max_stats.s_dext = save_max; 971 max_stats.s_dext = save_max;
972 } 972 }
973 return(0); 973 return;
974 } 974 }
975 975
976 /* 976 /*
977 * res_intelligence: 977 * res_intelligence:
978 * Restore player's intelligence 978 * Restore player's intelligence
979 */ 979 */
980 980
981 int 981 void
982 res_intelligence(int howmuch) 982 res_intelligence(int howmuch)
983 { 983 {
984 short save_max; 984 short save_max;
985 int ring_str; 985 int ring_str;
986 986
987 if (howmuch <= 0) return(0); 987 if (howmuch <= 0) return;
988 988
989 /* Discount the ring value */ 989 /* Discount the ring value */
990 ring_str = ring_value(R_ADDINTEL); 990 ring_str = ring_value(R_ADDINTEL);
991 pstats.s_intel -= ring_str; 991 pstats.s_intel -= ring_str;
992 992
996 if (ring_str) { 996 if (ring_str) {
997 save_max = max_stats.s_intel; 997 save_max = max_stats.s_intel;
998 pstats.s_intel += ring_str; 998 pstats.s_intel += ring_str;
999 max_stats.s_intel = save_max; 999 max_stats.s_intel = save_max;
1000 } 1000 }
1001 return(0); 1001 return;
1002 } 1002 }
1003 1003
1004 /* 1004 /*
1005 * res_wisdom: 1005 * res_wisdom:
1006 * Restore player's wisdom 1006 * Restore player's wisdom
1007 */ 1007 */
1008 1008
1009 int 1009 void
1010 res_wisdom(int howmuch) 1010 res_wisdom(int howmuch)
1011 { 1011 {
1012 short save_max; 1012 short save_max;
1013 int ring_str; 1013 int ring_str;
1014 1014
1015 if (howmuch <= 0) return(0); 1015 if (howmuch <= 0) return;
1016 1016
1017 /* Discount the ring value */ 1017 /* Discount the ring value */
1018 ring_str = ring_value(R_ADDWISDOM); 1018 ring_str = ring_value(R_ADDWISDOM);
1019 pstats.s_wisdom -= ring_str; 1019 pstats.s_wisdom -= ring_str;
1020 1020
1024 if (ring_str) { 1024 if (ring_str) {
1025 save_max = max_stats.s_wisdom; 1025 save_max = max_stats.s_wisdom;
1026 pstats.s_wisdom += ring_str; 1026 pstats.s_wisdom += ring_str;
1027 max_stats.s_wisdom = save_max; 1027 max_stats.s_wisdom = save_max;
1028 } 1028 }
1029 return(0); 1029 return;
1030 } 1030 }
1031 1031
1032 /* 1032 /*
1033 * res_constitution: 1033 * res_constitution:
1034 * Restore the players constitution. 1034 * Restore the players constitution.
1035 */ 1035 */
1036 1036
1037 int 1037 void
1038 res_constitution(int howmuch) 1038 res_constitution(int howmuch)
1039 { 1039 {
1040 if (howmuch > 0) 1040 if (howmuch > 0)
1041 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); 1041 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const);
1042 1042
1043 return(0); 1043 return;
1044 } 1044 }
1045 1045
1046 /* 1046 /*
1047 * res_charisma: 1047 * res_charisma:
1048 * Restore the players charisma. 1048 * Restore the players charisma.
1049 */ 1049 */
1050 1050
1051 int 1051 void
1052 res_charisma(int howmuch) 1052 res_charisma(int howmuch)
1053 { 1053 {
1054 if (howmuch > 0) 1054 if (howmuch > 0)
1055 pstats.s_charisma = 1055 pstats.s_charisma =
1056 min(pstats.s_charisma + howmuch, max_stats.s_charisma); 1056 min(pstats.s_charisma + howmuch, max_stats.s_charisma);
1057 1057
1058 return(0); 1058 return;
1059 } 1059 }