# 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; +void +light(struct coord *cp) { reg struct room *rp; reg int j, k, x, y; @@ -291,8 +292,8 @@ * show: * returns what a certain thing will display as to the un-initiated */ -show(y, x) -int y, x; +char +show(int y, int x) { reg char ch = winat(y, x); reg struct linked_list *it; @@ -330,9 +331,8 @@ * be_trapped: * Hero or monster stepped on a trap. */ -be_trapped(tc, th) -struct thing *th; -struct coord *tc; +int +be_trapped(struct coord *tc, struct thing *th) { reg struct trap *trp; reg int ch, ishero; @@ -340,7 +340,7 @@ char stuckee[35], seeit, sayso; if ((trp = trap_at(tc->y, tc->x)) == NULL) - return; + return 0; ishero = (th == &player); if (ishero) { strcpy(stuckee, "You"); @@ -491,7 +491,7 @@ if ((trp->tr_flags & ISGONE) && rnd(100) < 10) { nlmove = TRUE; if (rnd(100) < 15) - teleport(rndspot); /* teleport away */ + teleport(rndspot, th); /* teleport away */ else if(rnd(100) < 15 && level > 2) { level -= rnd(2) + 1; new_level(NORMLEV); @@ -519,7 +519,8 @@ * dip_it: * Dip an object into a magic pool */ -dip_it() +void +dip_it(void) { reg struct linked_list *what; reg struct object *ob; @@ -654,8 +655,7 @@ * Find the trap at (y,x) on screen. */ struct trap * -trap_at(y, x) -int y, x; +trap_at(int y, int x) { reg struct trap *tp, *ep; @@ -673,8 +673,7 @@ * move in a random direction if the monster/person is confused */ struct coord * -rndmove(who) -struct thing *who; +rndmove(struct thing *who) { reg int x, y, ex, ey, ch; int nopen = 0; @@ -720,8 +719,8 @@ * isatrap: * Returns TRUE if this character is some kind of trap */ -isatrap(ch) -char ch; +bool +isatrap(char ch) { switch(ch) { case POST: diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/new_leve.c --- a/srogue/new_leve.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/new_leve.c Sun Jan 31 13:45:07 2016 -0500 @@ -17,14 +17,16 @@ #include "rogue.h" #include "rogue.ext" +void put_things(void); + /* * new_level: * Dig and draw a new level */ -new_level(ltype) -int ltype; +void +new_level(int ltype) { - register i; + register int i; register char ch; struct coord traploc; struct room *rp; @@ -145,9 +147,10 @@ * rnd_room: * Pick a room that is really there */ -rnd_room() +int +rnd_room(void) { - register rm; + register int rm; if (levtype != NORMLEV) rm = 0; @@ -166,9 +169,10 @@ * put potions and scrolls on this level */ -put_things() +void +put_things(void) { - register i, cnt, rm; + register int i, cnt, rm; struct linked_list *item; struct object *cur; struct coord tp; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/options.c --- a/srogue/options.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/options.c Sun Jan 31 13:45:07 2016 -0500 @@ -30,7 +30,7 @@ typedef struct optstruct OPTION; -int put_str(), get_str(); +int allowchange(OPTION *opt); OPTION optlist[] = { { "name", "Name: ", whoami }, @@ -46,7 +46,8 @@ /* * print and then set options from the terminal */ -option() +void +option(void) { reg OPTION *op; reg int wh; @@ -106,9 +107,8 @@ * Set a string option */ #define CTRLB 2 -get_str(opt, awin) -char *opt; -WINDOW *awin; +int +get_str(char *opt, WINDOW *awin) { reg char *sp; reg int c, oy, ox; @@ -119,7 +119,7 @@ /* * loop reading in the string, and put it in a temporary buffer */ - for (sp = buf; (c=readchar(awin)) != '\n' && c != '\r' && c != ESCAPE; + for (sp = buf; (c=readchar()) != '\n' && c != '\r' && c != ESCAPE; wclrtoeol(awin), draw(awin)) { if (sp - buf >= 50) { *sp = '\0'; /* line was too long */ @@ -186,8 +186,8 @@ * or the end of the entire option string. */ -parse_opts(str) -char *str; +void +parse_opts(char *str) { reg char *sp; reg OPTION *op; @@ -231,9 +231,8 @@ /* * copy string using unctrl for things */ -strucpy(s1, s2, len) -char *s1, *s2; -int len; +void +strucpy(char *s1, char *s2, int len) { reg char *sp; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/pack.c --- a/srogue/pack.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/pack.c Sun Jan 31 13:45:07 2016 -0500 @@ -24,9 +24,8 @@ * is non-null use it as the linked_list pointer instead of * getting it off the ground. */ -add_pack(item, silent) -struct linked_list *item; -bool silent; +bool +add_pack(struct linked_list *item, bool silent) { reg struct linked_list *ip, *lp; reg struct object *obj, *op = NULL; @@ -191,9 +190,8 @@ * inventory: * Show what items are in a specific list */ -inventory(list, type) -struct linked_list *list; -int type; +bool +inventory(struct linked_list *list, int type) { reg struct linked_list *pc; reg struct object *obj; @@ -229,8 +227,8 @@ * pick_up: * Add something to characters pack. */ -pick_up(ch) -char ch; +void +pick_up(char ch) { nochange = FALSE; switch(ch) { @@ -254,7 +252,8 @@ * picky_inven: * Allow player to inventory a single item */ -picky_inven() +void +picky_inven(void) { reg struct linked_list *item; reg char ch, mch; @@ -288,9 +287,7 @@ * pick something out of a pack for a purpose */ struct linked_list * -get_item(purpose, type) -char *purpose; -int type; +get_item(char *purpose, int type) { reg struct linked_list *obj, *pit, *savepit = NULL; struct object *pob; @@ -408,8 +405,7 @@ * Get the character of a particular item in the pack */ char -pack_char(obj) -struct object *obj; +pack_char(struct object *obj) { reg struct linked_list *item; reg char c; @@ -427,7 +423,8 @@ * idenpack: * Identify all the items in the pack */ -idenpack() +void +idenpack(void) { reg struct linked_list *pc; @@ -440,8 +437,8 @@ * del_pack: * Take something out of the hero's pack */ -del_pack(what) -struct linked_list *what; +void +del_pack(struct linked_list *what) { reg struct object *op; @@ -461,8 +458,8 @@ * cur_null: * This updates cur_weapon etc for dropping things */ -cur_null(op) -struct object *op; +void +cur_null(struct object *op) { if (op == cur_weapon) cur_weapon = NULL; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/passages.c --- a/srogue/passages.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/passages.c Sun Jan 31 13:45:07 2016 -0500 @@ -14,15 +14,20 @@ * See the file LICENSE.TXT for full copyright and licensing information. */ +#include #include "rogue.h" #include "rogue.ext" +void conn(int r1, int r2); +void door(struct room *rm, struct coord *cp); + /* * do_passages: * Draw all the passages on a level. */ -do_passages() +void +do_passages(void) { reg struct rdes *r1, *r2 = NULL; reg int i, j; @@ -123,8 +128,8 @@ * Cconnect two rooms. */ -conn(r1, r2) -int r1, r2; +void +conn(int r1, int r2) { reg struct room *rpf, *rpt = NULL; reg char rmt, direc; @@ -255,9 +260,8 @@ * also enters the door in the exits array of the room. */ -door(rm, cp) -struct room *rm; -struct coord *cp; +void +door(struct room *rm, struct coord *cp) { cmov(*cp); addch(rnd(10) < level - 1 && rnd(100) < 20 ? SECRETDOOR : DOOR); @@ -269,7 +273,8 @@ * add_pass: * add the passages to the current window (wizard command) */ -add_pass() +void +add_pass(void) { reg int y, x, ch; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/potions.c --- a/srogue/potions.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/potions.c Sun Jan 31 13:45:07 2016 -0500 @@ -23,7 +23,8 @@ * quaff: * Let the hero drink a potion */ -quaff() +void +quaff(void) { reg struct object *obj; reg struct linked_list *item, *titem; @@ -189,7 +190,7 @@ p_know[P_XHEAL] = TRUE; if (!iswearing(R_SLOW)) notslow(FALSE); - unconfuse(); + unconfuse(FALSE); extinguish(unconfuse); sight(FALSE); } diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/pstats.c --- a/srogue/pstats.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/pstats.c Sun Jan 31 13:45:07 2016 -0500 @@ -13,15 +13,15 @@ #include "rogue.h" #include "rogue.ext" +void updabil(int what, int amt, struct real *pst, int how); +int hungdam(void); /* * chg_hpt: * Changes players hit points */ -chg_hpt(howmany, alsomax, what) -int howmany; -bool alsomax; -char what; +void +chg_hpt(int howmany, bool alsomax, char what) { nochange = FALSE; if(alsomax) @@ -38,8 +38,8 @@ * rchg_str: * Update the players real strength */ -rchg_str(amt) -int amt; +void +rchg_str(int amt) { chg_abil(STR,amt,TRUE); } @@ -48,8 +48,8 @@ * chg_abil: * Used to modify the hero's abilities */ -chg_abil(what,amt,how) -int amt, what, how; +void +chg_abil(int what, int amt, int how) { if (amt == 0) return; @@ -66,9 +66,8 @@ * updabil: * Do the actual abilities updating */ -updabil(what, amt, pst, how) -struct real *pst; -int what, amt, how; +void +updabil(int what, int amt, struct real *pst, int how) { register int *wh, *mx, *mr; struct real *mst, *msr; @@ -138,8 +137,8 @@ * add_haste: * add a haste to the player */ -add_haste(potion) -bool potion; +void +add_haste(bool potion) { if (pl_on(ISHASTE)) { msg("You faint from exhaustion."); @@ -160,9 +159,8 @@ * getpdex: * Gets players added dexterity for fighting */ -getpdex(who, heave) -struct stats *who; -bool heave; +int +getpdex(struct stats *who, bool heave) { reg int edex; @@ -217,8 +215,8 @@ * getpwis: * Get a players wisdom for fighting */ -getpwis(who) -struct stats *who; +int +getpwis(struct stats *who) { reg int ewis; @@ -249,8 +247,8 @@ * getpcon: * Get added hit points from players constitution */ -getpcon(who) -struct stats *who; +int +getpcon(struct stats *who) { reg int econ; @@ -282,8 +280,8 @@ * str_plus: * compute bonus/penalties for strength on the "to hit" roll */ -str_plus(who) -struct stats *who; +int +str_plus(struct stats *who) { reg int hitplus, str; @@ -315,8 +313,8 @@ * add_dam: * Compute additional damage done depending on strength */ -add_dam(who) -struct stats *who; +int +add_dam(struct stats *who) { reg int exdam, str; @@ -350,7 +348,8 @@ * hungdam: * Calculate damage depending on players hungry state */ -hungdam() +int +hungdam(void) { switch (hungry_state) { case F_OKAY: @@ -364,9 +363,8 @@ * heal_self: * Heal the hero. */ -heal_self(factor, updmaxhp) -int factor; -bool updmaxhp; +void +heal_self(int factor, bool updmaxhp) { him->s_hpt += roll(him->s_lvl + getpcon(him), factor); if (updmaxhp) diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/rings.c --- a/srogue/rings.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/rings.c Sun Jan 31 13:45:07 2016 -0500 @@ -19,11 +19,15 @@ #include "rogue.h" #include "rogue.ext" +int gethand(bool isrmv); +int ring_eat(void); + /* * ring_on: * Put on a ring */ -ring_on() +void +ring_on(void) { reg struct object *obj; reg struct linked_list *item; @@ -144,7 +148,8 @@ * ring_off: * Take off some ring */ -ring_off() +void +ring_off(void) { reg int ring; reg struct object *obj; @@ -178,8 +183,8 @@ * toss_ring: * Remove a ring and stop its effects */ -toss_ring(what) -struct object *what; +void +toss_ring(struct object *what) { bool okring; @@ -228,8 +233,8 @@ * gethand: * Get a hand to wear a ring */ -gethand(isrmv) -bool isrmv; +int +gethand(bool isrmv) { reg int c; char *ptr; @@ -280,7 +285,8 @@ * ring_eat: * How much food do the hero's rings use up? */ -ring_eat() +int +ring_eat(void) { reg struct object *lb; reg int hand, i, howmuch; @@ -335,8 +341,7 @@ * Print ring bonuses */ char * -ring_num(what) -struct object *what; +ring_num(struct object *what) { static char number[5]; @@ -355,8 +360,8 @@ * magring: * Returns TRUE if a ring has a number, i.e. +2 */ -magring(what) -struct object *what; +bool +magring(struct object *what) { switch(what->o_which) { case R_SPEED: @@ -379,7 +384,8 @@ * ringabil: * Compute effective abilities due to rings */ -ringabil() +void +ringabil(void) { reg struct object *rptr; reg int i; @@ -406,10 +412,10 @@ * init_ring: * Initialize a ring */ -init_ring(what,fromwiz) -struct object *what; -bool fromwiz; /* TRUE when from wizards */ +void +init_ring(struct object *what, bool fromwiz) { + /* fromwiz: TRUE when from wizards */ reg int much; switch (what->o_which) { @@ -459,8 +465,8 @@ * ringex: * Get extra gains from rings */ -ringex(rtype) -int rtype; +int +ringex(int rtype) { reg int howmuch = 0; @@ -475,8 +481,8 @@ * iswearing: * Returns TRUE when the hero is wearing a certain type of ring */ -iswearing(ring) -int ring; +bool +iswearing(int ring) { return (isring(LEFT,ring) || isring(RIGHT,ring)); } @@ -485,8 +491,8 @@ * isring: * Returns TRUE if a ring is on a hand */ -isring(hand,ring) -int hand, ring; +bool +isring(int hand, int ring) { if (cur_ring[hand] != NULL && cur_ring[hand]->o_which == ring) return TRUE; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/rip.c --- a/srogue/rip.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/rip.c Sun Jan 31 13:45:07 2016 -0500 @@ -50,8 +50,8 @@ extern int scorefd; extern FILE *logfile; -char *killname(); -void writelog(int amount, int aflag, char monst); +char *killname(unsigned char monst); +void showpack(bool winner, char *howso); /* * death: @@ -59,8 +59,8 @@ */ #include -death(monst) -char monst; +void +death(char monst) { reg char dp, *killer; struct tm *lt; @@ -119,9 +119,8 @@ * score: * Figure score and post it. */ -score(amount, aflag, monst) -char monst; -int amount, aflag; +void +score(int amount, int aflag, char monst) { reg struct sc_ent *scp, *sc2; reg int i, fd, prflags = 0; @@ -261,8 +260,8 @@ * showtop: * Display the top ten on the screen */ -showtop(showname) -int showname; +bool +showtop(int showname) { reg int fd, i; char *killer; @@ -310,7 +309,8 @@ * total_winner: * The hero made it back out alive */ -total_winner() +void +total_winner(void) { clear(); addstr(" \n"); @@ -345,9 +345,8 @@ * showpack: * Display the contents of the hero's pack */ -showpack(winner, howso) -bool winner; -char *howso; +void +showpack(bool winner, char *howso) { reg char *iname; reg int cnt, worth, ch; @@ -392,8 +391,7 @@ * Returns what the hero was killed by. */ char * -killname(monst) -unsigned char monst; +killname(unsigned char monst) { if (monst < MAXMONS + 1) return monsters[monst].m_name; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/rogue.ext --- a/srogue/rogue.ext Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/rogue.ext Sun Jan 31 13:45:07 2016 -0500 @@ -2,11 +2,10 @@ EXTWEP weaps[]; EXTARM armors[]; EXTMON monsters[], *mtlev[]; -EXTTRAP *trap_at(), traps[]; -EXTROOM *roomin(), *oldrp, rooms[]; -EXTCORD *rndmove(), *rnd_pos(), delta, stairs, oldpos, rndspot; -EXTLKL *mlist, *lvl_obj, *new_item(), *new_thing(), *new_monster(); -EXTLKL *find_mons(), *wake_monster(), *find_obj(), *get_item(); +EXTTRAP traps[]; +EXTROOM *oldrp, rooms[]; +EXTCORD delta, stairs, oldpos, rndspot; +EXTLKL *mlist, *lvl_obj; EXTOBJ *cur_armor, *cur_weapon, *cur_ring[]; EXTMAG r_magic[], s_magic[], ws_magic[], p_magic[]; EXTMAG things[], a_magic[], w_magic[]; @@ -14,20 +13,16 @@ EXTINT foodlev, total, count, demoncnt, fung_hit, ntraps; EXTINT lastscore, purse, mpos, seed, dnum, no_food, packvol, playuid; EXTINT curprice, trader, group, levcount, levtype, ringfood, playgid; -EXTINT chkstairs(), rollwand(), swander(), notslow(), notfight(), rnd(); -EXTINT rchg_str(), wghtchk(), stomach(), doctor(), runners(), status(), sight(); -extern void quit(), auto_save(), endit(), byebye(), game_err(); -EXTINT prntfile(), unconfuse(), sapem(); -EXTINT noteth(), notregen(), notinvinc(), unsee(), nohaste(), npch(); +EXTINT chkstairs(), notfight(); +EXTINT prntfile(); EXTBOOL running, nochange, after, inwhgt, isfight, firstmove, nlmove; EXTBOOL wizard, waswizard, in_shell, amulet, door_stop, playing, use_savedir; EXTBOOL notify, ws_know[], p_know[], s_know[], r_know[], inpool; EXTCHAR home[], file_name[], whoami[], fruit[], curpurch[], scorefile[]; EXTCHAR *r_stones[], *p_colors[], *s_names[], *ws_type[], *ws_made[]; EXTCHAR *ws_guess[], *s_guess[], *r_guess[], *p_guess[];/*, *unctrl();*/ -EXTCHAR morestr[], prbuf[], huh[], *identify(), *vowelstr(); -EXTCHAR *new(), *strcpy(), *strcat(), *inv_name(), pack_char(), *prname(); -EXTCHAR *num(), *getenv(), *tr_name(), *release, take, runch; +EXTCHAR morestr[], prbuf[], huh[]; +EXTCHAR *release, take, runch; EXTCHAR retstr[], wizstr[], spacemsg[], illegal[], callit[], starlist[]; EXTSTAT max_stats, *him; extern struct magic_info thnginfo[]; @@ -46,3 +41,207 @@ extern char *wood[NWOOD]; extern char *metal[NMETAL]; +void _attach(struct linked_list **list, struct linked_list *item); +void _detach(struct linked_list **list, struct linked_list *item); +void _free_list(struct linked_list **ptr); +void activity(void); +int add_dam(struct stats *who); +void add_haste(bool potion); +void add_mon(struct room *rm, bool treas); +bool add_pack(struct linked_list *item, bool silent); +void add_pass(void); +void addmsg(char *fmt, ...); +void aggravate(void); +int attack(struct thing *mp); +bool author(void); +void auto_save(int a); +int be_trapped(struct coord *tc, struct thing *th); +void buy_it(void); +void byebye(int how); +bool cansee(int y, int x); +char *charge_str(struct object *obj); +void check_level(void); +void chg_abil(int what, int amt, int how); +void chg_hpt(int howmany, bool alsomax, char what); +void command(void); +bool cordok(int y, int x); +void create_obj(bool fscr); +void cur_null(struct object *op); +void dbotline(WINDOW *scr, char *message); +bool dead_end(char ch); +void death(char monst); +void del_pack(struct linked_list *what); +bool diag_ok(struct coord *sp, struct coord *ep); +void dip_it(void); +void discard(struct linked_list *item); +void displevl(void); +void dispmax(void); +void dispmons(void); +void do_daemons(int flag); +void do_fuses(void); +void do_maze(void); +void do_motion(struct object *obj, int ydelta, int xdelta); +void do_move(int dy, int dx); +void do_passages(void); +void do_post(void); +void do_rooms(void); +void do_run(char ch); +void do_zap(bool gotdir); +void doctor(int fromfuse); +void draw_room(struct room *rp); +int drop(struct linked_list *item); +bool dropcheck(struct object *op); +void eat(void); +int encread(void *starta, unsigned int size, int inf); +void encwrite(void *starta, unsigned int size, FILE *outf); +void endit(int a); +void endmsg(void); +void extinguish(int (*func)()); +int extras(void); +void fall(struct linked_list *item, bool pr); +bool fallpos(struct coord *pos, struct coord *newpos, bool passages); +void fatal(char *s); +bool fight(struct coord *mp, struct object *weap, bool thrown); +struct linked_list *find_mons(int y, int x); +struct linked_list *find_obj(int y, int x); +void fix_stick(struct object *cur); +void fuse(int (*func)(), int arg, int time); +void game_err(int a); +void genocide(void); +bool get_dir(void); +struct linked_list *get_item(char *purpose, int type); +int get_str(char *opt, WINDOW *awin); +int get_worth(struct object *obj); +int getbless(void); +int getindex(char what); +int getpcon(struct stats *who); +int getpdex(struct stats *who, bool heave); +int getpwis(struct stats *who); +void heal_self(int factor, bool updmaxhp); +bool hit_monster(struct coord *mp, struct object *obj); +int hitweight(void); +bool hurt_armor(struct object *obj); +void idenpack(void); +char *identify(int what); +void ignore(void); +bool illeg_ch(unsigned char ch); +void init_everything(void); +void init_ring(struct object *what, bool fromwiz); +void init_weapon(struct object *weap, int type); +void initarmor(struct object *obj, int what); +void initfood(struct object *what); +char *inv_name(struct object *obj, bool drop); +bool inventory(struct linked_list *list, int type); +int itemvol(struct object *wh); +int itemweight(struct object *wh); +bool is_current(struct object *obj); +bool is_magic(struct object *obj); +bool isatrap(char ch); +bool isring(int hand, int ring); +bool iswearing(int ring); +void killed(struct linked_list *item, bool pr); +void lengthen(int (*func)(), int xtime); +void lev_mon(void); +void light(struct coord *cp); +void look(bool wakeup); +bool magring(struct object *what); +bool makemons(int what); +int midx(char whichmon); +void missile(int ydelta, int xdelta); +void money(void); +bool monhurt(struct thing *th); +void msg(char *fmt, ...); +char *new(int size); +struct linked_list *new_item(int size); +void new_level(int ltype); +struct linked_list *new_monster(char type, struct coord *cp, bool treas); +struct linked_list *new_thing(bool treas, int type, int which); +void nohaste(int fromfuse); +void noteth(int fromfuse); +void notinvinc(int fromfuse); +void notregen(int fromfuse); +void notslow(int fromfuse); +char npch(char ch); +char *num(int n1, int n2); +bool o_off(struct object *what, long bit); +bool o_on(struct object *what, long bit); +void option(void); +char pack_char(struct object *obj); +void parse_opts(char *str); +bool passwd(void); +int pick_one(struct magic_item *mag); +void pick_up(char ch); +void picky_inven(void); +bool pl_off(long what); +bool pl_on(long what); +void playit(void); +bool price_it(void); +void quaff(void); +void quit(int a); +void raise_level(void); +void rchg_str(int amt); +void read_scroll(void); +int readchar(void); +void remove_monster(struct coord *mp, struct linked_list *item); +void resoflg(struct object *what, long bit); +bool restore(char *file, char **envp); +void restscr(WINDOW *scr); +bool rf_on(struct room *rm, long bit); +char *ring_num(struct object *what); +void ring_off(void); +void ring_on(void); +void ringabil(void); +int ringex(int rtype); +int rnd(int range); +char rnd_mon(bool wander, bool baddie); +struct coord *rnd_pos(struct room *rp); +int rnd_room(void); +struct coord *rndmove(struct thing *who); +int roll(int number, int sides); +void rollwand(int fromfuse); +struct room *roomin(struct coord *cp); +int rs_restore_file(int inf); +int rs_save_file(FILE *savef); +void runners(void); +void runto(struct coord *runner, struct coord *spot); +void sapem(int fromfuse); +bool save(int which); +bool save_game(void); +bool save_throw(int which, struct thing *tp); +void score(int amount, int aflag, char monst); +void sell_it(void); +void setoflg(struct object *what, long bit); +void setup(void); +char show(int y, int x); +bool showtop(int showname); +void sight(int fromfuse); +void start_daemon(int (*func)(), int arg, int type); +void status(int fromfuse); +bool step_ok(unsigned char ch); +void stomach(int fromfuse); +int str_plus(struct stats *who); +void strucpy(char *s1, char *s2, int len); +void swander(int fromfuse); +bool swing(int at_lvl, int op_arm, int wplus); +void take_off(void); +int teleport(struct coord spot, struct thing *th); +void toss_ring(struct object *what); +void total_winner(void); +int totalenc(void); +char *tr_name(char ch); +struct trap *trap_at(int y, int x); +void unconfuse(int fromfuse); +void unhold(char whichmon); +void unsee(int fromfuse); +void updpack(void); +char *vowelstr(char *str); +void wait_for(WINDOW *win, char ch); +struct linked_list *wake_monster(int y, int x); +void wanderer(void); +void waste_time(void); +void wear(void); +void wghtchk(int fromfuse); +void whatis(struct linked_list *what); +void wield(void); +char winat(int y, int x); +void writelog(int amount, int aflag, char monst); diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/rooms.c --- a/srogue/rooms.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/rooms.c Sun Jan 31 13:45:07 2016 -0500 @@ -17,11 +17,15 @@ #include "rogue.h" #include "rogue.ext" +void horiz(int cnt); +void vert(int cnt); + /* * do_rooms: * Place the rooms in the dungeon */ -do_rooms() +void +do_rooms(void) { int mloops, mchance, nummons, left_out, roomtries; bool treas = FALSE; @@ -131,9 +135,8 @@ * add_mon: * Add a monster to a room */ -add_mon(rm, treas) -struct room *rm; -bool treas; +void +add_mon(struct room *rm, bool treas) { reg struct thing *tp; reg struct linked_list *item; @@ -165,8 +168,8 @@ * draw_room: * Draw a box around a room */ -draw_room(rp) -struct room *rp; +void +draw_room(struct room *rp) { reg int j, k; @@ -197,8 +200,8 @@ * horiz: * draw a horizontal line */ -horiz(cnt) -int cnt; +void +horiz(int cnt) { while (cnt-- > 0) addch('-'); @@ -209,8 +212,8 @@ * vert: * draw a vertical line */ -vert(cnt) -int cnt; +void +vert(int cnt) { reg int x, y; @@ -228,8 +231,7 @@ * pick a random spot in a room */ struct coord * -rnd_pos(rp) -struct room *rp; +rnd_pos(struct room *rp) { reg int y, x, i; static struct coord spot; @@ -249,9 +251,8 @@ * rf_on: * Returns TRUE if flag is set for room stuff */ -rf_on(rm, bit) -struct room *rm; -long bit; +bool +rf_on(struct room *rm, long bit) { return (rm->r_flags & bit); } diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/save.c --- a/srogue/save.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/save.c Sun Jan 31 13:45:07 2016 -0500 @@ -32,6 +32,9 @@ EXTCHAR version[]; EXTCHAR *ctime(); +bool dosave(void); +void save_file(FILE *savef); + typedef struct stat STAT; STAT sbuf; @@ -39,7 +42,8 @@ * ignore: * Ignore ALL signals possible */ -ignore() +void +ignore(void) { md_ignoreallsignals(); } @@ -48,7 +52,8 @@ * save_game: * Save the current game */ -save_game() +bool +save_game(void) { reg FILE *savef; reg int c; @@ -136,7 +141,8 @@ * dosave: * Save the game. UID/GID no longer get reset here. */ -dosave() +bool +dosave(void) { FILE *savef; @@ -157,8 +163,8 @@ * save_file: * Do the actual save of this game to a file */ -save_file(savef) -FILE *savef; +void +save_file(FILE *savef) { int slines = LINES; int scols = COLS; @@ -182,10 +188,10 @@ * restore: * Restore a saved game from a file */ -restore(file, envp) -char *file, **envp; +bool +restore(char *file, char **envp) { - register inf, pid; + register int inf, pid; int ret_status; #ifndef _AIX extern char **environ; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/scrolls.c --- a/srogue/scrolls.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/scrolls.c Sun Jan 31 13:45:07 2016 -0500 @@ -24,7 +24,8 @@ * read_scroll: * Let the hero read a scroll */ -read_scroll() +void +read_scroll(void) { reg struct object *obj; reg struct linked_list *item; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/state.c --- a/srogue/state.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/state.c Sun Jan 31 13:45:07 2016 -0500 @@ -70,6 +70,9 @@ #define READSTAT ((format_error == 0) && (read_error == 0)) #define WRITESTAT (write_error == 0) +int rs_read_int(int inf, int *i); +int rs_write_int(FILE *savef, int c); + int read_error = FALSE; int write_error = FALSE; int format_error = FALSE; @@ -82,10 +85,8 @@ /* * perform an encrypted write */ -encwrite(starta, size, outf) -register void *starta; -unsigned int size; -register FILE *outf; +void +encwrite(void *starta, unsigned int size, FILE *outf) { register char *ep; register char *start = starta; @@ -103,10 +104,8 @@ /* * perform an encrypted read */ -encread(starta, size, inf) -register void *starta; -unsigned int size; -register int inf; +int +encread(void *starta, unsigned int size, int inf) { register char *ep; register int read_size; @@ -1556,6 +1555,7 @@ } } +int rs_read_traps(int inf, struct trap *trap, int count) { int id = 0, value = 0, n = 0; @@ -1885,8 +1885,8 @@ return(READSTAT); } -rs_fix_monster_list(list) -struct linked_list *list; +void +rs_fix_monster_list(struct linked_list *list) { struct linked_list *item; @@ -1970,6 +1970,7 @@ return(WRITESTAT); } +int rs_read_object_reference(int inf, struct linked_list *list, struct object **item) { @@ -2225,6 +2226,7 @@ return(WRITESTAT); } +int rs_restore_file(int inf) { bool junk; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/sticks.c --- a/srogue/sticks.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/sticks.c Sun Jan 31 13:45:07 2016 -0500 @@ -16,15 +16,18 @@ */ #include +#include #include "rogue.h" #include "rogue.ext" +void drain(int ymin, int ymax, int xmin, int xmax); + /* * fix_stick: * Init a stick for the hero */ -fix_stick(cur) -struct object *cur; +void +fix_stick(struct object *cur) { struct rod *rd; @@ -62,8 +65,8 @@ * do_zap: * Zap a stick at something */ -do_zap(gotdir) -bool gotdir; +void +do_zap(bool gotdir) { reg struct linked_list *item; reg struct object *obj; @@ -537,8 +540,8 @@ * drain: * Do drain hit points from player stick */ -drain(ymin, ymax, xmin, xmax) -int ymin, ymax, xmin, xmax; +void +drain(int ymin, int ymax, int xmin, int xmax) { reg int i, j, cnt; reg struct thing *ick; @@ -580,8 +583,7 @@ * Return number of charges left in a stick */ char * -charge_str(obj) -struct object *obj; +charge_str(struct object *obj) { static char buf[20]; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/things.c --- a/srogue/things.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/things.c Sun Jan 31 13:45:07 2016 -0500 @@ -20,15 +20,14 @@ #include "rogue.h" #include "rogue.ext" +void basic_init(struct object *cur); /* * inv_name: * Return the name of something as it would appear in an inventory. */ char * -inv_name(obj, drop) -struct object *obj; -bool drop; +inv_name(struct object *obj, bool drop) { reg char *pb, *tn, *pl; reg int wh, knowit; @@ -183,7 +182,8 @@ * money: * Add to characters purse */ -money() +void +money(void) { reg struct room *rp; reg struct linked_list *item; @@ -215,8 +215,8 @@ * drop: * put something down */ -drop(item) -struct linked_list *item; +int +drop(struct linked_list *item) { reg char ch; reg struct linked_list *ll, *nll; @@ -281,8 +281,8 @@ * dropcheck: * Do special checks for dropping or unweilding|unwearing|unringing */ -dropcheck(op) -struct object *op; +bool +dropcheck(struct object *op) { if (op == NULL) return TRUE; @@ -320,9 +320,7 @@ * Return a new thing */ struct linked_list * -new_thing(treas, type, which) -int type, which; -bool treas; +new_thing(bool treas, int type, int which) { struct linked_list *item; struct magic_item *mi; @@ -404,8 +402,8 @@ * basic_init: * Set all params of an object to the basic values. */ -basic_init(cur) -struct object *cur; +void +basic_init(struct object *cur) { cur->o_ac = 11; cur->o_count = 1; @@ -423,7 +421,8 @@ * extras: * Return the number of extra items to be created */ -extras() +int +extras(void) { reg int i; @@ -441,8 +440,8 @@ * pick_one: * Pick an item out of a list of nitems possible magic items */ -pick_one(mag) -struct magic_item *mag; +int +pick_one(struct magic_item *mag) { reg struct magic_item *start; reg int i; diff -r b24545357d2e -r 94a0d9dd5ce1 srogue/trader.c --- a/srogue/trader.c Thu Jan 28 18:55:47 2016 -0500 +++ b/srogue/trader.c Sun Jan 31 13:45:07 2016 -0500 @@ -11,16 +11,25 @@ */ #include +#include #include "rogue.h" #include "rogue.ext" #define NOTPRICED -1 +bool open_market(void); +void trans_line(void); +void draw_maze(void); +int findcells(int y, int x); +void rmwall(int newy, int newx, int oldy, int oldx); +void crankout(void); + /* * do_post: * Put a trading post room and stuff on the screen */ -do_post() +void +do_post(void) { struct coord tp; reg int i; @@ -66,7 +75,8 @@ * price_it: * Price the object that the hero stands on */ -price_it() +bool +price_it(void) { static char *bargain[] = { "great bargain", @@ -100,7 +110,8 @@ * buy_it: * Buy the item on which the hero stands */ -buy_it() +void +buy_it(void) { reg int wh; @@ -151,7 +162,8 @@ * sell_it: * Sell an item to the trading post */ -sell_it() +void +sell_it(void) { reg struct linked_list *item; reg struct object *obj; @@ -199,7 +211,8 @@ * open_market: * Retruns TRUE when ok do to transacting */ -open_market()