comparison srogue/pstats.c @ 217:94a0d9dd5ce1

Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings.
author John "Elwin" Edwards
date Sun, 31 Jan 2016 13:45:07 -0500
parents 2128c7dc8a40
children b49d8b963df3
comparison
equal deleted inserted replaced
216:b24545357d2e 217:94a0d9dd5ce1
11 */ 11 */
12 12
13 #include "rogue.h" 13 #include "rogue.h"
14 #include "rogue.ext" 14 #include "rogue.ext"
15 15
16 void updabil(int what, int amt, struct real *pst, int how);
17 int hungdam(void);
16 18
17 /* 19 /*
18 * chg_hpt: 20 * chg_hpt:
19 * Changes players hit points 21 * Changes players hit points
20 */ 22 */
21 chg_hpt(howmany, alsomax, what) 23 void
22 int howmany; 24 chg_hpt(int howmany, bool alsomax, char what)
23 bool alsomax;
24 char what;
25 { 25 {
26 nochange = FALSE; 26 nochange = FALSE;
27 if(alsomax) 27 if(alsomax)
28 him->s_maxhp += howmany; 28 him->s_maxhp += howmany;
29 him->s_hpt += howmany; 29 him->s_hpt += howmany;
36 36
37 /* 37 /*
38 * rchg_str: 38 * rchg_str:
39 * Update the players real strength 39 * Update the players real strength
40 */ 40 */
41 rchg_str(amt) 41 void
42 int amt; 42 rchg_str(int amt)
43 { 43 {
44 chg_abil(STR,amt,TRUE); 44 chg_abil(STR,amt,TRUE);
45 } 45 }
46 46
47 /* 47 /*
48 * chg_abil: 48 * chg_abil:
49 * Used to modify the hero's abilities 49 * Used to modify the hero's abilities
50 */ 50 */
51 chg_abil(what,amt,how) 51 void
52 int amt, what, how; 52 chg_abil(int what, int amt, int how)
53 { 53 {
54 if (amt == 0) 54 if (amt == 0)
55 return; 55 return;
56 if (how == TRUE) { /* real (must be 1st) */ 56 if (how == TRUE) { /* real (must be 1st) */
57 updabil(what,amt,&pstats.s_re,TRUE); 57 updabil(what,amt,&pstats.s_re,TRUE);
64 64
65 /* 65 /*
66 * updabil: 66 * updabil:
67 * Do the actual abilities updating 67 * Do the actual abilities updating
68 */ 68 */
69 updabil(what, amt, pst, how) 69 void
70 struct real *pst; 70 updabil(int what, int amt, struct real *pst, int how)
71 int what, amt, how;
72 { 71 {
73 register int *wh, *mx, *mr; 72 register int *wh, *mx, *mr;
74 struct real *mst, *msr; 73 struct real *mst, *msr;
75 bool is_str = FALSE; 74 bool is_str = FALSE;
76 int rtype; 75 int rtype;
136 135
137 /* 136 /*
138 * add_haste: 137 * add_haste:
139 * add a haste to the player 138 * add a haste to the player
140 */ 139 */
141 add_haste(potion) 140 void
142 bool potion; 141 add_haste(bool potion)
143 { 142 {
144 if (pl_on(ISHASTE)) { 143 if (pl_on(ISHASTE)) {
145 msg("You faint from exhaustion."); 144 msg("You faint from exhaustion.");
146 player.t_nocmd += rnd(8); 145 player.t_nocmd += rnd(8);
147 player.t_flags &= ~ISHASTE; 146 player.t_flags &= ~ISHASTE;
158 157
159 /* 158 /*
160 * getpdex: 159 * getpdex:
161 * Gets players added dexterity for fighting 160 * Gets players added dexterity for fighting
162 */ 161 */
163 getpdex(who, heave) 162 int
164 struct stats *who; 163 getpdex(struct stats *who, bool heave)
165 bool heave;
166 { 164 {
167 reg int edex; 165 reg int edex;
168 166
169 edex = who->s_ef.a_dex; 167 edex = who->s_ef.a_dex;
170 if (heave) { /* an object was thrown here */ 168 if (heave) { /* an object was thrown here */
215 213
216 /* 214 /*
217 * getpwis: 215 * getpwis:
218 * Get a players wisdom for fighting 216 * Get a players wisdom for fighting
219 */ 217 */
220 getpwis(who) 218 int
221 struct stats *who; 219 getpwis(struct stats *who)
222 { 220 {
223 reg int ewis; 221 reg int ewis;
224 222
225 ewis = who->s_ef.a_wis; 223 ewis = who->s_ef.a_wis;
226 if (ewis > 18) 224 if (ewis > 18)
247 245
248 /* 246 /*
249 * getpcon: 247 * getpcon:
250 * Get added hit points from players constitution 248 * Get added hit points from players constitution
251 */ 249 */
252 getpcon(who) 250 int
253 struct stats *who; 251 getpcon(struct stats *who)
254 { 252 {
255 reg int econ; 253 reg int econ;
256 254
257 econ = who->s_ef.a_con; 255 econ = who->s_ef.a_con;
258 if (econ > 18) 256 if (econ > 18)
280 278
281 /* 279 /*
282 * str_plus: 280 * str_plus:
283 * compute bonus/penalties for strength on the "to hit" roll 281 * compute bonus/penalties for strength on the "to hit" roll
284 */ 282 */
285 str_plus(who) 283 int
286 struct stats *who; 284 str_plus(struct stats *who)
287 { 285 {
288 reg int hitplus, str; 286 reg int hitplus, str;
289 287
290 hitplus = 0; 288 hitplus = 0;
291 str = who->s_ef.a_str; 289 str = who->s_ef.a_str;
313 311
314 /* 312 /*
315 * add_dam: 313 * add_dam:
316 * Compute additional damage done depending on strength 314 * Compute additional damage done depending on strength
317 */ 315 */
318 add_dam(who) 316 int
319 struct stats *who; 317 add_dam(struct stats *who)
320 { 318 {
321 reg int exdam, str; 319 reg int exdam, str;
322 320
323 exdam = 0; 321 exdam = 0;
324 str = who->s_ef.a_str; 322 str = who->s_ef.a_str;
348 346
349 /* 347 /*
350 * hungdam: 348 * hungdam:
351 * Calculate damage depending on players hungry state 349 * Calculate damage depending on players hungry state
352 */ 350 */
353 hungdam() 351 int
352 hungdam(void)
354 { 353 {
355 switch (hungry_state) { 354 switch (hungry_state) {
356 case F_OKAY: 355 case F_OKAY:
357 case F_HUNGRY: return 0; 356 case F_HUNGRY: return 0;
358 when F_WEAK: return -1; 357 when F_WEAK: return -1;
362 361
363 /* 362 /*
364 * heal_self: 363 * heal_self:
365 * Heal the hero. 364 * Heal the hero.
366 */ 365 */
367 heal_self(factor, updmaxhp) 366 void
368 int factor; 367 heal_self(int factor, bool updmaxhp)
369 bool updmaxhp;
370 { 368 {
371 him->s_hpt += roll(him->s_lvl + getpcon(him), factor); 369 him->s_hpt += roll(him->s_lvl + getpcon(him), factor);
372 if (updmaxhp) 370 if (updmaxhp)
373 him->s_maxhp += 1; 371 him->s_maxhp += 1;
374 if (him->s_hpt > him->s_maxhp) 372 if (him->s_hpt > him->s_maxhp)