diff arogue7/misc.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 e52a8a7ad4c5
line wrap: on
line diff
--- a/arogue7/misc.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/misc.c	Fri Mar 11 17:40:00 2016 -0500
@@ -81,11 +81,11 @@
 	 * if he becomes a spell caster of some kind, give him a fuse
 	 */
 	if (newclass == C_MAGICIAN || newclass == C_RANGER)
-		fuse(spell_recovery, 0, SPELLTIME, AFTER);
+		fuse(spell_recovery, NULL, SPELLTIME, AFTER);
 	if (newclass == C_DRUID || newclass == C_RANGER)
-		fuse(chant_recovery, 0, SPELLTIME, AFTER);
+		fuse(chant_recovery, NULL, SPELLTIME, AFTER);
 	if ((newclass==C_CLERIC || newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
-		fuse(prayer_recovery, 0, SPELLTIME, AFTER);
+		fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
 	/*
 	 * if he's changing from a fighter then may have to change
 	 * his sword since only fighter can use two-handed
@@ -117,7 +117,7 @@
 	 * if he becomes a thief then add the trap_look() daemon
 	 */
 	if (newclass == C_THIEF || newclass == C_ASSASIN || newclass == C_MONK)
-	    start_daemon(trap_look, 0, AFTER);
+	    start_daemon(trap_look, NULL, AFTER);
 	char_type = player.t_ctype = newclass;
 	save = pstats.s_hpt;
 	max_stats.s_hpt = pstats.s_hpt = 0;
@@ -1025,7 +1025,7 @@
 	    msg("aaAAACHOOOooo. Cough. Cough. Sneeze. Sneeze.");
 	    if (!find_slot(dust_appear)) {
 		turn_on(player, ISINVIS);
-		fuse(dust_appear, 0, DUSTTIME, AFTER);
+		fuse(dust_appear, NULL, DUSTTIME, AFTER);
 		PLAYER = IPLAYER;
 		light(&hero);
 	    }
@@ -1054,7 +1054,7 @@
 		if (find_slot(unchoke))
 		    lengthen(unchoke, DUSTTIME);
 		else
-		    fuse(unchoke, 0, DUSTTIME, AFTER);
+		    fuse(unchoke, NULL, DUSTTIME, AFTER);
 		turn_on(player, ISHUH);
 		turn_on(player, ISBLIND);
 		light(&hero);