Mercurial > hg > early-roguelike
comparison srogue/rings.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 | 3aa87373c908 |
| children | e7862a021609 |
comparison
equal
deleted
inserted
replaced
| 216:b24545357d2e | 217:94a0d9dd5ce1 |
|---|---|
| 17 #include <stdlib.h> | 17 #include <stdlib.h> |
| 18 #include <string.h> | 18 #include <string.h> |
| 19 #include "rogue.h" | 19 #include "rogue.h" |
| 20 #include "rogue.ext" | 20 #include "rogue.ext" |
| 21 | 21 |
| 22 int gethand(bool isrmv); | |
| 23 int ring_eat(void); | |
| 24 | |
| 22 /* | 25 /* |
| 23 * ring_on: | 26 * ring_on: |
| 24 * Put on a ring | 27 * Put on a ring |
| 25 */ | 28 */ |
| 26 ring_on() | 29 void |
| 30 ring_on(void) | |
| 27 { | 31 { |
| 28 reg struct object *obj; | 32 reg struct object *obj; |
| 29 reg struct linked_list *item; | 33 reg struct linked_list *item; |
| 30 reg int ring, wh; | 34 reg int ring, wh; |
| 31 char buf[LINLEN]; | 35 char buf[LINLEN]; |
| 142 | 146 |
| 143 /* | 147 /* |
| 144 * ring_off: | 148 * ring_off: |
| 145 * Take off some ring | 149 * Take off some ring |
| 146 */ | 150 */ |
| 147 ring_off() | 151 void |
| 152 ring_off(void) | |
| 148 { | 153 { |
| 149 reg int ring; | 154 reg int ring; |
| 150 reg struct object *obj; | 155 reg struct object *obj; |
| 151 | 156 |
| 152 if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) { | 157 if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) { |
| 176 | 181 |
| 177 /* | 182 /* |
| 178 * toss_ring: | 183 * toss_ring: |
| 179 * Remove a ring and stop its effects | 184 * Remove a ring and stop its effects |
| 180 */ | 185 */ |
| 181 toss_ring(what) | 186 void |
| 182 struct object *what; | 187 toss_ring(struct object *what) |
| 183 { | 188 { |
| 184 bool okring; | 189 bool okring; |
| 185 | 190 |
| 186 /* | 191 /* |
| 187 * okring = FALSE when: | 192 * okring = FALSE when: |
| 226 | 231 |
| 227 /* | 232 /* |
| 228 * gethand: | 233 * gethand: |
| 229 * Get a hand to wear a ring | 234 * Get a hand to wear a ring |
| 230 */ | 235 */ |
| 231 gethand(isrmv) | 236 int |
| 232 bool isrmv; | 237 gethand(bool isrmv) |
| 233 { | 238 { |
| 234 reg int c; | 239 reg int c; |
| 235 char *ptr; | 240 char *ptr; |
| 236 struct object *obj; | 241 struct object *obj; |
| 237 | 242 |
| 278 | 283 |
| 279 /* | 284 /* |
| 280 * ring_eat: | 285 * ring_eat: |
| 281 * How much food do the hero's rings use up? | 286 * How much food do the hero's rings use up? |
| 282 */ | 287 */ |
| 283 ring_eat() | 288 int |
| 289 ring_eat(void) | |
| 284 { | 290 { |
| 285 reg struct object *lb; | 291 reg struct object *lb; |
| 286 reg int hand, i, howmuch; | 292 reg int hand, i, howmuch; |
| 287 bool addit; | 293 bool addit; |
| 288 | 294 |
| 333 /* | 339 /* |
| 334 * ring_num: | 340 * ring_num: |
| 335 * Print ring bonuses | 341 * Print ring bonuses |
| 336 */ | 342 */ |
| 337 char * | 343 char * |
| 338 ring_num(what) | 344 ring_num(struct object *what) |
| 339 struct object *what; | |
| 340 { | 345 { |
| 341 static char number[5]; | 346 static char number[5]; |
| 342 | 347 |
| 343 number[0] = '\0'; | 348 number[0] = '\0'; |
| 344 if (o_on(what,ISKNOW) || o_on(what,ISPOST)) { | 349 if (o_on(what,ISKNOW) || o_on(what,ISPOST)) { |
| 353 | 358 |
| 354 /* | 359 /* |
| 355 * magring: | 360 * magring: |
| 356 * Returns TRUE if a ring has a number, i.e. +2 | 361 * Returns TRUE if a ring has a number, i.e. +2 |
| 357 */ | 362 */ |
| 358 magring(what) | 363 bool |
| 359 struct object *what; | 364 magring(struct object *what) |
| 360 { | 365 { |
| 361 switch(what->o_which) { | 366 switch(what->o_which) { |
| 362 case R_SPEED: | 367 case R_SPEED: |
| 363 case R_ADDSTR: | 368 case R_ADDSTR: |
| 364 case R_PROTECT: | 369 case R_PROTECT: |
| 377 | 382 |
| 378 /* | 383 /* |
| 379 * ringabil: | 384 * ringabil: |
| 380 * Compute effective abilities due to rings | 385 * Compute effective abilities due to rings |
| 381 */ | 386 */ |
| 382 ringabil() | 387 void |
| 388 ringabil(void) | |
| 383 { | 389 { |
| 384 reg struct object *rptr; | 390 reg struct object *rptr; |
| 385 reg int i; | 391 reg int i; |
| 386 | 392 |
| 387 for(i = LEFT; i <= RIGHT; i++) { | 393 for(i = LEFT; i <= RIGHT; i++) { |
| 404 | 410 |
| 405 /* | 411 /* |
| 406 * init_ring: | 412 * init_ring: |
| 407 * Initialize a ring | 413 * Initialize a ring |
| 408 */ | 414 */ |
| 409 init_ring(what,fromwiz) | 415 void |
| 410 struct object *what; | 416 init_ring(struct object *what, bool fromwiz) |
| 411 bool fromwiz; /* TRUE when from wizards */ | 417 { |
| 412 { | 418 /* fromwiz: TRUE when from wizards */ |
| 413 reg int much; | 419 reg int much; |
| 414 | 420 |
| 415 switch (what->o_which) { | 421 switch (what->o_which) { |
| 416 case R_DIGEST: /* -3 to +3 rings */ | 422 case R_DIGEST: /* -3 to +3 rings */ |
| 417 case R_ADDSTR: | 423 case R_ADDSTR: |
| 457 | 463 |
| 458 /* | 464 /* |
| 459 * ringex: | 465 * ringex: |
| 460 * Get extra gains from rings | 466 * Get extra gains from rings |
| 461 */ | 467 */ |
| 462 ringex(rtype) | 468 int |
| 463 int rtype; | 469 ringex(int rtype) |
| 464 { | 470 { |
| 465 reg int howmuch = 0; | 471 reg int howmuch = 0; |
| 466 | 472 |
| 467 if (isring(LEFT, rtype)) | 473 if (isring(LEFT, rtype)) |
| 468 howmuch += cur_ring[LEFT]->o_ac; | 474 howmuch += cur_ring[LEFT]->o_ac; |
| 473 | 479 |
| 474 /* | 480 /* |
| 475 * iswearing: | 481 * iswearing: |
| 476 * Returns TRUE when the hero is wearing a certain type of ring | 482 * Returns TRUE when the hero is wearing a certain type of ring |
| 477 */ | 483 */ |
| 478 iswearing(ring) | 484 bool |
| 479 int ring; | 485 iswearing(int ring) |
| 480 { | 486 { |
| 481 return (isring(LEFT,ring) || isring(RIGHT,ring)); | 487 return (isring(LEFT,ring) || isring(RIGHT,ring)); |
| 482 } | 488 } |
| 483 | 489 |
| 484 /* | 490 /* |
| 485 * isring: | 491 * isring: |
| 486 * Returns TRUE if a ring is on a hand | 492 * Returns TRUE if a ring is on a hand |
| 487 */ | 493 */ |
| 488 isring(hand,ring) | 494 bool |
| 489 int hand, ring; | 495 isring(int hand, int ring) |
| 490 { | 496 { |
| 491 if (cur_ring[hand] != NULL && cur_ring[hand]->o_which == ring) | 497 if (cur_ring[hand] != NULL && cur_ring[hand]->o_which == ring) |
| 492 return TRUE; | 498 return TRUE; |
| 493 return FALSE; | 499 return FALSE; |
| 494 } | 500 } |
