# HG changeset patch # User John "Elwin" Edwards # Date 1454873961 18000 # Node ID 56e748983fa8affc0aa3aa415a48904c473189c5 # Parent 94a0d9dd5ce17ee1e58db5ee6deaba84c5a13ecc Advanced Rogue 5: convert to ANSI function declarations. This still leaves over a thousand lines of warning messages, mostly related to the return types of daemons and fuses. diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/chase.c --- a/arogue5/chase.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/chase.c Sun Feb 07 14:39:21 2016 -0500 @@ -12,6 +12,7 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include #include #include "curses.h" @@ -21,8 +22,8 @@ coord ch_ret; /* Where chasing takes you */ - - +struct linked_list *get_hurl(struct thing *tp); +bool straight_shot(int ery, int erx, int eey, int eex, coord *shooting); /* @@ -31,8 +32,7 @@ */ bool -can_blink(tp) -register struct thing *tp; +can_blink(struct thing *tp) { register int y, x, index=9; coord tryp; /* To hold the coordinates for use in diag_ok */ @@ -128,8 +128,7 @@ */ coord * -can_shoot(er, ee) -register coord *er, *ee; +can_shoot(coord *er, coord *ee) { static coord shoot_dir; @@ -154,13 +153,11 @@ * FALSE if we reach the goal. */ -chase(tp, ee, flee, mdead) -register struct thing *tp; -register coord *ee; -bool flee; /* True if destination (ee) is player and monster is running away - * or the player is in a wall and the monster can't get to it - */ -bool *mdead; +/* flee: True if destination (ee) is player and monster is running + * away or the player is in a wall and the monster can't get to it + */ +bool +chase(struct thing *tp, coord *ee, bool flee, bool *mdead) { int damage, dist, thisdist, monst_dist = MAXINT; struct linked_list *weapon; @@ -530,10 +527,10 @@ * do_chase: * Make one thing chase another. */ +/* flee: True if running away or player is inaccessible in wall */ -do_chase(th, flee) -register struct thing *th; -register bool flee; /* True if running away or player is inaccessible in wall */ +void +do_chase(struct thing *th, bool flee) { register struct room *rer, *ree, /* room of chaser, room of chasee */ *orig_rer, /* Original room of chaser */ @@ -830,8 +827,7 @@ */ struct linked_list * -get_hurl(tp) -register struct thing *tp; +get_hurl(struct thing *tp) { struct linked_list *arrow, *bolt, *rock; register struct linked_list *pitem; @@ -861,7 +857,8 @@ * Make all the running monsters move. */ -runners() +void +runners(void) { register struct linked_list *item; register struct thing *tp = NULL; @@ -935,9 +932,8 @@ * Set a monster running after something */ -runto(runner, spot) -register struct thing *runner; -coord *spot; +void +runto(struct thing *runner, coord *spot) { /* * Start the beastie running @@ -959,9 +955,7 @@ */ bool -straight_shot(ery, erx, eey, eex, shooting) -register int ery, erx, eey, eex; -register coord *shooting; +straight_shot(int ery, int erx, int eey, int eex, coord *shooting) { register int dy, dx; /* Deltas */ char ch; diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/command.c --- a/arogue5/command.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/command.c Sun Feb 07 14:39:21 2016 -0500 @@ -21,12 +21,20 @@ #include "rogue.h" #include "mach_dep.h" +void help(void); +void identify(void); +void d_level(void); +void u_level(void); +void shell(void); +void call(bool mark); + /* * command: * Process the user commands */ -command() +void +command(void) { register char ch; register int ntimes = 1; /* Number of player moves */ @@ -207,8 +215,8 @@ when 'I' : after = FALSE; picky_inven(); when 'd' : drop(NULL); when 'P' : grab(hero.y, hero.x); - when 'q' : quaff(-1, NULL, TRUE); - when 'r' : read_scroll(-1, NULL, TRUE); + when 'q' : quaff(-1, 0, TRUE); + when 'r' : read_scroll(-1, 0, TRUE); when 'e' : eat(); when 'w' : wield(); when 'W' : wear(); @@ -228,7 +236,7 @@ when 'G' : gsense(); when '^' : set_trap(&player, hero.y, hero.x); when 's' : search(FALSE, FALSE); - when 'z' : if (!do_zap(TRUE, NULL, FALSE)) + when 'z' : if (!do_zap(TRUE, 0, FALSE)) after=FALSE; when 'p' : pray(); when 'C' : cast(); @@ -475,8 +483,7 @@ */ void -bugkill(sig) -int sig; +bugkill(int sig) { signal(sig, quit); /* If we get it again, give up */ death(D_SIGNAL); /* Killed by a bug */ @@ -488,8 +495,8 @@ * Player gropes about him to find hidden things. */ -search(is_thief, door_chime) -register bool is_thief, door_chime; +void +search(bool is_thief, bool door_chime) { register int x, y; register char ch, /* The trap or door character */ @@ -570,7 +577,8 @@ * Give single character help, or the whole mess if he wants it */ -help() +void +help(void) { register struct h_list *strp = helpstr; #ifdef WIZARD @@ -664,7 +672,8 @@ * Tell the player what a certain thing is. */ -identify() +void +identify(void) { register char ch; const char *str; @@ -726,7 +735,8 @@ * He wants to go down a level */ -d_level() +void +d_level(void) { bool no_phase=FALSE; @@ -770,7 +780,8 @@ * He wants to go up a level */ -u_level() +void +u_level(void) { bool no_phase = FALSE; register struct linked_list *item; @@ -828,7 +839,8 @@ * Let him escape for a while */ -shell() +void +shell(void) { /* * Set the terminal back to original mode @@ -859,8 +871,8 @@ /* * allow a user to call a potion, scroll, or ring something */ -call(mark) -bool mark; +void +call(bool mark) { register struct object *obj; register struct linked_list *item; diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/daemon.c --- a/arogue5/daemon.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/daemon.c Sun Feb 07 14:39:21 2016 -0500 @@ -36,7 +36,7 @@ * Find an empty slot in the daemon list */ struct delayed_action * -d_slot() +d_slot(void) { reg int i; reg struct delayed_action *dev; @@ -52,7 +52,7 @@ * Find an empty slot in the fuses list */ struct delayed_action * -f_slot() +f_slot(void) { reg int i; reg struct delayed_action *dev; @@ -70,8 +70,7 @@ * Find a particular slot in the table */ struct delayed_action * -find_slot(func) -reg int (*func)(); +find_slot(int (*func)()) { reg int i; reg struct delayed_action *dev; @@ -87,6 +86,7 @@ * start_daemon: * Start a daemon, takes a function. */ +void start_daemon(int (*func)(), void *arg, int type) { reg struct delayed_action *dev; @@ -106,8 +106,8 @@ * kill_daemon: * Remove a daemon from the list */ -kill_daemon(func) -reg int (*func)(); +void +kill_daemon(int (*func)()) { reg struct delayed_action *dev; reg int i; @@ -133,8 +133,8 @@ * Run all the daemons that are active with the current flag, * passing the argument to the function. */ -do_daemons(flag) -reg int flag; +void +do_daemons(int flag) { reg struct delayed_action *dev; @@ -154,6 +154,7 @@ * fuse: * Start a fuse to go off in a certain number of turns */ +void fuse(int (*func)(), void *arg, int time, int type) { reg struct delayed_action *wire; @@ -173,8 +174,8 @@ * lengthen: * Increase the time until a fuse goes off */ -lengthen(func, xtime) -reg int (*func)(), xtime; +void +lengthen(int (*func)(), int xtime) { reg struct delayed_action *wire; @@ -188,8 +189,8 @@ * extinguish: * Put out a fuse */ -extinguish(func) -reg int (*func)(); +void +extinguish(int (*func)()) { reg struct delayed_action *wire; @@ -207,8 +208,8 @@ * do_fuses: * Decrement counters and start needed fuses */ -do_fuses(flag) -reg int flag; +void +do_fuses(int flag) { reg struct delayed_action *wire; @@ -234,7 +235,8 @@ * activity: * Show wizard number of demaons and memory blocks used */ -activity() +void +activity(void) { sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", demoncnt,fusecnt,total,md_memused()); diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/daemons.c --- a/arogue5/daemons.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/daemons.c Sun Feb 07 14:39:21 2016 -0500 @@ -22,8 +22,8 @@ * A healing daemon that restors hit points after rest */ -doctor(tp) -register struct thing *tp; +void +doctor(struct thing *tp) { register int ohp; register int limit, new_points; @@ -100,7 +100,8 @@ * Called when it is time to start rolling for wandering monsters */ -swander() +void +swander(void) { start_daemon(rollwand, 0, BEFORE); } @@ -110,7 +111,8 @@ * Called to roll to see if a wandering monster starts up */ -rollwand() +void +rollwand(void) { if (++between >= 4) { @@ -128,7 +130,8 @@ /* * this function is a daemon called each turn when the character is a thief */ -trap_look() +void +trap_look(void) { if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) search(TRUE, FALSE); @@ -139,7 +142,8 @@ * Release the poor player from his confusion */ -unconfuse() +void +unconfuse(void) { turn_off(player, ISHUH); msg("You feel less confused now"); @@ -151,7 +155,8 @@ * He lost his see invisible power */ -unsee() +void +unsee(void) { if (!ISWEARING(R_SEEINVIS)) { turn_off(player, CANSEE); @@ -164,7 +169,8 @@ * Remove to-hit handicap from player */ -unstink() +void +unstink(void) { turn_off(player, HASSTINK); } @@ -174,7 +180,8 @@ * Player is no longer immune to confusion */ -unclrhead() +void +unclrhead(void) { turn_off(player, ISCLEAR); msg("The blue aura about your head fades away."); @@ -185,7 +192,8 @@ * Player can no longer walk through walls */ -unphase() +void +unphase(void) { turn_off(player, CANINWALL); msg("Your dizzy feeling leaves you."); @@ -197,7 +205,8 @@ * Player can no longer fly */ -land() +void +land(void) { turn_off(player, ISFLY); msg("You regain your normal weight"); @@ -209,7 +218,8 @@ * He gets his sight back */ -sight() +void +sight(void) { if (on(player, ISBLIND)) { @@ -225,7 +235,8 @@ * Restore player's strength */ -res_strength() +void +res_strength(void) { /* If lost_str is non-zero, restore that amount of strength, @@ -249,7 +260,8 @@ * End the hasting */ -nohaste() +void +nohaste(void) { turn_off(player, ISHASTE); msg("You feel yourself slowing down."); @@ -260,7 +272,8 @@ * End the slowing */ -noslow() +void +noslow(void) { turn_off(player, ISSLOW); msg("You feel yourself speeding up."); @@ -271,7 +284,8 @@ * If this gets called, the player has suffocated */ -suffocate() +void +suffocate(void) { death(D_SUFFOCATION); } @@ -279,7 +293,8 @@ /* * digest the hero's food */ -stomach() +void +stomach(void) { register int oldfood, old_hunger, food_use, i; @@ -335,7 +350,8 @@ /* * daemon for curing the diseased */ -cure_disease() +void +cure_disease(void) { turn_off(player, HASDISEASE); if (off (player, HASINFEST)) @@ -346,7 +362,8 @@ /* * daemon for adding back dexterity */ -un_itch() +void +un_itch(void) { if (--lost_dext < 1) { lost_dext = 0; @@ -358,7 +375,8 @@ * appear: * Become visible again */ -appear() +void +appear(void) { turn_off(player, ISINVIS); PLAYER = VPLAYER; @@ -369,7 +387,8 @@ * dust_appear: * dust of disappearance wears off */ -dust_appear() +void +dust_appear(void) { turn_off(player, ISINVIS); PLAYER = VPLAYER; @@ -380,7 +399,8 @@ * unchoke: * the effects of "dust of choking and sneezing" wear off */ -unchoke() +void +unchoke(void) { if (!find_slot(unconfuse)) turn_off(player, ISHUH); @@ -392,8 +412,8 @@ /* * make some potion for the guy in the Alchemy jug */ -alchemy(obj) -register struct object *obj; +void +alchemy(struct object *obj) { register struct object *tobj = NULL; register struct linked_list *item; @@ -440,7 +460,8 @@ * otto's irresistable dance wears off */ -undance() +void +undance(void) { turn_off(player, ISDANCE); msg ("Your feet take a break.....whew!"); @@ -449,14 +470,16 @@ /* * if he has our favorite necklace of strangulation then take damage every turn */ -strangle() +void +strangle(void) { if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE); } /* * if he has on the gauntlets of fumbling he might drop his weapon each turn */ -fumble() +void +fumble(void) { register struct linked_list *item; @@ -474,14 +497,16 @@ /* * this is called each turn the hero has the ring of searching on */ -ring_search() +void +ring_search(void) { search(FALSE, FALSE); } /* * this is called each turn the hero has the ring of teleportation on */ -ring_teleport() +void +ring_teleport(void) { if (rnd(100) < 2) teleport(); } diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/encumb.c --- a/arogue5/encumb.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/encumb.c Sun Feb 07 14:39:21 2016 -0500 @@ -15,12 +15,14 @@ #include "curses.h" #include "rogue.h" +int packweight(void); + /* * updpack: * Update his pack weight and adjust fooduse accordingly */ -updpack(getmax) -int getmax; +void +updpack(bool getmax) { reg int topcarry, curcarry; @@ -45,7 +47,8 @@ * packweight: * Get the total weight of the hero's pack */ -packweight() +int +packweight(void) { reg struct object *obj; reg struct linked_list *pc; @@ -68,8 +71,8 @@ * itemweight: * Get the weight of an object */ -itemweight(wh) -reg struct object *wh; +int +itemweight(struct object *wh) { reg int weight; reg int ac; @@ -99,7 +102,8 @@ * playenc: * Get hero's carrying ability above norm */ -playenc() +int +playenc(void) { return ((str_compute()-8)*50); } @@ -109,7 +113,8 @@ * totalenc: * Get total weight that the hero can carry */ -totalenc() +int +totalenc(void) { reg int wtotal; @@ -130,18 +135,18 @@ * See if the hero can carry his pack */ -wghtchk() +void +wghtchk(void) { reg int dropchk, err = TRUE; reg char ch; - int wghtchk(); inwhgt = TRUE; if (pstats.s_pack > pstats.s_carry) { ch = CCHAR( mvwinch(stdscr, hero.y, hero.x) ); if((ch != FLOOR && ch != PASSAGE)) { extinguish(wghtchk); - fuse(wghtchk,TRUE,1,AFTER); + fuse(wghtchk,NULL,1,AFTER); inwhgt = FALSE; return; } @@ -169,7 +174,8 @@ * -1 hit for heavy pack weight */ -hitweight() +int +hitweight(void) { return(2 - foodlev); } diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/fight.c --- a/arogue5/fight.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/fight.c Sun Feb 07 14:39:21 2016 -0500 @@ -13,10 +13,27 @@ */ #include "curses.h" +#include #include #include #include "rogue.h" +bool roll_em(struct thing *att_er, struct thing *def_er, struct object *weap, + bool hurl, struct object *cur_weapon, bool back_stab); +void hit(struct object *weapon, struct thing *tp, char *er, char *ee, + bool back_stab); +void miss(struct object *weapon, struct thing *tp, char *er, char *ee); +int dext_plus(int dexterity); +int str_plus(short str); +int add_dam(short str); +int hung_dam(void); +void thunk(struct object *weap, struct thing *tp, char *mname); +void m_thunk(struct object *weap, struct thing *tp, char *mname); +void bounce(struct object *weap, struct thing *tp, char *mname); +void m_bounce(struct object *weap, struct thing *tp, char *mname); +struct object *wield_weap(struct object *thrown, struct thing *mp); +void explode(struct thing *tp); + #define CONF_DAMAGE -1 #define PARAL_DAMAGE -2 #define DEST_DAMAGE -3 @@ -35,10 +52,8 @@ * The player attacks the monster. */ -fight(mp, weap, thrown) -register coord *mp; -struct object *weap; -bool thrown; +bool +fight(coord *mp, struct object *weap, bool thrown) { register struct thing *tp; register struct linked_list *item; @@ -204,10 +219,8 @@ * The monster attacks the player */ -attack(mp, weapon, thrown) -register struct thing *mp; -register struct object *weapon; -bool thrown; +bool +attack(struct thing *mp, struct object *weapon, bool thrown) { register const char *mname; register bool did_hit = FALSE; @@ -708,9 +721,8 @@ * returns true if the swing hits */ -swing(class, at_lvl, op_arm, wplus) -short class; -int at_lvl, op_arm, wplus; +bool +swing(short class, int at_lvl, int op_arm, int wplus) { register int res = rnd(20)+1; register int need; @@ -730,12 +742,9 @@ * Roll several attacks */ -roll_em(att_er, def_er, weap, hurl, cur_weapon, back_stab) -struct thing *att_er, *def_er; -struct object *weap; -bool hurl; -struct object *cur_weapon; -bool back_stab; +bool +roll_em(struct thing *att_er, struct thing *def_er, struct object *weap, + bool hurl, struct object *cur_weapon, bool back_stab) { register struct stats *att, *def; register char *cp = NULL; @@ -1028,9 +1037,7 @@ */ char * -prname(who, upper) -register char *who; -bool upper; +prname(char *who, bool upper) { static char tbuf[LINELEN]; @@ -1054,11 +1061,8 @@ * Print a message to indicate a succesful hit */ -hit(weapon, tp, er, ee, back_stab) -register struct object *weapon; -register struct thing *tp; -register char *er, *ee; -bool back_stab; +void +hit(struct object *weapon, struct thing *tp, char *er, char *ee, bool back_stab) { register char *s = NULL; char @@ -1114,10 +1118,8 @@ * Print a message to indicate a poor swing */ -miss(weapon, tp, er, ee) -register struct object *weapon; -register struct thing *tp; -register char *er, *ee; +void +miss(struct object *weapon, struct thing *tp, char *er, char *ee) { register char *s = NULL; char @@ -1161,8 +1163,8 @@ * compute to-hit bonus for dexterity */ -dext_plus(dexterity) -register int dexterity; +int +dext_plus(int dexterity) { return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3); } @@ -1173,8 +1175,8 @@ * compute armor class bonus for dexterity */ -dext_prot(dexterity) -register int dexterity; +int +dext_prot(int dexterity) { return ((dexterity-10)/2); } @@ -1183,8 +1185,8 @@ * compute bonus/penalties for strength on the "to hit" roll */ -str_plus(str) -register short str; +int +str_plus(short str) { return((str-10)/3); } @@ -1194,8 +1196,8 @@ * compute additional damage done for exceptionally high or low strength */ -add_dam(str) -register short str; +int +add_dam(short str) { return((str-9)/2); } @@ -1204,7 +1206,8 @@ * hung_dam: * Calculate damage depending on players hungry state */ -hung_dam() +int +hung_dam(void) { reg int howmuch = 0; @@ -1222,11 +1225,10 @@ * A missile hits a monster */ -thunk(weap, tp, mname) -register struct object *weap; -register struct thing *tp; /* Defender */ -register char *mname; +void +thunk(struct object *weap, struct thing *tp, char *mname) { + /* tp: Defender */ char *def_name; /* Name of defender */ /* What do we call the defender? */ @@ -1251,10 +1253,8 @@ * A missile from a monster hits the player */ -m_thunk(weap, tp, mname) -register struct object *weap; -register struct thing *tp; -register char *mname; +void +m_thunk(struct object *weap, struct thing *tp, char *mname) { char *att_name; /* Name of attacker */ @@ -1280,11 +1280,10 @@ * A missile misses a monster */ -bounce(weap, tp, mname) -register struct object *weap; -register struct thing *tp; /* Defender */ -register char *mname; +void +bounce(struct object *weap, struct thing *tp, char *mname) { + /* tp: Defender */ char *def_name; /* Name of defender */ /* What do we call the defender? */ @@ -1309,10 +1308,8 @@ A missle from a monster misses the player */ -m_bounce(weap, tp, mname) -register struct object *weap; -register struct thing *tp; -register char *mname; +void +m_bounce(struct object *weap, struct thing *tp, char *mname) { char *att_name; /* Name of attacker */ @@ -1339,8 +1336,8 @@ * Returns true if an object radiates magic */ -is_magic(obj) -register struct object *obj; +bool +is_magic(struct object *obj) { switch (obj->o_type) { @@ -1364,9 +1361,8 @@ * Called to put a monster to death */ -killed(item, pr, points) -register struct linked_list *item; -bool pr, points; +void +killed(struct linked_list *item, bool pr, bool points) { register struct thing *tp; register struct linked_list *pitem, *nexti; @@ -1447,9 +1443,7 @@ */ struct object * -wield_weap(thrown, mp) -struct object *thrown; -struct thing *mp; +wield_weap(struct object *thrown, struct thing *mp) { int look_for = 0, /* The projectile weapon we are looking for */ new_rate, /* The rating of a prospective weapon */ @@ -1529,8 +1523,8 @@ return(candidate); } -explode(tp) -register struct thing *tp; +void +explode(struct thing *tp) { register int x,y, damage; diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/init.c --- a/arogue5/init.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/init.c Sun Feb 07 14:39:21 2016 -0500 @@ -97,10 +97,8 @@ * make sure all the percentages specified in the tables add up to the * right amounts */ -badcheck(name, magic, bound) -char *name; -register struct magic_item *magic; -register int bound; +void +badcheck(char *name, struct magic_item *magic, int bound) { register struct magic_item *end; @@ -120,7 +118,8 @@ * Initialize the potion color scheme for this time */ -init_colors() +void +init_colors(void) { register int i, j; bool used[NCOLORS]; @@ -148,7 +147,8 @@ * Initialize the construction materials for wands and staffs */ -init_materials() +void +init_materials(void) { register int i, j; register char *str; @@ -201,7 +201,8 @@ * do any initialization for miscellaneous magic */ -init_misc() +void +init_misc(void) { register int i; @@ -221,7 +222,8 @@ * Generate the names of the various scrolls */ -init_names() +void +init_names(void) { register int nsyl; register char *cp, *sp; @@ -258,7 +260,8 @@ * roll up the rogue */ -init_player() +void +init_player(void) { int stat_total, ch = 0, wpt = 0, i, j; struct linked_list *weap_item, *armor_item, *food_item; @@ -459,7 +462,8 @@ * Initialize the ring stone setting scheme for this time */ -init_stones() +void +init_stones(void) { register int i, j; bool used[NSTONES]; @@ -487,7 +491,8 @@ * init_things * Initialize the probabilities for types of things */ -init_things() +void +init_things(void) { register struct magic_item *mp; diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/io.c --- a/arogue5/io.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/io.c Sun Feb 07 14:39:21 2016 -0500 @@ -18,6 +18,9 @@ #include #include "rogue.h" +void doadd(char *fmt, va_list ap); +void ministat(void); + /* * msg: * Display a message at the top of the screen. @@ -27,6 +30,7 @@ static int newpos = 0; /*VARARGS1*/ +void msg(char *fmt, ...) { va_list ap; @@ -54,6 +58,7 @@ /* * add things to the current message */ +void addmsg(char *fmt, ...) { va_list ap; @@ -66,7 +71,8 @@ * Display a new msg (giving him a chance to see the previous one if it * is up there with the --More--) */ -endmsg() +void +endmsg(void) { strncpy(huh, msgbuf, sizeof(huh)); @@ -96,6 +102,7 @@ draw(msgw); } +void doadd(char *fmt, va_list ap) { /* @@ -113,9 +120,8 @@ * flgptr will be NULL if we don't know what the monster is yet! */ -step_ok(y, x, can_on_monst, flgptr) -register int y, x, can_on_monst; -register struct thing *flgptr; +bool +step_ok(int y, int x, int can_on_monst, struct thing *flgptr) { /* can_on_monst = MONSTOK if all we care about are physical obstacles */ register struct linked_list *item; @@ -156,7 +162,8 @@ * returns true if it is ok for type to shoot over ch */ -shoot_ok(ch) +bool +shoot_ok(char ch) { switch (ch) { @@ -177,7 +184,8 @@ * getchar. */ -readchar() +int +readchar(void) { int ch; @@ -195,10 +203,11 @@ /* * status: * Display the important stats line. Keep the cursor where it was. + * If display is TRUE, display unconditionally */ -status(display) -bool display; /* is TRUE, display unconditionally */ +void +status(bool display) { register struct stats *stat_ptr, *max_ptr; register int oy = 0, ox = 0, temp; @@ -327,7 +336,8 @@ wmove(cw, oy, ox); } -ministat() +void +ministat(void) { register int oy, ox, temp; static char buf[LINELEN]; @@ -367,9 +377,8 @@ * Sit around until the guy types the right key */ -wait_for(win,ch) -WINDOW *win; -register char ch; +void +wait_for(WINDOW *win, char ch) { register char c; @@ -386,9 +395,8 @@ * function used to display a window and wait before returning */ -show_win(scr, message) -register WINDOW *scr; -char *message; +void +show_win(WINDOW *scr, char *message) { mvwaddstr(scr, 0, 0, message); touchwin(scr); @@ -403,9 +411,8 @@ * dbotline: * Displays message on bottom line and waits for a space to return */ -dbotline(scr,message) -WINDOW *scr; -char *message; +void +dbotline(WINDOW *scr, char *message) { mvwaddstr(scr,LINES-1,0,message); draw(scr); @@ -417,8 +424,8 @@ * restscr: * Restores the screen to the terminal */ -restscr(scr) -WINDOW *scr; +void +restscr(WINDOW *scr) { clearok(scr,TRUE); touchwin(scr); @@ -431,10 +438,7 @@ */ unsigned long -netread(error, size, stream) -int *error; -int size; -FILE *stream; +netread(int *error, int size, FILE *stream) { unsigned long result = 0L, /* What we read in */ partial; /* Partial value */ @@ -469,12 +473,13 @@ /* * netwrite: * Write out a byte, short, or long machine independently. + * value: What to write + * size: How much to write out + * stream: Where to write it */ -netwrite(value, size, stream) -unsigned long value; /* What to write */ -int size; /* How much to write out */ -FILE *stream; /* Where to write it */ +int +netwrite(unsigned long value, int size, FILE *stream) { int i; /* Goes through value one byte at a time */ char outc; /* The next character to be written */ diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/list.c --- a/arogue5/list.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/list.c Sun Feb 07 14:39:21 2016 -0500 @@ -21,8 +21,8 @@ * Takes an item out of whatever linked list it might be in */ -_detach(list, item) -register struct linked_list **list, *item; +void +_detach(struct linked_list **list, struct linked_list *item) { if (*list == item) *list = next(item); @@ -37,8 +37,8 @@ * add an item to the head of a list */ -_attach(list, item) -register struct linked_list **list, *item; +void +_attach(struct linked_list **list, struct linked_list *item) { if (*list != NULL) { @@ -60,8 +60,8 @@ * Throw the whole object list away */ -_o_free_list(ptr) -register struct linked_list **ptr; +void +_o_free_list(struct linked_list **ptr) { register struct linked_list *item; @@ -78,8 +78,8 @@ * free up an item and its object(and maybe contents) */ -o_discard(item) -register struct linked_list *item; +void +o_discard(struct linked_list *item) { register struct object *obj; obj = OBJPTR(item); @@ -95,8 +95,8 @@ * Throw the whole thing list away */ -_t_free_list(ptr) -register struct linked_list **ptr; +void +_t_free_list(struct linked_list **ptr) { register struct linked_list *item; @@ -113,8 +113,8 @@ * free up an item and its thing */ -t_discard(item) -struct linked_list *item; +void +t_discard(struct linked_list *item) { total -= 2; FREE(item->l_data); @@ -126,8 +126,8 @@ * get rid of an item structure -- don't worry about contents */ -destroy_item(item) -register struct linked_list *item; +void +destroy_item(struct linked_list *item) { total--; FREE(item); @@ -139,8 +139,7 @@ */ struct linked_list * -new_item(size) -int size; +new_item(int size) { register struct linked_list *item; @@ -158,7 +157,7 @@ */ struct linked_list * -creat_item() +creat_item(void) { register struct linked_list *item; @@ -169,8 +168,7 @@ } char * -new(size) -int size; +new(int size) { register char *space = ALLOC(size); static char errbuf[LINELEN]; diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/main.c --- a/arogue5/main.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/main.c Sun Feb 07 14:39:21 2016 -0500 @@ -43,10 +43,10 @@ #define NFRUIT (sizeof(funfruit) / sizeof (char *)) void open_records(void); +bool holiday(void); -main(argc, argv, envp) -char **argv; -char **envp; +int +main(int argc, char *argv[], char *envp[]) { register char *env; int lowtime; @@ -123,7 +123,6 @@ * Check for a network update */ if (argc == 2 && strcmp(argv[1], "-u") == 0) { - unsigned long netread(); int errcheck, errors = 0; unsigned long amount; short monster; @@ -277,8 +276,8 @@ * Exit the program, printing a message. */ -fatal(s) -char *s; +void +fatal(char *s) { clear(); move(LINES-2, 0); @@ -294,8 +293,8 @@ * Pick a very random number. */ -rnd(range) -register int range; +int +rnd(int range) { return(range == 0 ? 0 : md_rand() % range); } @@ -305,8 +304,8 @@ * roll a number of dice */ -roll(number, sides) -register int number, sides; +int +roll(int number, int sides) { register int dtotal = 0; @@ -336,10 +335,11 @@ } # endif -setup() +void +setup(void) { #ifdef CHECKTIME - int checkout(); + void checkout(); #endif #ifndef DUMP @@ -392,7 +392,8 @@ * refreshing things and looking at the proper times. */ -playit() +void +playit(void) { register char *opts; @@ -416,7 +417,8 @@ /* * see if the system is being used too much for this game */ -too_much() +bool +too_much(void) { #ifdef MAXLOAD double avec[3]; @@ -435,7 +437,8 @@ * author: * See if a user is an author of the program */ -author() +bool +author(void) { switch (md_getuid()) { #if AUTHOR @@ -450,7 +453,24 @@ #ifdef CHECKTIME -checkout() +/* + * checkout()'s version of msg. If we are in the middle of a shell, do a + * printf instead of a msg to avoid the refresh. + */ +void +chmsg(char *fmt, int arg) +{ + if (in_shell) { + printf(fmt, arg); + putchar('\n'); + fflush(stdout); + } + else + msg(fmt, arg); +} + +void +checkout(void) { static char *msgs[] = { "The system is too loaded for games. Please leave in %d minutes", @@ -482,23 +502,6 @@ alarm(CHECKTIME * 60); } } - -/* - * checkout()'s version of msg. If we are in the middle of a shell, do a - * printf instead of a msg to avoid the refresh. - */ -chmsg(fmt, arg) -char *fmt; -int arg; -{ - if (in_shell) { - printf(fmt, arg); - putchar('\n'); - fflush(stdout); - } - else - msg(fmt, arg); -} #endif #ifdef LOADAV @@ -510,8 +513,8 @@ "_avenrun" }; -loadav(avg) -reg double *avg; +void +loadav(double *avg) { reg int kmem; @@ -536,7 +539,8 @@ #include #include struct utmp buf; -ucount() +int +ucount(void) { reg struct utmp *up; reg FILE *utmp; @@ -559,7 +563,8 @@ * holiday: * Returns TRUE when it is a good time to play rogue */ -holiday() +bool +holiday(void) { time_t now; struct tm *localtime(); diff -r 94a0d9dd5ce1 -r 56e748983fa8 arogue5/maze.c --- a/arogue5/maze.c Sun Jan 31 13:45:07 2016 -0500 +++ b/arogue5/maze.c Sun Feb 07 14:39:21 2016 -0500 @@ -30,15 +30,20 @@ *bits; static int maze_lines, maze_cols; -char *moffset(), - *foffset(); + +void draw_maze(void); +int findcells(int y, int x); +char *foffset(int y, int x); +char *moffset(int y, int x); +void rmwall(int newy, int newx, int oldy, int oldx);