diff arogue7/main.c @ 238:e1cd27c5464f

arogue7, xrogue: improve the handling of the arguments to fuses. fuse() now expects a pointer as the argument to a fuse function. If this is one of the functions that takes int, fuse() follows the pointer and stores that value in the f_list slot, in the integer field of the argument union. When the fuse goes off, do_fuses() recognizes the function and passes it the integer field instead of the pointer. This has the disadvantage of hard-coding the functions that require int in daemon.c, but since the int is copied into f_list, it no longer has to be in static or global memory, which simplifies several files.
author John "Elwin" Edwards
date Fri, 11 Mar 2016 17:40:00 -0500
parents f9ef86cf22b2
children 3d4252fa2ed3
line wrap: on
line diff
--- a/arogue7/main.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/main.c	Fri Mar 11 17:40:00 2016 -0500
@@ -393,18 +393,18 @@
      * Start up daemons and fuses
      */
     start_daemon(doctor, &player, AFTER);
-    fuse(swander, 0, WANDERTIME, AFTER);
+    fuse(swander, NULL, WANDERTIME, AFTER);
     if (player.t_ctype == C_MAGICIAN || player.t_ctype == C_RANGER)
-	    fuse(spell_recovery, 0, SPELLTIME, AFTER);
+	    fuse(spell_recovery, NULL, SPELLTIME, AFTER);
     if (player.t_ctype == C_DRUID || player.t_ctype == C_RANGER)
-	    fuse(chant_recovery, 0, SPELLTIME, AFTER);
+	    fuse(chant_recovery, NULL, SPELLTIME, AFTER);
     if (player.t_ctype == C_CLERIC || player.t_ctype == C_PALADIN)
-	    fuse(prayer_recovery, 0, SPELLTIME, AFTER);
-    start_daemon(stomach, 0, AFTER);
+	    fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
+    start_daemon(stomach, NULL, AFTER);
     if (player.t_ctype == C_THIEF	||
 	player.t_ctype == C_ASSASIN	||
 	player.t_ctype == C_MONK)
-	    start_daemon(trap_look, 0, AFTER);
+	    start_daemon(trap_look, NULL, AFTER);
 
     /* Does this character have any special knowledge? */
     switch (player.t_ctype) {