diff arogue7/daemon.c @ 239:837044d2c362

Merge the GCC5 and build fix branches. This fixes all warnings produced by GCC 5, except the ones related to system functions. Those could be fixed by including the proper headers, but it would be better to replace the system-dependent code with functions from mdport.c.
author John "Elwin" Edwards
date Fri, 11 Mar 2016 19:47:52 -0500
parents e1cd27c5464f
children
line wrap: on
line diff
--- a/arogue7/daemon.c	Tue Mar 08 19:45:41 2016 -0500
+++ b/arogue7/daemon.c	Fri Mar 11 19:47:52 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)(), void *arg, int type)
 {
 	reg struct delayed_action *dev;
 
@@ -103,7 +103,7 @@
 	if (dev != NULL) {
 		dev->d_type = type;
 		dev->d_func = func;
-		dev->d_.arg = arg;
+		dev->d_.varg = arg;
 		dev->d_time = DAEMON;
 		demoncnt += 1;			/* update count */
 	}
@@ -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;
@@ -154,7 +154,7 @@
 	 * Executing each one, giving it the proper arguments
 	 */
 		if (dev->d_type == flag && dev->d_time == DAEMON)
-			(*dev->d_func)(dev->d_.arg);
+			(*dev->d_func)(dev->d_.varg);
 }
 
 
@@ -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)(), void *arg, int time, int type)
 {
 	reg struct delayed_action *wire;
 
@@ -171,7 +171,10 @@
 	if (wire != NULL) {
 		wire->d_type = type;
 		wire->d_func = func;
-		wire->d_.arg = arg;
+		if (func == changeclass || func == res_strength)
+			wire->d_.arg = *(int *) arg;
+		else
+			wire->d_.varg = arg;
 		wire->d_time = time;
 		fusecnt += 1;			/* update count */
 	}
@@ -183,7 +186,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 +201,7 @@
  *	Put out a fuse
  */
 void
-extinguish(int (*func)())
+extinguish(void (*func)())
 {
 	reg struct delayed_action *wire;
 
@@ -232,8 +235,10 @@
 	    if(flag == wire->d_type && wire->d_time > 0	&&
 	      --wire->d_time == 0) {
 		wire->d_type = EMPTY;
-		if (wire->d_func != NULL)
+		if (wire->d_func == changeclass || wire->d_func == res_strength)
 		    (*wire->d_func)(wire->d_.arg);
+		else if (wire->d_func != NULL)
+		    (*wire->d_func)(wire->d_.varg);
 		fusecnt -= 1;
 	    }
 	}