Daemons and fuses now return void.

Functions for starting and stopping daemons and fuses now expect the
type 'void (*func)()'.  Only a few functions in XRogue needed to be
modified to fit.  Determining the type of the argument is left for a
later date.

Building with GCC5 should now produce less than 200 lines of warnings
per game.
This commit is contained in:
John "Elwin" Edwards 2016-03-05 20:49:37 -05:00
parent 6dfde944f0
commit 0a354903e0
14 changed files with 91 additions and 96 deletions

View file

@ -70,7 +70,7 @@ f_slot(void)
* Find a particular slot in the table
*/
struct delayed_action *
find_slot(int (*func)())
find_slot(void (*func)())
{
reg int i;
reg struct delayed_action *dev;
@ -87,7 +87,7 @@ find_slot(int (*func)())
* Start a daemon, takes a function.
*/
void
start_daemon(int (*func)(), void *arg, int type)
start_daemon(void (*func)(), void *arg, int type)
{
reg struct delayed_action *dev;
@ -107,7 +107,7 @@ start_daemon(int (*func)(), void *arg, int type)
* Remove a daemon from the list
*/
void
kill_daemon(int (*func)())
kill_daemon(void (*func)())
{
reg struct delayed_action *dev;
reg int i;
@ -155,7 +155,7 @@ do_daemons(int flag)
* Start a fuse to go off in a certain number of turns
*/
void
fuse(int (*func)(), void *arg, int time, int type)
fuse(void (*func)(), void *arg, int time, int type)
{
reg struct delayed_action *wire;
@ -175,7 +175,7 @@ fuse(int (*func)(), void *arg, int time, int type)
* Increase the time until a fuse goes off
*/
void
lengthen(int (*func)(), int xtime)
lengthen(void (*func)(), int xtime)
{
reg struct delayed_action *wire;
@ -190,7 +190,7 @@ lengthen(int (*func)(), int xtime)
* Put out a fuse
*/
void
extinguish(int (*func)())
extinguish(void (*func)())
{
reg struct delayed_action *wire;

View file

@ -724,7 +724,7 @@
struct delayed_action {
int d_type;
int (*d_func)();
void (*d_func)();
void *d_arg;
int d_time;
};
@ -1013,17 +1013,17 @@ int encread(char *start, unsigned int size, int inf);
int encwrite(char *start, unsigned int size, FILE *outf);
void endit(int sig);
void endmsg(void);
void extinguish(int (*func)());
void extinguish(void (*func)());
void fall(struct linked_list *item, bool pr);
coord *fallpos(coord *pos, bool be_clear, int range);
void fatal(char *s);
bool fight(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);
struct delayed_action *find_slot(int (*func)());
struct delayed_action *find_slot(void (*func)());
void fix_stick(struct object *cur);
void fumble(void);
void fuse(int (*func)(), void *arg, int time, int type);
void fuse(void (*func)(), void *arg, int time, int type);
void genmonsters(int least, bool treas);
bool get_dir(void);
struct linked_list *get_item(struct linked_list *list, char *purpose, int type);
@ -1053,11 +1053,11 @@ bool is_current(struct object *obj);
bool is_magic(struct object *obj);
bool isatrap(char ch);
int itemweight(struct object *wh);
void kill_daemon(int (*func)());
void kill_daemon(void (*func)());
void killed(struct linked_list *item, bool pr, bool points);
void lake_check(coord *place);
void land(void);
void lengthen(int (*func)(), int xtime);
void lengthen(void (*func)(), int xtime);
void light(coord *cp);
bool lit_room(struct room *rp);
void look(bool wakeup, bool runend);
@ -1133,7 +1133,7 @@ bool shoot_ok(char ch);
char show(int y, int x);
void sight(void);
struct linked_list *spec_item(int type, int which, int hit, int damage);
void start_daemon(int (*func)(), void *arg, int type);
void start_daemon(void (*func)(), void *arg, int type);
void status(bool display);
void steal(void);
bool step_ok(int y, int x, int can_on_monst, struct thing *flgptr);

View file

@ -78,7 +78,7 @@ f_slot(void)
* Find a particular slot in the table
*/
struct delayed_action *
find_slot(int (*func)())
find_slot(void (*func)())
{
reg int i;
reg struct delayed_action *dev;
@ -95,7 +95,7 @@ find_slot(int (*func)())
* Start a daemon, takes a function.
*/
void
start_daemon(int (*func)(), int arg, int type)
start_daemon(void (*func)(), int arg, int type)
{
reg struct delayed_action *dev;
@ -115,7 +115,7 @@ start_daemon(int (*func)(), int arg, int type)
* Remove a daemon from the list
*/
void
kill_daemon(int (*func)())
kill_daemon(void (*func)())
{
reg struct delayed_action *dev;
reg int i;
@ -163,7 +163,7 @@ do_daemons(int flag)
* Start a fuse to go off in a certain number of turns
*/
void
fuse(int (*func)(), int arg, int time, int type)
fuse(void (*func)(), int arg, int time, int type)
{
reg struct delayed_action *wire;
@ -183,7 +183,7 @@ fuse(int (*func)(), int arg, int time, int type)
* Increase the time until a fuse goes off
*/
void
lengthen(int (*func)(), int xtime)
lengthen(void (*func)(), int xtime)
{
reg struct delayed_action *wire;
@ -198,7 +198,7 @@ lengthen(int (*func)(), int xtime)
* Put out a fuse
*/
void
extinguish(int (*func)())
extinguish(void (*func)())
{
reg struct delayed_action *wire;

View file

@ -1113,7 +1113,7 @@ struct quill {
struct delayed_action {
int d_type;
int (*d_func)();
void (*d_func)();
union {
int arg;
void *varg;
@ -1212,18 +1212,18 @@ int encread(char *start, unsigned int size, int inf);
int encwrite(char *start, unsigned int size, int outf);
void endmsg(void);
void explode(struct thing *tp);
void extinguish(int (*func)());
void extinguish(void (*func)());
void fall(struct linked_list *item, bool pr);
coord *fallpos(coord *pos, bool be_clear, int range);
void fatal(char *s);
bool fight(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);
struct delayed_action *find_slot(int (*func)());
struct delayed_action *find_slot(void (*func)());
int findmindex(char *name);
void fix_stick(struct object *cur);
void fumble(void);
void fuse(int (*func)(), int arg, int time, int type);
void fuse(void (*func)(), int arg, int time, int type);
void genmonsters(int least, bool treas);
coord get_coordinates(void);
bool get_dir(coord *direction);
@ -1256,11 +1256,11 @@ bool is_current(struct object *obj);
bool is_magic(struct object *obj);
bool isatrap(char ch);
int itemweight(struct object *wh);
void kill_daemon(int (*func)());
void kill_daemon(void (*func)());
void killed(struct linked_list *item, bool pr, bool points, bool treasure);
void lake_check(coord *place);
void land(void);
void lengthen(int (*func)(), int xtime);
void lengthen(void (*func)(), int xtime);
void light(coord *cp);
bool lit_room(struct room *rp);
void look(bool wakeup, bool runend);
@ -1357,7 +1357,7 @@ bool skirmish(struct thing *attacker, coord *mp, struct object *weap,
bool thrown);
struct linked_list *spec_item(int type, int which, int hit, int damage);
void spell_recovery(void);
void start_daemon(int (*func)(), int arg, int type);
void start_daemon(void (*func)(), int arg, int type);
void status(bool display);
void steal(void);
bool step_ok(int y, int x, int can_on_monst, struct thing *flgptr);

View file

@ -1504,7 +1504,7 @@ rs_write_daemons(FILE *savef, struct delayed_action *d_list, int count)
func = 15;
else if (d_list[i].d_func == unstink)
func = 16;
else if (d_list[i].d_func == (int (*)()) res_strength)
else if (d_list[i].d_func == res_strength)
func = 17;
else if (d_list[i].d_func == undance)
func = 18;
@ -1644,7 +1644,7 @@ rs_read_daemons(int inf, struct delayed_action *d_list, int count)
break;
case 16: d_list[i].d_func = unstink;
break;
case 17: d_list[i].d_func = (int (*)()) res_strength;
case 17: d_list[i].d_func = res_strength;
break;
case 18: d_list[i].d_func = undance;
break;

View file

@ -48,7 +48,7 @@ d_slot(void)
* Find a particular slot in the table
*/
struct delayed_action *
find_slot(int (*func)())
find_slot(void (*func)())
{
register int i;
register struct delayed_action *dev;
@ -64,7 +64,7 @@ find_slot(int (*func)())
* Start a daemon, takes a function.
*/
void
start_daemon(int (*func)(), int arg, int type)
start_daemon(void (*func)(), int arg, int type)
{
register struct delayed_action *dev;
@ -80,7 +80,7 @@ start_daemon(int (*func)(), int arg, int type)
* Remove a daemon from the list
*/
void
kill_daemon(int (*func)())
kill_daemon(void (*func)())
{
register struct delayed_action *dev;
@ -118,7 +118,7 @@ do_daemons(int flag)
* Start a fuse to go off in a certain number of turns
*/
void
fuse(int (*func)(), int arg, int time, int type)
fuse(void (*func)(), int arg, int time, int type)
{
register struct delayed_action *wire;
@ -134,7 +134,7 @@ fuse(int (*func)(), int arg, int time, int type)
* Increase the time until a fuse goes off
*/
void
lengthen(int (*func)(), int xtime)
lengthen(void (*func)(), int xtime)
{
register struct delayed_action *wire;
@ -148,7 +148,7 @@ lengthen(int (*func)(), int xtime)
* Put out a fuse
*/
void
extinguish(int (*func)())
extinguish(void (*func)())
{
register struct delayed_action *wire;

View file

@ -324,7 +324,7 @@ typedef struct {
struct delayed_action {
int d_type;
int (*d_func)();
void (*d_func)();
int d_arg;
int d_time;
};
@ -517,7 +517,7 @@ int encread(void *starta, int size, int inf);
void encwrite(void *starta, int size, FILE *outf);
void endmsg(void);
void enter_room(coord *cp);
void extinguish(int (*func)());
void extinguish(void (*func)());
void fall(THING *obj, bool pr);
bool fallpos(coord *pos, coord *newpos, bool pass);
void fatal(char *s);
@ -526,7 +526,7 @@ THING *find_obj(int y, int x);
void fire_bolt(coord *start, coord *dir, char *name);
void fix_stick(THING *cur);
void flush_type(void);
void fuse(int (*func)(), int arg, int time, int type);
void fuse(void (*func)(), int arg, int time, int type);
void genocide(void);
bool get_dir(void);
THING *get_item(char *purpose, int type);
@ -547,11 +547,11 @@ void invis_on(void);
bool is_current(THING *obj);
bool is_magic(THING *obj);
bool issymlink(char *sp);
void kill_daemon(int (*func)());
void kill_daemon(void (*func)());
void killed(THING *tp, bool pr);
void leave(int sig);
void leave_room(coord *cp);
void lengthen(int (*func)(), int xtime);
void lengthen(void (*func)(), int xtime);
bool lock_sc(void);
void look(bool wakeup);
void missile(int ydelta, int xdelta);
@ -601,7 +601,7 @@ void shell(void);
void show_win(WINDOW *scr, char *message);
void sight(void);
int sign(int nm);
void start_daemon(int (*func)(), int arg, int type);
void start_daemon(void (*func)(), int arg, int type);
void start_score(void);
void status(void);
bool step_ok(char ch);

View file

@ -34,7 +34,7 @@ struct delayed_action d_list[MAXDAEMONS] = {
* Insert a function in the daemon list.
*/
struct delayed_action *
d_insert(int (*func)(), int arg, int type, int time)
d_insert(void (*func)(), int arg, int type, int time)
{
reg struct delayed_action *dev;
@ -72,7 +72,7 @@ d_delete(struct delayed_action *wire)
* Find a particular slot in the table
*/
struct delayed_action *
find_slot(int (*func)())
find_slot(void (*func)())
{
reg struct delayed_action *dev;
@ -87,7 +87,7 @@ find_slot(int (*func)())
* Start a daemon, takes a function.
*/
void
start_daemon(int (*func)(), int arg, int type)
start_daemon(void (*func)(), int arg, int type)
{
d_insert(func, arg, type, DAEMON);
}
@ -112,7 +112,7 @@ do_daemons(int flag)
* Start a fuse to go off in a certain number of turns
*/
void
fuse(int (*func)(), int arg, int time)
fuse(void (*func)(), int arg, int time)
{
d_insert(func, arg, AFTER, time);
}
@ -122,7 +122,7 @@ fuse(int (*func)(), int arg, int time)
* Increase the time until a fuse goes off
*/
void
lengthen(int (*func)(), int xtime)
lengthen(void (*func)(), int xtime)
{
reg struct delayed_action *wire;
@ -136,7 +136,7 @@ lengthen(int (*func)(), int xtime)
* Put out a fuse. Find all such fuses and kill them.
*/
void
extinguish(int (*func)())
extinguish(void (*func)())
{
reg struct delayed_action *dev;

View file

@ -96,7 +96,7 @@ 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)());
void extinguish(void (*func)());
int extras(void);
void fall(struct linked_list *item, bool pr);
bool fallpos(struct coord *pos, struct coord *newpos, bool passages);
@ -105,7 +105,7 @@ 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 fuse(void (*func)(), int arg, int time);
void game_err(int a);
void genocide(void);
bool get_dir(void);
@ -140,7 +140,7 @@ 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 lengthen(void (*func)(), int xtime);
void lev_mon(void);
void light(struct coord *cp);
void look(bool wakeup);
@ -215,7 +215,7 @@ 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 start_daemon(void (*func)(), int arg, int type);
void status(int fromfuse);
bool step_ok(unsigned char ch);
void stomach(int fromfuse);

View file

@ -531,7 +531,7 @@ char *xcrypt(const char *key, const char *setting);
struct delayed_action {
int d_type;
int (*d_func)();
void (*d_func)();
int d_arg;
int d_time;
};

View file

@ -74,7 +74,7 @@ f_slot(void)
*/
struct delayed_action *
find_slot(int (*func)())
find_slot(void (*func)())
{
reg int i;
reg struct delayed_action *dev;
@ -91,7 +91,7 @@ find_slot(int (*func)())
*/
void
start_daemon(int (*dfunc)(), VOID *arg, int type)
start_daemon(void (*dfunc)(), VOID *arg, int type)
{
reg struct delayed_action *dev;
@ -111,7 +111,7 @@ start_daemon(int (*dfunc)(), VOID *arg, int type)
*/
void
kill_daemon(int (*dfunc)())
kill_daemon(void (*dfunc)())
{
reg struct delayed_action *dev;
reg int i;
@ -164,7 +164,7 @@ do_daemons(int flag)
*/
void
fuse(int (*dfunc)(), VOID *arg, int time, int type)
fuse(void (*dfunc)(), VOID *arg, int time, int type)
{
reg struct delayed_action *wire;
@ -184,7 +184,7 @@ fuse(int (*dfunc)(), VOID *arg, int time, int type)
*/
void
lengthen(int (*dfunc)(), int xtime)
lengthen(void (*dfunc)(), int xtime)
{
reg struct delayed_action *wire;
@ -199,7 +199,7 @@ lengthen(int (*dfunc)(), int xtime)
*/
void
extinguish(int (*dfunc)())
extinguish(void (*dfunc)())
{
reg struct delayed_action *wire;

View file

@ -222,13 +222,12 @@ unphase(void)
* Player can no longer fly
*/
int
void
land(void)
{
turn_off(player, ISFLY);
msg("You regain your normal weight");
running = FALSE;
return(0);
}
/*
@ -253,7 +252,7 @@ sight(void)
* Restore player's strength
*/
int
void
res_strength(long howmuch)
{
@ -271,7 +270,6 @@ res_strength(long howmuch)
min(pstats.s_str + howmuch, max_stats.s_str + ring_value(R_ADDSTR));
updpack(TRUE, &player);
return(0);
}
/*
@ -507,12 +505,11 @@ alchemy(struct object *obj)
* otto's irresistable dance wears off
*/
int
void
undance(void)
{
turn_off(player, ISDANCE);
msg ("Your feet take a break.....whew!");
return(0);
}
/*
@ -637,12 +634,11 @@ unskill(void)
* charge up the cloak of Emori
*/
int
void
cloak_charge(struct object *obj)
{
if (obj->o_charges < 1)
obj->o_charges = 1;
return(0);
}
/*

View file

@ -27,11 +27,11 @@ int add_intelligence(int change);
int add_strength(int change);
int add_wisdom(int change);
int res_charisma(int howmuch);
int res_constitution(int howmuch);
int res_dexterity(int howmuch);
int res_intelligence(int howmuch);
int res_wisdom(int howmuch);
void res_charisma(int howmuch);
void res_constitution(int howmuch);
void res_dexterity(int howmuch);
void res_intelligence(int howmuch);
void res_wisdom(int howmuch);
/*
* add_abil is an array of functions used to change attributes. It must be
@ -48,7 +48,7 @@ int (*add_abil[NUMABILITIES])() = {
* ordered according to the attribute definitions in rogue.h.
*/
int (*res_abil[NUMABILITIES])() = {
void (*res_abil[NUMABILITIES])() = {
res_intelligence, res_strength, res_wisdom, res_dexterity,
res_constitution, res_charisma
};
@ -945,13 +945,13 @@ quaff(int which, int kind, int flags, bool is_potion)
* if called with zero the restore fully
*/
int
void
res_dexterity(int howmuch)
{
short save_max;
int ring_str;
if (howmuch < 0) return(0);
if (howmuch < 0) return;
/* Discount the ring value */
ring_str = ring_value(R_ADDHIT);
@ -970,7 +970,7 @@ res_dexterity(int howmuch)
pstats.s_dext += ring_str;
max_stats.s_dext = save_max;
}
return(0);
return;
}
/*
@ -978,13 +978,13 @@ res_dexterity(int howmuch)
* Restore player's intelligence
*/
int
void
res_intelligence(int howmuch)
{
short save_max;
int ring_str;
if (howmuch <= 0) return(0);
if (howmuch <= 0) return;
/* Discount the ring value */
ring_str = ring_value(R_ADDINTEL);
@ -998,7 +998,7 @@ res_intelligence(int howmuch)
pstats.s_intel += ring_str;
max_stats.s_intel = save_max;
}
return(0);
return;
}
/*
@ -1006,13 +1006,13 @@ res_intelligence(int howmuch)
* Restore player's wisdom
*/
int
void
res_wisdom(int howmuch)
{
short save_max;
int ring_str;
if (howmuch <= 0) return(0);
if (howmuch <= 0) return;
/* Discount the ring value */
ring_str = ring_value(R_ADDWISDOM);
@ -1026,7 +1026,7 @@ res_wisdom(int howmuch)
pstats.s_wisdom += ring_str;
max_stats.s_wisdom = save_max;
}
return(0);
return;
}
/*
@ -1034,13 +1034,13 @@ res_wisdom(int howmuch)
* Restore the players constitution.
*/
int
void
res_constitution(int howmuch)
{
if (howmuch > 0)
pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const);
return(0);
return;
}
/*
@ -1048,12 +1048,12 @@ res_constitution(int howmuch)
* Restore the players charisma.
*/
int
void
res_charisma(int howmuch)
{
if (howmuch > 0)
pstats.s_charisma =
min(pstats.s_charisma + howmuch, max_stats.s_charisma);
return(0);
return;
}

View file

@ -933,7 +933,7 @@
struct delayed_action {
int d_type;
int (*d_func)();
void (*d_func)();
union {
VOID *vp;
int i;
@ -1258,7 +1258,7 @@ long check_level(void);
void check_residue(struct thing *tp);
void chg_str(int amt);
void choose_qst(void);
int cloak_charge(struct object *obj);
void cloak_charge(struct object *obj);
void command(void);
void confus_player(void);
int const_bonus(void);
@ -1310,19 +1310,19 @@ void endit(int sig);
void endmsg(void);
void exit_game(int flag);
void explode(struct thing *tp);
void extinguish(int (*dfunc)());
void extinguish(void (*dfunc)());
void fall(struct linked_list *item, bool pr);
coord *fallpos(coord *pos, bool be_clear, int range);
void fatal(char *s);
bool fight(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);
struct delayed_action *find_slot(int (*func)());
struct delayed_action *find_slot(void (*func)());
int findmindex(char *name);
void fix_stick(struct object *cur);
void fright(struct thing *th);
void fumble(void);
void fuse(int (*dfunc)(), VOID *arg, int time, int type);
void fuse(void (*dfunc)(), VOID *arg, int time, int type);
void genmonsters(int least, bool treas);
coord get_coordinates(void);
bool get_dir(coord *direction);
@ -1359,10 +1359,10 @@ bool is_current(struct object *obj);
bool is_magic(struct object *obj);
bool isatrap(char ch);
int itemweight(struct object *wh);
void kill_daemon(int (*dfunc)());
void kill_daemon(void (*dfunc)());
void killed(struct linked_list *item, bool pr, bool points, bool treasure);
int land(void);
void lengthen(int (*dfunc)(), int xtime);
void land(void);
void lengthen(void (*dfunc)(), int xtime);
void light(coord *cp);
bool lit_room(struct room *rp);
void look(bool wakeup, bool runend);
@ -1415,7 +1415,7 @@ void raise_level(void);
short randmonster(bool wander, bool no_unique);
void read_scroll(int which, int flag, bool is_scroll);
void reap(void);
int res_strength(long howmuch);
void res_strength(long howmuch);
bool restore(char *file, char *envp[]);
void restscr(WINDOW *scr);
int ring_eat(int hand);
@ -1452,7 +1452,7 @@ bool skirmish(struct thing *attacker, coord *mp, struct object *weap,
bool thrown);
struct linked_list *spec_item(int type, int which, int hit, int damage);
void spell_recovery(void);
void start_daemon(int (*dfunc)(), VOID *arg, int type);
void start_daemon(void (*dfunc)(), VOID *arg, int type);
void status(bool display);
void steal(void);
bool step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
@ -1475,7 +1475,7 @@ void trap_look(void);
void unchoke(void);
void unclrhead(void);
void unconfuse(void);
int undance(void);
void undance(void);
void unphase(void);
void unsee(void);
void unskill(void);
@ -1648,7 +1648,6 @@ extern FILE *scorefi;
extern FILE *logfile;
extern LEVTYPE levtype;
extern int (*add_abil[NUMABILITIES])(int); /* Functions to change abilities */
extern int (*res_abil[NUMABILITIES])(); /* Functions to change abilities */
extern int mf_count; /* move_free counter - see actions.c(m_act()) */
extern int mf_jmpcnt; /* move_free counter for # of jumps */
extern int killed_chance; /* cumulative chance for goodies to loose it, fight.c */