# HG changeset patch # User John "Elwin" Edwards # Date 1454265907 18000 # Node ID 94a0d9dd5ce17ee1e58db5ee6deaba84c5a13ecc # Parent b24545357d2e099fd7c172933a7c29ff4926ac18 Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings. diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/armor.c --- a/srogue/armor.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/armor.c Sun Jan 31 13:45:07 2016 -0500 @@ -21,7 +21,8 @@ * wear: * The player wants to wear something, so let the hero try */ -wear() +void +wear(void) { reg struct linked_list *item; reg struct object *obj; @@ -50,7 +51,8 @@ * take_off: * Get the armor off of the players back */ -take_off() +void +take_off(void) { reg struct object *obj; @@ -69,9 +71,8 @@ * initarmor: * Initialize some armor. */ -initarmor(obj, what) -struct object *obj; -int what; +void +initarmor(struct object *obj, int what) { struct init_armor *iwa; struct magic_item *mi; @@ -90,8 +91,8 @@ * hurt_armor: * Returns TRUE if armor is damaged */ -hurt_armor(obj) -struct object *obj; +bool +hurt_armor(struct object *obj) { reg int type, ac; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/chase.c --- a/srogue/chase.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/chase.c Sun Jan 31 13:45:07 2016 -0500 @@ -14,19 +14,24 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include "rogue.h" #include "rogue.ext" #define FARAWAY 32767 #define RDIST(a, b) (DISTANCE((a)->y, (a)->x, (b).y, (b).x)) +int do_chase(struct linked_list *mon); +int chase(struct thing *tp, struct coord *ee, bool runaway, bool dofight); + struct coord ch_ret; /* Where chasing takes you */ /* * runners: * Make all the running monsters move. */ -runners() +void +runners(void) { reg struct thing *tp; reg struct linked_list *mon,*nextmon; @@ -54,8 +59,8 @@ * do_chase: * Make one thing chase another. */ -do_chase(mon) -struct linked_list *mon; +int +do_chase(struct linked_list *mon) { reg struct thing *th; reg struct room *rer, *ree, *rxx; @@ -241,10 +246,8 @@ * chasee. Returns TRUE if we want to keep on chasing * later FALSE if we reach the goal. */ -chase(tp, ee, runaway, dofight) -struct thing *tp; -struct coord *ee; -bool runaway, dofight; +int +chase(struct thing *tp, struct coord *ee, bool runaway, bool dofight) { reg int x, y, ch; reg int dist, thisdist, closest; @@ -385,9 +388,8 @@ * runto: * Set a monster running after something */ -runto(runner, spot) -struct coord *runner; -struct coord *spot; +void +runto(struct coord *runner, struct coord *spot) { reg struct linked_list *item; reg struct thing *tp; @@ -409,8 +411,7 @@ * NULL means they aren't in any room. */ struct room * -roomin(cp) -struct coord *cp; +roomin(struct coord *cp) { reg struct room *rp; @@ -428,8 +429,7 @@ * Find the monster from his coordinates */ struct linked_list * -find_mons(y, x) -int y, x; +find_mons(int y, int x) { reg struct linked_list *item; reg struct thing *th; @@ -447,8 +447,8 @@ * diag_ok: * Check to see if the move is legal if it is diagonal */ -diag_ok(sp, ep) -struct coord *sp, *ep; +bool +diag_ok(struct coord *sp, struct coord *ep) { if (ep->x == sp->x || ep->y == sp->y) return TRUE; @@ -462,8 +462,8 @@ * cansee: * returns true if the hero can see a certain coordinate. */ -cansee(y, x) -int y, x; +bool +cansee(int y, int x) { reg struct room *rer; struct coord tp; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/command.c --- a/srogue/command.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/command.c Sun Jan 31 13:45:07 2016 -0500 @@ -29,11 +29,19 @@ #include #endif +void search(void); +void help(void); +void d_level(void); +void u_level(void); +void shell(void); +void call(void); + /* * command: * Process the user commands */ -command() +void +command(void) { reg char ch; reg int ntimes = 1; /* Number of player moves */ @@ -416,7 +424,8 @@ * Player gropes about him to find hidden things. */ -search() +void +search(void) { reg int x, y; reg char ch; @@ -461,7 +470,8 @@ * help: * Give single character help, or the whole mess if he wants it */ -help() +void +help(void) { extern struct h_list helpstr[]; reg struct h_list *strp; @@ -519,8 +529,7 @@ * Tell the player what a certain thing is. */ char * -identify(what) -int what; +identify(int what) { reg char ch, *str; @@ -581,7 +590,8 @@ * d_level: * He wants to go down a level */ -d_level() +void +d_level(void) { if (winat(hero.y, hero.x) != STAIRS) msg("I see no way down."); @@ -599,7 +609,8 @@ * u_level: * He wants to go up a level */ -u_level() +void +u_level(void) { if (winat(hero.y, hero.x) == STAIRS) { if (pl_on(ISHELD)) { @@ -624,7 +635,8 @@ /* * Let him escape for a while */ -shell() +void +shell(void) { reg int pid; reg char *sh; @@ -659,7 +671,8 @@ * call: * Allow a user to call a potion, scroll, or ring something */ -call() +void +call(void) { reg struct object *obj; reg struct linked_list *item; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/daemon.c --- a/srogue/daemon.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/daemon.c Sun Jan 31 13:45:07 2016 -0500 @@ -34,8 +34,7 @@ * Insert a function in the daemon list. */ struct delayed_action * -d_insert(func, arg, type, time) -int arg, type, time, (*func)(); +d_insert(int (*func)(), int arg, int type, int time) { reg struct delayed_action *dev; @@ -51,8 +50,8 @@ return NULL; } -d_delete(wire) -struct delayed_action *wire; +void +d_delete(struct delayed_action *wire) { reg struct delayed_action *d1, *d2; @@ -73,8 +72,7 @@ * Find a particular slot in the table */ struct delayed_action * -find_slot(func) -int (*func)(); +find_slot(int (*func)()) { reg struct delayed_action *dev; @@ -88,8 +86,8 @@ * start_daemon: * Start a daemon, takes a function. */ -start_daemon(func, arg, type) -int arg, type, (*func)(); +void +start_daemon(int (*func)(), int arg, int type) { d_insert(func, arg, type, DAEMON); } @@ -99,8 +97,8 @@ * Run all the daemons that are active with the current * flag, passing the argument to the function. */ -do_daemons(flag) -int flag; +void +do_daemons(int flag) { reg struct delayed_action *dev; @@ -113,8 +111,8 @@ * fuse: * Start a fuse to go off in a certain number of turns */ -fuse(func, arg, time) -int (*func)(), arg, time; +void +fuse(int (*func)(), int arg, int time) { d_insert(func, arg, AFTER, time); } @@ -123,8 +121,8 @@ * lengthen: * Increase the time until a fuse goes off */ -lengthen(func, xtime) -int (*func)(), xtime; +void +lengthen(int (*func)(), int xtime) { reg struct delayed_action *wire; @@ -137,8 +135,8 @@ * extinguish: * Put out a fuse. Find all such fuses and kill them. */ -extinguish(func) -int (*func)(); +void +extinguish(int (*func)()) { reg struct delayed_action *dev; @@ -151,7 +149,8 @@ * do_fuses: * Decrement counters and start needed fuses */ -do_fuses() +void +do_fuses(void) { reg struct delayed_action *dev; @@ -170,7 +169,8 @@ * activity: * Show wizard number of demaons and memory blocks used */ -activity() +void +activity(void) { msg("Daemons = %d : Memory Items = %d : Memory Used = %d", demoncnt,total,md_memused()); diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/daemons.c --- a/srogue/daemons.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/daemons.c Sun Jan 31 13:45:07 2016 -0500 @@ -23,8 +23,8 @@ * doctor: * A healing daemon that restores hit points after rest */ -doctor(fromfuse) -int fromfuse; +void +doctor(int fromfuse) { reg int *thp, lv, ohp, ccon; @@ -63,8 +63,8 @@ * Swander: * Called when it is time to start rolling for wandering monsters */ -swander(fromfuse) -int fromfuse; +void +swander(int fromfuse) { start_daemon(rollwand, TRUE, AFTER); } @@ -74,8 +74,8 @@ * rollwand: * Called to roll to see if a wandering monster starts up */ -rollwand(fromfuse) -int fromfuse; +void +rollwand(int fromfuse) { if (++between >= 4) { @@ -94,8 +94,8 @@ * unconfuse: * Release the poor player from his confusion */ -unconfuse(fromfuse) -int fromfuse; +void +unconfuse(int fromfuse) { if (pl_on(ISHUH)) msg("You feel less confused now."); @@ -106,8 +106,8 @@ * unsee: * He lost his see invisible power */ -unsee(fromfuse) -int fromfuse; +void +unsee(int fromfuse) { player.t_flags &= ~CANSEE; } @@ -116,8 +116,8 @@ * sight: * He gets his sight back */ -sight(fromfuse) -int fromfuse; +void +sight(int fromfuse) { if (pl_on(ISBLIND)) msg("The veil of darkness lifts."); @@ -129,8 +129,8 @@ * nohaste: * End the hasting */ -nohaste(fromfuse) -int fromfuse; +void +nohaste(int fromfuse) { if (pl_on(ISHASTE)) msg("You feel yourself slowing down."); @@ -142,8 +142,8 @@ * stomach: * Digest the hero's food */ -stomach(fromfuse) -int fromfuse; +void +stomach(int fromfuse) { reg int oldfood, old_hunger; @@ -188,8 +188,8 @@ * noteth: * Hero is no longer etherereal */ -noteth(fromfuse) -int fromfuse; +void +noteth(int fromfuse) { int ch; @@ -209,8 +209,8 @@ * sapem: * Sap the hero's life away */ -sapem(fromfuse) -int fromfuse; +void +sapem(int fromfuse) { chg_abil(rnd(4) + 1, -1, TRUE); fuse(sapem, TRUE, 150); @@ -221,8 +221,8 @@ * notslow: * Restore the hero's normal speed */ -notslow(fromfuse) -int fromfuse; +void +notslow(int fromfuse) { if (pl_on(ISSLOW)) msg("You no longer feel hindered."); @@ -233,8 +233,8 @@ * notregen: * Hero is no longer regenerative */ -notregen(fromfuse) -int fromfuse; +void +notregen(int fromfuse) { if (pl_on(ISREGEN)) msg("You no longer feel bolstered."); @@ -245,8 +245,8 @@ * notinvinc: * Hero not invincible any more */ -notinvinc(fromfuse) -int fromfuse; +void +notinvinc(int fromfuse) { if (pl_on(ISINVINC)) msg("You no longer feel invincible."); diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/disply.c --- a/srogue/disply.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/disply.c Sun Jan 31 13:45:07 2016 -0500 @@ -18,7 +18,8 @@ * displevl: * Display detailed level for wizard and scroll */ -displevl() +void +displevl(void) { reg char ch, mch; reg int i,j; @@ -73,7 +74,8 @@ * dispmons: * Show monsters for wizard and potion */ -dispmons() +void +dispmons(void) { reg int ch, y, x; reg struct thing *it; @@ -95,8 +97,8 @@ * winat: * Get whatever character is at a location on the screen */ -winat(y, x) -int x, y; +char +winat(int y, int x) { reg char ch; @@ -111,8 +113,8 @@ * cordok: * Returns TRUE if coordinate is on usable screen */ -cordok(y, x) -int y, x; +bool +cordok(int y, int x) { if (x < 0 || y < 0 || x >= COLS || y >= LINES - 1) return FALSE; @@ -123,8 +125,8 @@ * pl_on: * Returns TRUE if the player's flag is set */ -pl_on(what) -long what; +bool +pl_on(long what) { return (player.t_flags & what); } @@ -134,8 +136,8 @@ * pl_off: * Returns TRUE when player's flag is reset */ -pl_off(what) -long what; +bool +pl_off(long what) { return (!(player.t_flags & what)); } @@ -145,9 +147,8 @@ * o_on: * Returns TRUE in the objects flag is set */ -o_on(what,bit) -struct object *what; -long bit; +bool +o_on(struct object *what, long bit) { reg int flag; @@ -162,9 +163,8 @@ * o_off: * Returns TRUE is the objects flag is reset */ -o_off(what,bit) -struct object *what; -long bit; +bool +o_off(struct object *what, long bit) { reg int flag; @@ -179,9 +179,8 @@ * setoflg: * Set the specified flag for the object */ -setoflg(what,bit) -struct object *what; -long bit; +void +setoflg(struct object *what, long bit) { what->o_flags |= bit; } @@ -191,9 +190,8 @@ * resoflg: * Reset the specified flag for the object */ -resoflg(what,bit) -struct object *what; -long bit; +void +resoflg(struct object *what, long bit) { what->o_flags &= ~bit; } diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/encumb.c --- a/srogue/encumb.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/encumb.c Sun Jan 31 13:45:07 2016 -0500 @@ -10,14 +10,19 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include "rogue.h" #include "rogue.ext" +int packweight(void); +int pack_vol(void); + /* * updpack: * Update his pack weight and adjust fooduse accordingly */ -updpack() +void +updpack(void) { reg int topcarry, curcarry; @@ -44,7 +49,8 @@ * packweight: * Get the total weight of the hero's pack */ -packweight() +int +packweight(void) { reg struct object *obj; reg struct linked_list *pc; @@ -72,8 +78,8 @@ * itemweight: * Get the weight of an object */ -itemweight(wh) -struct object *wh; +int +itemweight(struct object *wh) { reg int weight; @@ -97,7 +103,8 @@ * pack_vol: * Get the total volume of the hero's pack */ -pack_vol() +int +pack_vol(void) { reg struct object *obj; reg struct linked_list *pc; @@ -115,8 +122,8 @@ * itemvol: * Get the volume of an object */ -itemvol(wh) -struct object *wh; +int +itemvol(struct object *wh) { reg int volume, what, extra; @@ -139,9 +146,10 @@ * playenc: * Get hero's carrying ability above norm */ -playenc() +int +playenc(void) { - reg estr = him->s_ef.a_str; + reg int estr = him->s_ef.a_str; if (estr >= 24) return 3000; switch(him->s_ef.a_str) { @@ -174,7 +182,8 @@ * totalenc: * Get total weight that the hero can carry */ -totalenc() +int +totalenc(void) { reg int wtotal; @@ -192,8 +201,8 @@ * whgtchk: * See if the hero can carry his pack */ -wghtchk(fromfuse) -int fromfuse; +void +wghtchk(int fromfuse) { reg int dropchk, err = TRUE; reg char ch; @@ -231,7 +240,8 @@ * 0 hit for medium pack weight * -1 hit for heavy pack weight */ -hitweight() +int +hitweight(void) { return(2 - foodlev); } diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/fight.c --- a/srogue/fight.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/fight.c Sun Jan 31 13:45:07 2016 -0500 @@ -14,19 +14,26 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include +#include #include "rogue.h" #include "rogue.ext" +bool roll_em(struct stats *att, struct stats *def, struct object *weap, bool hurl); +char *mindex(char *cp, char c); +char *prname(char *who, bool upper); +void hit(char *er); +void miss(char *er); +void thunk(struct object *weap, char *mname); +void bounce(struct object *weap, char *mname); /* * fight: * The player attacks the monster. */ -fight(mp, weap, thrown) -struct coord *mp; -struct object *weap; -bool thrown; +bool +fight(struct coord *mp, struct object *weap, bool thrown) { reg struct thing *tp; @@ -123,8 +130,8 @@ * attack: * The monster attacks the player */ -attack(mp) -struct thing *mp; +int +attack(struct thing *mp) { reg char *mname; @@ -349,8 +356,8 @@ * swing: * Returns true if the swing hits */ -swing(at_lvl, op_arm, wplus) -int at_lvl, op_arm, wplus; +bool +swing(int at_lvl, int op_arm, int wplus) { reg int res = rnd(20)+1; reg int need = (21 - at_lvl) - op_arm; @@ -363,7 +370,8 @@ * check_level: * Check to see if the guy has gone up a level. */ -check_level() +void +check_level(void) { reg int lev, add, dif; @@ -387,15 +395,12 @@ * roll_em: * Roll several attacks */ -roll_em(att, def, weap, hurl) -struct stats *att, *def; -struct object *weap; -bool hurl; +bool +roll_em(struct stats *att, struct stats *def, struct object *weap, bool hurl) { reg char *cp; reg int ndice, nsides, def_arm, prop_hplus, prop_dplus; reg bool did_hit = FALSE; - char *mindex(); prop_hplus = prop_dplus = 0; if (weap == NULL) { @@ -479,8 +484,7 @@ * Look for char 'c' in string pointed to by 'cp' */ char * -mindex(cp, c) -char *cp, c; +mindex(char *cp, char c) { reg int i; @@ -498,9 +502,7 @@ * The print name of a combatant */ char * -prname(who, upper) -char *who; -bool upper; +prname(char *who, bool upper) { static char tbuf[LINLEN]; @@ -522,8 +524,8 @@ * hit: * Print a message to indicate a succesful hit */ -hit(er) -char *er; +void +hit(char *er) { msg("%s hit.",prname(er, TRUE)); } @@ -533,8 +535,8 @@ * miss: * Print a message to indicate a poor swing */ -miss(er) -char *er; +void +miss(char *er) { msg("%s miss%s.",prname(er, TRUE),(er == 0 ? "":"es")); } @@ -544,9 +546,8 @@ * save_throw: * See if a creature saves against something */ -save_throw(which, tp) -int which; -struct thing *tp; +bool +save_throw(int which, struct thing *tp) { reg int need; reg struct stats *st; @@ -561,8 +562,8 @@ * save: * See if he saves against various nasty things */ -save(which) -int which; +bool +save(int which) { return save_throw(which, &player); } @@ -571,7 +572,8 @@ * raise_level: * The guy just magically went up a level. */ -raise_level() +void +raise_level(void) { him->s_exp = e_levels[him->s_lvl-1] + 1L; check_level(); @@ -582,9 +584,8 @@ * thunk: * A missile hits a monster */ -thunk(weap, mname) -struct object *weap; -char *mname; +void +thunk(struct object *weap, char *mname) { if (weap->o_type == WEAPON) msg("The %s hits the %s.",w_magic[weap->o_which].mi_name,mname); @@ -597,9 +598,8 @@ * bounce: * A missile misses a monster */ -bounce(weap, mname) -struct object *weap; -char *mname; +void +bounce(struct object *weap, char *mname) { if (weap->o_type == WEAPON) msg("The %s misses the %s.", w_magic[weap->o_which].mi_name,mname); @@ -612,9 +612,8 @@ * remove: * Remove a monster from the screen */ -remove_monster(mp, item) -struct coord *mp; -struct linked_list *item; +void +remove_monster(struct coord *mp, struct linked_list *item) { reg char what; @@ -633,8 +632,8 @@ * is_magic: * Returns true if an object radiates magic */ -is_magic(obj) -struct object *obj; +bool +is_magic(struct object *obj) { switch (obj->o_type) { case ARMOR: @@ -656,9 +655,8 @@ * killed: * Called to put a monster to death */ -killed(item, pr) -struct linked_list *item; -bool pr; +void +killed(struct linked_list *item, bool pr) { reg struct thing *tp; reg struct object *obj; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/init.c --- a/srogue/init.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/init.c Sun Jan 31 13:45:07 2016 -0500 @@ -19,6 +19,9 @@ #include "rogue.h" #include "rogue.ext" +int pinit(void); +void badcheck(char *name, struct magic_item *magic); + char *rainbow[NCOLORS] = { "Red", "Blue", "Green", "Yellow", "Black", "Brown", "Orange", "Pink", @@ -82,24 +85,11 @@ }; /* - * init_everything: - * Set up all important stuff. - */ -init_everything() -{ - init_player(); /* Roll up the rogue */ - init_things(); /* Set up probabilities */ - init_names(); /* Set up names of scrolls */ - init_colors(); /* Set up colors of potions */ - init_stones(); /* Set up stones in rings */ - init_materials(); /* Set up materials of wands */ -} - -/* * init_things: * Initialize the probabilities for types of things */ -init_things() +void +init_things(void) { struct magic_item *mi; @@ -128,7 +118,8 @@ * init_colors: * Initialize the potion color scheme for this time */ -init_colors() +void +init_colors(void) { reg int i, j; reg char *str; @@ -155,7 +146,8 @@ * init_names: * Generate the names of the various scrolls */ -init_names() +void +init_names(void) { reg int nsyl; reg char *cp, *sp; @@ -189,7 +181,8 @@ * Initialize the ring stone setting scheme for this time */ -init_stones() +void +init_stones(void) { reg int i, j; reg char *str; @@ -217,7 +210,8 @@ * Initialize the construction materials for wands and staffs */ -init_materials() +void +init_materials(void) { int i, j; char *str; @@ -264,9 +258,8 @@ badcheck("sticks", ws_magic); } -badcheck(name, magic) -char *name; -struct magic_item *magic; +void +badcheck(char *name, struct magic_item *magic) { struct magic_item *mg; @@ -289,7 +282,8 @@ * roll up the rogue */ -init_player() +void +init_player(void) { player.t_nomove = 0; player.t_nocmd = 0; @@ -315,7 +309,8 @@ * pinit: * Returns the best 3 of 4 on a 6-sided die */ -pinit() +int +pinit(void) { int best[4]; reg int i, min, minind, dicetot; @@ -337,3 +332,18 @@ } return(dicetot); } + +/* + * init_everything: + * Set up all important stuff. + */ +void +init_everything(void) +{ + init_player(); /* Roll up the rogue */ + init_things(); /* Set up probabilities */ + init_names(); /* Set up names of scrolls */ + init_colors(); /* Set up colors of potions */ + init_stones(); /* Set up stones in rings */ + init_materials(); /* Set up materials of wands */ +} diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/io.c --- a/srogue/io.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/io.c Sun Jan 31 13:45:07 2016 -0500 @@ -20,7 +20,7 @@ #include "rogue.h" #include "rogue.ext" -int md_readchar(WINDOW *win); +void doadd(char *fmt, va_list ap); /* * msg: @@ -29,6 +29,7 @@ static char msgbuf[BUFSIZ]; static int newpos = 0; +void msg(char *fmt, ...) { va_list ap; @@ -54,6 +55,7 @@ * addmsg: * Add things to the current message */ +void addmsg(char *fmt, ...) { va_list ap; @@ -68,7 +70,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) { strcpy(huh, msgbuf); if (mpos > 0) { @@ -88,6 +91,7 @@ * doadd: * Perform a printf into a buffer */ +void doadd(char *fmt, va_list ap) { vsprintf(&msgbuf[newpos], fmt, ap); @@ -98,8 +102,8 @@ * step_ok: * Returns TRUE if it is ok to step on ch */ -step_ok(ch) -unsigned char ch; +bool +step_ok(unsigned char ch) { if (dead_end(ch)) return FALSE; @@ -113,8 +117,8 @@ * dead_end: * Returns TRUE if you cant walk through that character */ -dead_end(ch) -char ch; +bool +dead_end(char ch) { if (ch == '-' || ch == '|' || ch == ' ' || ch == SECRETDOOR) return TRUE; @@ -129,7 +133,8 @@ * getchar. */ -readchar() +int +readchar(void) { char c; @@ -148,8 +153,8 @@ * status: * Display the important stats line. Keep the cursor where it was. */ -status(fromfuse) -int fromfuse; +void +status(int fromfuse) { reg int totwght, carwght; reg struct real *stef, *stre, *stmx; @@ -220,7 +225,8 @@ * dispmax: * Display the hero's maximum status */ -dispmax() +void +dispmax(void) { reg struct real *hmax; @@ -233,8 +239,8 @@ * illeg_ch: * Returns TRUE if a char shouldn't show on the screen */ -illeg_ch(ch) -unsigned char ch; +bool +illeg_ch(unsigned char ch) { if (ch < 32 || ch > 127) return TRUE; @@ -247,9 +253,8 @@ * wait_for: * Sit around until the guy types the right key */ -wait_for(win,ch) -WINDOW *win; -char ch; +void +wait_for(WINDOW *win, char ch) { register char c; @@ -293,9 +298,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); @@ -307,8 +311,8 @@ * restscr: * Restores the screen to the terminal */ -restscr(scr) -WINDOW *scr; +void +restscr(WINDOW *scr) { clearok(scr,TRUE); touchwin(scr); @@ -318,8 +322,8 @@ * npch: * Get the next char in line for inventories */ -npch(ch) -char ch; +char +npch(char ch) { reg char nch; if (ch >= 'z') diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/list.c --- a/srogue/list.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/list.c Sun Jan 31 13:45:07 2016 -0500 @@ -23,8 +23,8 @@ * Takes an item out of whatever linked list it might be in */ -_detach(list, item) -struct linked_list **list, *item; +void +_detach(struct linked_list **list, struct linked_list *item) { if (*list == item) *list = next(item); @@ -39,8 +39,8 @@ /* * _attach: add an item to the head of a list */ -_attach(list, item) -struct linked_list **list, *item; +void +_attach(struct linked_list **list, struct linked_list *item) { if (*list != NULL) { item->l_next = *list; @@ -57,8 +57,8 @@ /* * _free_list: Throw the whole blamed thing away */ -_free_list(ptr) -struct linked_list **ptr; +void +_free_list(struct linked_list **ptr) { register struct linked_list *item; @@ -72,8 +72,8 @@ /* * discard: free up an item */ -discard(item) -struct linked_list *item; +void +discard(struct linked_list *item) { total -= 2; FREE(item->l_data); @@ -84,8 +84,7 @@ * new_item: get a new item with a specified size */ struct linked_list * -new_item(size) -int size; +new_item(int size) { register struct linked_list *item; @@ -96,8 +95,7 @@ } char * -new(size) -int size; +new(int size) { register char *space = ALLOC(size); diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/main.c --- a/srogue/main.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/main.c Sun Jan 31 13:45:07 2016 -0500 @@ -34,14 +34,14 @@ #include "rogue.ext" +char *roguehome(void); void open_records(void); extern int scorefd; extern FILE *logfile; -main(argc, argv, envp) -char **argv; -char **envp; +int +main(int argc, char *argv[], char *envp[]) { register char *env; register struct linked_list *item; @@ -50,7 +50,6 @@ char *getpass(), *xcrypt(), *strrchr(); int lowtime; time_t now; - char *roguehome(); char *homedir = roguehome(); #ifdef __DJGPP__ @@ -322,8 +321,8 @@ * Exit the program, printing a message. */ -fatal(s) -char *s; +void +fatal(char *s) { clear(); refresh(); @@ -340,8 +339,7 @@ */ void -byebye(how) -int how; +byebye(int how) { if (!isendwin()) endwin(); @@ -354,8 +352,8 @@ * rnd: * Pick a very random number. */ -rnd(range) -int range; +int +rnd(int range) { reg int wh; @@ -372,8 +370,8 @@ * roll: * roll a number of dice */ -roll(number, sides) -int number, sides; +int +roll(int number, int sides) { reg int dtotal = 0; @@ -386,7 +384,8 @@ /* ** setup: Setup signal catching functions */ -setup() +void +setup(void) { md_onsignal_autosave(); @@ -400,7 +399,8 @@ ** refreshing things and looking at the proper times. */ -playit() +void +playit(void) { reg char *opts; @@ -421,7 +421,8 @@ /* ** author: See if a user is an author of the program */ -author() +bool +author(void) { switch (playuid) { case 100: @@ -444,7 +445,7 @@ } char * -roguehome() +roguehome(void) { static char path[LINLEN+16]; char *end,*home; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/misc.c --- a/srogue/misc.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/misc.c Sun Jan 31 13:45:07 2016 -0500 @@ -22,7 +22,8 @@ * waste_time: * Do nothing but let other things happen */ -waste_time() +void +waste_time(void) { if (inwhgt) /* if from wghtchk, then done */ return; @@ -35,8 +36,8 @@ * getindex: * Convert a type into an index for the things structures */ -getindex(what) -char what; +int +getindex(char what) { int index = -1; @@ -58,8 +59,7 @@ * print the name of a trap */ char * -tr_name(ch) -char ch; +tr_name(char ch) { reg char *s; @@ -92,8 +92,8 @@ * Look: * A quick glance all around the player */ -look(wakeup) -bool wakeup; +void +look(bool wakeup) { reg char ch; reg int oldx, oldy, y, x; @@ -230,8 +230,7 @@ * find the unclaimed object at y, x */ struct linked_list * -find_obj(y, x) -int y, x; +find_obj(int y, int x) { reg struct linked_list *obj; reg struct object *op; @@ -248,7 +247,8 @@ * eat: * Let the hero eat some food. */ -eat() +void +eat(void) { reg struct linked_list *item; reg struct object *obj; @@ -297,7 +297,8 @@ * aggravate: * aggravate all the monsters on this level */ -aggravate() +void +aggravate(void) { reg struct linked_list *mi; @@ -310,8 +311,7 @@ * If string starts with a vowel, return "n" for an "an" */ char * -vowelstr(str) -char *str; +vowelstr(char *str) { switch (tolower(*str)) { case 'a': @@ -329,8 +329,8 @@ * is_current: * See if the object is one of the currently used items */ -is_current(obj) -struct object *obj; +bool +is_current(struct object *obj) { if (obj == NULL) return FALSE; @@ -346,7 +346,8 @@ * get_dir: * Set up the direction coordinates */ -get_dir() +bool +get_dir(void) { reg char *prompt; reg bool gotit; @@ -384,8 +385,8 @@ * initfood: * Set up stuff for a food-type object */ -initfood(what) -struct object *what; +void +initfood(struct object *what) { what->o_type = FOOD; what->o_group = NORMFOOD; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/monsters.c --- a/srogue/monsters.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/monsters.c Sun Jan 31 13:45:07 2016 -0500 @@ -14,6 +14,7 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include "rogue.h" #include #include "rogue.ext" @@ -23,10 +24,10 @@ * Pick a monster to show up. The lower the level, * the meaner the monster. */ -rnd_mon(wander,baddie) -bool wander; -bool baddie; /* TRUE when from a polymorph stick */ +char +rnd_mon(bool wander, bool baddie) { + /* baddie; TRUE when from a polymorph stick */ reg int i, ok, cnt; cnt = 0; @@ -60,7 +61,8 @@ * lev_mon: * This gets all monsters possible on this level */ -lev_mon() +void +lev_mon(void) { reg int i; reg struct monster *mm; @@ -83,10 +85,7 @@ * Pick a new monster and add it to the list */ struct linked_list * -new_monster(type, cp, treas) -struct coord *cp; -bool treas; -char type; +new_monster(char type, struct coord *cp, bool treas) { reg struct linked_list *item; reg struct thing *tp; @@ -191,7 +190,8 @@ * wanderer: * A wandering monster has awakened and is headed for the player */ -wanderer() +void +wanderer(void) { reg int ch = '-'; reg struct room *rp, *hr = player.t_room; @@ -217,8 +217,7 @@ * What to do when the hero steps next to a monster */ struct linked_list * -wake_monster(y, x) -int y, x; +wake_monster(int y, int x) { reg struct thing *tp; reg struct linked_list *it; @@ -279,7 +278,8 @@ * genocide: * Eradicate a monster forevermore */ -genocide() +void +genocide(void) { reg struct linked_list *ip, *nip; reg struct thing *mp; @@ -331,8 +331,8 @@ * unhold: * Release the player from being held */ -unhold(whichmon) -char whichmon; +void +unhold(char whichmon) { switch (whichmon) { case 'F': @@ -347,8 +347,8 @@ * midx: * This returns an index to 'whichmon' */ -midx(whichmon) -char whichmon; +int +midx(char whichmon) { if (isupper(whichmon)) return(whichmon - 'A'); /* 0 to 25 for uppercase */ @@ -363,8 +363,8 @@ * See when monster should run or fight. Return * TRUE if hit points less than acceptable. */ -monhurt(th) -struct thing *th; +bool +monhurt(struct thing *th) { reg int ewis, crithp, f1, f2; reg struct stats *st; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/move.c --- a/srogue/move.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/move.c Sun Jan 31 13:45:07 2016 -0500 @@ -14,6 +14,7 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include #include "rogue.h" #include "rogue.ext" @@ -29,8 +30,8 @@ * Start the hero running */ -do_run(ch) -char ch; +void +do_run(char ch) { running = TRUE; after = FALSE; @@ -43,8 +44,8 @@ * consequences (fighting, picking up, etc.) */ -do_move(dy, dx) -int dy, dx; +void +do_move(int dy, int dx) { reg int ch; reg struct room *rp; @@ -209,8 +210,8 @@ * Called to illuminate a room. * If it is dark, remove anything that might move. */ -light(cp) -struct coord *cp;