changeset 228:b67b99f6c92b

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.
author John "Elwin" Edwards
date Sat, 05 Mar 2016 20:49:37 -0500
parents 696277507a2e
children 50b89f165a34
files arogue5/daemon.c arogue5/rogue.h arogue7/daemon.c arogue7/rogue.h arogue7/state.c rogue4/daemon.c rogue4/rogue.h srogue/daemon.c srogue/rogue.ext srogue/rogue.h xrogue/daemon.c xrogue/daemons.c xrogue/potions.c xrogue/rogue.h
diffstat 14 files changed, 91 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/arogue5/daemon.c	Sat Mar 05 12:10:20 2016 -0500
+++ b/arogue5/daemon.c	Sat Mar 05 20:49:37 2016 -0500
@@ -70,7 +70,7 @@
  *	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 @@
  *	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 @@
  *	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 @@
  *	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 @@
  *	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 @@
  *	Put out a fuse
  */
 void
-extinguish(int (*func)())
+extinguish(void (*func)())
 {
 	reg struct delayed_action *wire;
 
--- a/arogue5/rogue.h	Sat Mar 05 12:10:20 2016 -0500
+++ b/arogue5/rogue.h	Sat Mar 05 20:49:37 2016 -0500
@@ -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     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_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 @@
 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);
--- a/arogue7/daemon.c	Sat Mar 05 12:10:20 2016 -0500
+++ b/arogue7/daemon.c	Sat Mar 05 20:49:37 2016 -0500
@@ -78,7 +78,7 @@
  *	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 @@
  *	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 @@
  *	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 @@
  *	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 @@
  *	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 @@
  *	Put out a fuse
  */
 void
-extinguish(int (*func)())
+extinguish(void (*func)())
 {
 	reg struct delayed_action *wire;
 
--- a/arogue7/rogue.h	Sat Mar 05 12:10:20 2016 -0500
+++ b/arogue7/rogue.h	Sat Mar 05 20:49:37 2016 -0500
@@ -1113,7 +1113,7 @@
 
 struct delayed_action {
 	int d_type;
-	int (*d_func)();
+	void (*d_func)();
 	union {
 	    int arg;
 	    void *varg;
@@ -1212,18 +1212,18 @@
 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_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 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);
--- a/arogue7/state.c	Sat Mar 05 12:10:20 2016 -0500
+++ b/arogue7/state.c	Sat Mar 05 20:49:37 2016 -0500
@@ -1504,7 +1504,7 @@
             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 @@
                      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;
--- a/rogue4/daemon.c	Sat Mar 05 12:10:20 2016 -0500
+++ b/rogue4/daemon.c	Sat Mar 05 20:49:37 2016 -0500
@@ -48,7 +48,7 @@
  *	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 @@
  *	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 @@
  *	Remove a daemon from the list
  */
 void
-kill_daemon(int (*func)())
+kill_daemon(void (*func)())
 {
     register struct delayed_action *dev;
 
@@ -118,7 +118,7 @@
  *	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 @@
  *	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 @@
  *	Put out a fuse
  */
 void
-extinguish(int (*func)())
+extinguish(void (*func)())
 {
     register struct delayed_action *wire;
 
--- a/rogue4/rogue.h	Sat Mar 05 12:10:20 2016 -0500
+++ b/rogue4/rogue.h	Sat Mar 05 20:49:37 2016 -0500
@@ -324,7 +324,7 @@
 
 struct delayed_action {
     int d_type;
-    int (*d_func)();
+    void (*d_func)();
     int d_arg;
     int d_time;
 };
@@ -517,7 +517,7 @@
 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 @@
 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);