Mercurial > hg > early-roguelike
diff xrogue/util.c @ 220:f54901b9c39b
XRogue: convert to ANSI-style function declarations.
author | John "Elwin" Edwards |
---|---|
date | Wed, 02 Mar 2016 21:13:26 -0500 |
parents | ce0cf824c192 |
children | 7c1cb43f346e |
line wrap: on
line diff
--- a/xrogue/util.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/util.c Wed Mar 02 21:13:26 2016 -0500 @@ -26,8 +26,7 @@ */ int -ac_compute(ignoremetal) -bool ignoremetal; +ac_compute(bool ignoremetal) { register int ac; @@ -60,8 +59,8 @@ * aggravate all the monsters on this level */ -aggravate(do_uniques, do_good) -bool do_uniques, do_good; +void +aggravate(bool do_uniques, bool do_good) { register struct linked_list *mi; register struct thing *thingptr; @@ -78,8 +77,8 @@ * returns true if the hero can see a certain coordinate. */ -cansee(y, x) -register int y, x; +bool +cansee(int y, int x) { register struct room *rer; register int radius; @@ -126,7 +125,7 @@ */ long -check_level() +check_level(void) { register int i, j, add = 0; register unsigned long exp; @@ -170,8 +169,8 @@ * it keeps track of the highest it has been, just in case */ -chg_str(amt) -register int amt; +void +chg_str(int amt) { register int ring_str; /* ring strengths */ register struct stats *ptr; /* for speed */ @@ -195,7 +194,8 @@ * let's confuse the player */ -confus_player() +void +confus_player(void) { if (off(player, ISCLEAR)) { @@ -213,7 +213,8 @@ * this routine computes the players current dexterity */ -dex_compute() +int +dex_compute(void) { if (cur_misc[WEAR_GAUNTLET] != NULL && cur_misc[WEAR_GAUNTLET]->o_which == MM_G_DEXTERITY) { @@ -231,9 +232,8 @@ * Check to see if the move is legal if it is diagonal */ -diag_ok(sp, ep, flgptr) -register coord *sp, *ep; -struct thing *flgptr; +bool +diag_ok(coord *sp, coord *ep, struct thing *flgptr) { register int numpaths = 0; @@ -254,10 +254,7 @@ */ coord * -fallpos(pos, be_clear, range) -register coord *pos; -bool be_clear; -int range; +fallpos(coord *pos, bool be_clear, int range) { register int tried, i, j; register char ch; @@ -333,8 +330,8 @@ * Find the index into the monster table of a monster given its name. */ -findmindex(name) -char *name; +int +findmindex(char *name) { int which; @@ -355,9 +352,7 @@ */ struct linked_list * -find_mons(y, x) -register int y; -register int x; +find_mons(int y, int x) { register struct linked_list *item; register struct thing *th; @@ -377,9 +372,7 @@ */ struct linked_list * -find_obj(y, x) -register int y; -register int x; +find_obj(int y, int x) { register struct linked_list *obj; register struct object *op; @@ -398,7 +391,7 @@ */ coord -get_coordinates() +get_coordinates(void) { register int which; coord c; @@ -458,8 +451,7 @@ */ bool -get_dir(direction) -coord *direction; +get_dir(coord *direction) { register char *prompt; register bool gotit; @@ -519,8 +511,7 @@ */ long -get_worth(obj) -reg struct object *obj; +get_worth(struct object *obj) { reg long worth, wh; @@ -591,8 +582,7 @@ */ bool -invisible(monst) -register struct thing *monst; +invisible(struct thing *monst) { register bool ret_code; @@ -608,8 +598,8 @@ * see if the object is one of the currently used items */ -is_current(obj) -register struct object *obj; +bool +is_current(struct object *obj) { if (obj == NULL) return FALSE; @@ -648,11 +638,12 @@ /* * Look: * A quick glance all around the player + * wakeup: Should we wake up monsters + * runend: At end of a run -- for mazes */ -look(wakeup, runend) -bool wakeup; /* Should we wake up monsters */ -bool runend; /* At end of a run -- for mazes */ +void +look(bool wakeup, bool runend) { register int x, y, radius; register unsigned char ch, och; @@ -937,8 +928,8 @@ * Lower a level of experience */ -lower_level(who) -short who; +void +lower_level(short who) { int fewer, nsides; unsigned long exp; @@ -975,8 +966,7 @@ */ char * -monster_name(tp) -register struct thing *tp; +monster_name(struct thing *tp) { prbuf[0] = '\0'; if (on(*tp, ISFLEE) || on(*tp, WASTURNED)) @@ -1007,8 +997,7 @@ */ bool -move_hero(why) -int why; +move_hero(int why) { char *action = NULL; unsigned char which; @@ -1053,7 +1042,8 @@ * The guy just magically went up a level. */ -raise_level() +void +raise_level(void) { unsigned long test; /* Next level -- be sure it is not an overflow */ @@ -1105,12 +1095,13 @@ /* * save: * See if a creature saves against something + * which: which type of save + * who: who is saving + * adj: saving throw adjustment */ -save(which, who, adj) -int which; /* which type of save */ -struct thing *who; /* who is saving */ -int adj; /* saving throw adjustment */ +bool +save(int which, struct thing *who, int adj) { register int need, level, protect; @@ -1167,8 +1158,8 @@ * Figure out what a secret door looks like. */ -secretdoor(y, x) -register int y, x; +char +secretdoor(int y, int x) { register int i; register struct room *rp; @@ -1192,7 +1183,8 @@ * this routine computes the players current strength */ -str_compute() +int +str_compute(void) { if (cur_misc[WEAR_GAUNTLET] != NULL && cur_misc[WEAR_GAUNTLET]->o_which == MM_G_OGRE) { @@ -1209,9 +1201,8 @@ * copy string using unctrl for things */ -strucpy(s1, s2, len) -register char *s1, *s2; -register int len; +void +strucpy(char *s1, char *s2, int len) { register char *sp; while (len--) @@ -1229,8 +1220,7 @@ */ char * -tr_name(ch) -char ch; +tr_name(char ch) { register char *s = NULL; @@ -1263,8 +1253,7 @@ */ char * -vowelstr(str) -register char *str; +vowelstr(char *str) { switch (*str) { @@ -1283,8 +1272,8 @@ * wake up a room full (hopefully) of creatures */ -wake_room(rp) -register struct room *rp; +void +wake_room(struct room *rp) { register struct linked_list *item; register struct thing *tp; @@ -1302,7 +1291,8 @@ * Do nothing but let other things happen */ -waste_time() +void +waste_time(void) { if (inwhgt) /* if from wghtchk then done */ return;