changeset 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 2236ef808bcb
children 837044d2c362
files arogue7/daemon.c arogue7/daemons.c arogue7/effects.c arogue7/encumb.c arogue7/fight.c arogue7/main.c arogue7/misc.c arogue7/monsters.c arogue7/pack.c arogue7/potions.c arogue7/rings.c arogue7/rogue.h arogue7/sticks.c arogue7/util.c arogue7/wear.c xrogue/daemon.c xrogue/effects.c xrogue/fight.c xrogue/misc.c xrogue/pack.c xrogue/rogue.h
diffstat 21 files changed, 147 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/arogue7/daemon.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/daemon.c	Fri Mar 11 17:40:00 2016 -0500
@@ -95,7 +95,7 @@
  *	Start a daemon, takes a function.
  */
 void
-start_daemon(void (*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 */
 	}
@@ -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(void (*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 */
 	}
@@ -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;
 	    }
 	}
--- a/arogue7/daemons.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/daemons.c	Fri Mar 11 17:40:00 2016 -0500
@@ -111,7 +111,7 @@
 void
 swander(void)
 {
-    start_daemon(rollwand, 0, BEFORE);
+    start_daemon(rollwand, NULL, BEFORE);
 }
 
 /*
@@ -134,7 +134,7 @@
 	    if (levtype != POSTLEV)
 	        wanderer();
 	    kill_daemon(rollwand);
-	    fuse(swander, 0, WANDERTIME, BEFORE);
+	    fuse(swander, NULL, WANDERTIME, BEFORE);
 	}
 	between = 0;
     }
@@ -663,7 +663,7 @@
     time = SPELLTIME - max(17-pstats.s_intel, 0);
     time = max(time, 5);
     if (spell_power > 0) spell_power--;
-    fuse(spell_recovery, 0, time, AFTER);
+    fuse(spell_recovery, NULL, time, AFTER);
 }
 /*
  * give the hero back some prayer points
@@ -676,7 +676,7 @@
     time = SPELLTIME - max(17-pstats.s_wisdom, 0);
     time = max(time, 5);
     if (pray_time > 0) pray_time--;
-    fuse(prayer_recovery, 0, time, AFTER);
+    fuse(prayer_recovery, NULL, time, AFTER);
 }
 /*
  * give the hero back some chant points
@@ -689,5 +689,5 @@
     time = SPELLTIME - max(17-pstats.s_wisdom, 0);
     time = max(time, 5);
     if (chant_time > 0) chant_time--;
-    fuse(chant_recovery, 0, time, AFTER);
+    fuse(chant_recovery, NULL, time, AFTER);
 }
--- a/arogue7/effects.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/effects.c	Fri Mar 11 17:40:00 2016 -0500
@@ -294,7 +294,7 @@
 		    if (on(player, HASSTINK)) lengthen(unstink, STINKTIME);
 		    else {
 			turn_on(player, HASSTINK);
-			fuse(unstink, 0, STINKTIME, AFTER);
+			fuse(unstink, NULL, STINKTIME, AFTER);
 		    }
 		}
 	    }
@@ -308,8 +308,10 @@
 		    msg("You cringe at %s's chilling touch.",
 				prname(attname, FALSE));
 		    chg_str(-1);
-		    if (lost_str++ == 0)
-			fuse(res_strength, 0, CHILLTIME, AFTER);
+		    if (lost_str++ == 0) {
+			int fuse_arg = 0;
+			fuse(res_strength, &fuse_arg, CHILLTIME, AFTER);
+		    }
 		    else lengthen(res_strength, CHILLTIME);
 		}
 	    }
@@ -344,7 +346,7 @@
 		    }
 		    else {
 			turn_on(*def, HASDISEASE);
-			fuse(cure_disease, 0, roll(HEALTIME,SICKTIME), AFTER);
+			fuse(cure_disease, NULL, roll(HEALTIME,SICKTIME), AFTER);
 			msg(terse ? "You have been diseased."
 			    : "You have contracted a disease!");
 		    }
@@ -478,7 +480,7 @@
 		    turn_off(*att, CANDANCE);
 		    turn_on(*def, ISDANCE);
 		    msg("You begin to dance uncontrollably!");
-		    fuse(undance, 0, roll(2,4), AFTER);
+		    fuse(undance, NULL, roll(2,4), AFTER);
 	    }
 
 	    /*
@@ -491,7 +493,7 @@
 		(find_slot(suffocate) == 0)) {
 		turn_on(*att, DIDSUFFOCATE);
 		msg("%s is beginning to suffocate you.", prname(attname, TRUE));
-		fuse(suffocate, 0, roll(9,3), AFTER);
+		fuse(suffocate, NULL, roll(9,3), AFTER);
 	    }
 
 	    /*
@@ -530,11 +532,11 @@
 		    msg("You smell an unpleasant odor.");
 		else {
 		    int odor_str = -(rnd(6)+1);
-
+		    int fuse_arg2 = 0;
 		    msg("You are overcome by a foul odor.");
 		    if (lost_str == 0) {
 			chg_str(odor_str);
-			fuse(res_strength, 0, SMELLTIME, AFTER);
+			fuse(res_strength, &fuse_arg2, SMELLTIME, AFTER);
 			lost_str -= odor_str;
 		    }
 		    else lengthen(res_strength, SMELLTIME);
--- a/arogue7/encumb.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/encumb.c	Fri Mar 11 17:40:00 2016 -0500
@@ -174,7 +174,7 @@
 	    ch = CCHAR( mvwinch(stdscr, hero.y, hero.x) );
 	    if((ch != FLOOR && ch != PASSAGE)) {
 		extinguish(wghtchk);
-		fuse(wghtchk,TRUE,1,AFTER);
+		fuse(wghtchk, NULL, 1, AFTER);
 		inwhgt = FALSE;
 		return;
 	    }
--- a/arogue7/fight.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/fight.c	Fri Mar 11 17:40:00 2016 -0500
@@ -538,7 +538,7 @@
 			if (find_slot(unconfuse))
 			    lengthen(unconfuse, HUHDURATION);
 			else
-			    fuse(unconfuse, 0, HUHDURATION, AFTER);
+			    fuse(unconfuse, NULL, HUHDURATION, AFTER);
 			turn_on(player, ISHUH);
 		    }
 		    else msg("You feel dizzy, but it quickly passes.");
--- 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) {
--- 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);
--- a/arogue7/monsters.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/monsters.c	Fri Mar 11 17:40:00 2016 -0500
@@ -649,7 +649,7 @@
 		    if (find_slot(unconfuse))
 			lengthen(unconfuse, HUHDURATION);
 		    else {
-			fuse(unconfuse, 0, HUHDURATION, AFTER);
+			fuse(unconfuse, NULL, HUHDURATION, AFTER);
 			msg("%s's gaze has confused you.",prname(mname, TRUE));
 			turn_on(player, ISHUH);
 		    }
@@ -691,7 +691,7 @@
 	    if (!save(VS_WAND, &player, 0)) {
 		msg("The gaze of %s blinds you", prname(mname, FALSE));
 		turn_on(player, ISBLIND);
-		fuse(sight, 0, rnd(30)+20, AFTER);
+		fuse(sight, NULL, rnd(30)+20, AFTER);
 		light(&hero);
 	    }
 	}
--- a/arogue7/pack.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/pack.c	Fri Mar 11 17:40:00 2016 -0500
@@ -249,12 +249,13 @@
 
     /* Relics can do strange things when you pick them up */
     if (obj->o_type == RELIC) {
+	int newclass;
 	switch (obj->o_which) {
 	    /* the ankh of Heil gives you prayers */
 	    case HEIL_ANKH:
 		msg("The ankh welds itself into your hand.");
 		if (player.t_ctype != C_CLERIC && player.t_ctype != C_PALADIN)
-		    fuse(prayer_recovery, 0, SPELLTIME, AFTER);
+		    fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
 
 	    /* A cloak must be worn. */
 	    when EMORI_CLOAK:
@@ -306,7 +307,7 @@
 		msg("The excrutiating pain slowly turns into a dull throb.");
 		
 	    when QUILL_NAGROM:
-	        fuse(quill_charge,0,player.t_ctype==C_MAGICIAN ? 4 : 8,AFTER);
+	        fuse(quill_charge,NULL,player.t_ctype==C_MAGICIAN ? 4 : 8,AFTER);
 
 	    /* Weapons will insist on being wielded. */
 	    when MUSTY_DAGGER:
@@ -316,7 +317,8 @@
 		/* For the daggers start a fuse to change player to a thief. */
 		/* and set a daemon to eat gold.			     */
 		if (obj->o_which == MUSTY_DAGGER) {
-		    fuse(changeclass, C_THIEF, roll(20, 20), AFTER);
+		    newclass = C_THIEF;
+		    fuse(changeclass, &newclass, roll(20, 20), AFTER);
 		    if (purse > 0)
 			msg("Your purse feels lighter");
 		    else
@@ -326,7 +328,8 @@
 		}
 		/* For the axe start a fuse to change player to a fighter. */
 		if (obj->o_which == AXE_AKLAD)
-		    fuse(changeclass, C_FIGHTER, roll(20, 20), AFTER);
+		    newclass = C_FIGHTER;
+		    fuse(changeclass, &newclass, roll(20, 20), AFTER);
 		if (cur_weapon != NULL) {
 		    msg("The artifact insists you release your current weapon.");
 		    if (!dropcheck(cur_weapon)) {
--- a/arogue7/potions.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/potions.c	Fri Mar 11 17:40:00 2016 -0500
@@ -150,7 +150,7 @@
     else {
 	msg("You feel yourself moving %sfaster.", blessed ? "much " : "");
 	turn_on(player, ISHASTE);
-	fuse(nohaste, 0, roll(hasttime, hasttime), AFTER);
+	fuse(nohaste, NULL, roll(hasttime, hasttime), AFTER);
     }
 }
 
@@ -206,7 +206,7 @@
 	    lengthen(noslow, roll(HASTETIME,HASTETIME));
 	else {
 	    turn_on(player, ISSLOW);
-	    fuse(noslow, 0, roll(HASTETIME,HASTETIME), AFTER);
+	    fuse(noslow, NULL, roll(HASTETIME,HASTETIME), AFTER);
 	}
     }
 }
@@ -324,7 +324,7 @@
 		}
 		else {	/* Just light a fuse for how long player is safe */
 		    if (off(player, ISCLEAR)) {
-			fuse(unclrhead, 0, CLRDURATION, AFTER);
+			fuse(unclrhead, NULL, CLRDURATION, AFTER);
 			msg("A faint blue aura surrounds your head.");
 		    }
 		    else {  /* If we have a fuse lengthen it, else we
@@ -491,7 +491,7 @@
 		{
 		    msg("A cloak of darkness falls around you.");
 		    turn_on(player, ISBLIND);
-		    fuse(sight, 0, SEEDURATION, AFTER);
+		    fuse(sight, NULL, SEEDURATION, AFTER);
 		    light(&hero);
 		}
 		else
@@ -501,7 +501,7 @@
 		if (off(player, CANSEE)) {
 		    turn_on(player, CANSEE);
 		    msg("Your eyes begin to tingle.");
-		    fuse(unsee, 0, blessed ? SEEDURATION*3 :SEEDURATION, AFTER);
+		    fuse(unsee, NULL, blessed ? SEEDURATION*3 :SEEDURATION, AFTER);
 		    light(&hero);
 		}
 		else if (find_slot(unsee) != 0)
@@ -523,7 +523,7 @@
 		if (on(player, CANINWALL))
 		    lengthen(unphase, duration*PHASEDURATION);
 		else {
-		    fuse(unphase, 0, duration*PHASEDURATION, AFTER);
+		    fuse(unphase, NULL, duration*PHASEDURATION, AFTER);
 		    turn_on(player, CANINWALL);
 		}
 		msg("You feel %slight-headed!",
@@ -547,7 +547,7 @@
 		}
 	    }
 	    else {
-		fuse(land, 0, duration*FLYTIME, AFTER);
+		fuse(land, NULL, duration*FLYTIME, AFTER);
 		turn_on(player, ISFLY);
 	    }
 	    if (say_message) {
@@ -610,7 +610,7 @@
 	    if (off(player, ISINVIS)) {
 		turn_on(player, ISINVIS);
 		msg("You have a tingling feeling all over your body");
-		fuse(appear, 0, blessed ? GONETIME*3 : GONETIME, AFTER);
+		fuse(appear, NULL, blessed ? GONETIME*3 : GONETIME, AFTER);
 		PLAYER = IPLAYER;
 		light(&hero);
 	    }
@@ -675,7 +675,7 @@
 		if (!find_slot(unskill)) {	/* No skill */
 		    pstats.s_lvladj = -2;
 		    pstats.s_lvl += pstats.s_lvladj;
-		    fuse(unskill, 0, SKILLDURATION, AFTER);
+		    fuse(unskill, NULL, SKILLDURATION, AFTER);
 		}
 		else {	/* Has an artifical skill */
 		    /* Is the skill beneficial? */
@@ -714,7 +714,7 @@
 		if (!find_slot(unskill)) {
 		    pstats.s_lvladj = adjust;
 		    pstats.s_lvl += pstats.s_lvladj;
-		    fuse(unskill, 0, 
+		    fuse(unskill, NULL, 
 			 blessed ? SKILLDURATION*2 : SKILLDURATION, AFTER);
 		}
 		else {	/* Has an artifical skill */
@@ -763,7 +763,7 @@
 		}
 	    }
 	    else {
-		fuse(nofire, 0, duration*FIRETIME, AFTER);
+		fuse(nofire, NULL, duration*FIRETIME, AFTER);
 		turn_on(player, NOFIRE);
 	    }
 	    if (say_message)  {
@@ -789,7 +789,7 @@
 		}
 	    }
 	    else {
-		fuse(nocold, 0, duration*COLDTIME, AFTER);
+		fuse(nocold, NULL, duration*COLDTIME, AFTER);
 		turn_on(player, NOCOLD);
 	    }
 	    if (say_message)  {
@@ -811,7 +811,7 @@
 		    lengthen(nobolt, duration*BOLTTIME);
 	    }
 	    else {
-		fuse(nobolt, 0, duration*BOLTTIME, AFTER);
+		fuse(nobolt, NULL, duration*BOLTTIME, AFTER);
 		turn_on(player, NOBOLT);
 	    }
 	    if (say_message) 
--- a/arogue7/rings.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/rings.c	Fri Mar 11 17:40:00 2016 -0500
@@ -90,9 +90,9 @@
 		}
 	    }
 	when R_SEARCH:
-		start_daemon(ring_search, 0, AFTER);
+		start_daemon(ring_search, NULL, AFTER);
 	when R_TELEPORT:
-		start_daemon(ring_teleport, 0, AFTER);
+		start_daemon(ring_teleport, NULL, AFTER);
     }
     status(FALSE);
     if (r_know[obj->o_which] && r_guess[obj->o_which])
--- a/arogue7/rogue.h	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/rogue.h	Fri Mar 11 17:40:00 2016 -0500
@@ -1223,7 +1223,7 @@
 int     findmindex(char *name);
 void    fix_stick(struct object *cur);
 void    fumble(void);
-void    fuse(void (*func)(), int arg, int time, int type);
+void    fuse(void (*func)(), void *arg, int time, int type);
 void    genmonsters(int least, bool treas);
 coord   get_coordinates(void);
 bool    get_dir(coord *direction);
@@ -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(void (*func)(), int 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/sticks.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/sticks.c	Fri Mar 11 17:40:00 2016 -0500
@@ -590,7 +590,7 @@
 		    turn_on(player, HASDISEASE);
 		    turn_on(player, HASINFEST);
 		    turn_on(player, DOROT);
-		    fuse(cure_disease, 0, roll(HEALTIME,SICKTIME), AFTER);
+		    fuse(cure_disease, NULL, roll(HEALTIME,SICKTIME), AFTER);
 		    infest_dam++;
 		}
 		else msg("You fell momentarily sick");
@@ -1188,7 +1188,7 @@
 					         rnd(20)+HUHDURATION);
 				    else {
 					turn_on(player, ISHUH);
-					fuse(unconfuse, 0,
+					fuse(unconfuse, NULL,
 					     rnd(20)+HUHDURATION, AFTER);
 					msg(
 					 "The confusion gas has confused you.");
--- a/arogue7/util.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/util.c	Fri Mar 11 17:40:00 2016 -0500
@@ -209,7 +209,7 @@
 	if (find_slot(unconfuse))
 	    lengthen(unconfuse, HUHDURATION);
 	else
-	    fuse(unconfuse, 0, HUHDURATION, AFTER);
+	    fuse(unconfuse, NULL, HUHDURATION, AFTER);
 	turn_on(player, ISHUH);
     }
     else msg("You feel dizzy for a moment, but it quickly passes.");
--- a/arogue7/wear.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/arogue7/wear.c	Fri Mar 11 17:40:00 2016 -0500
@@ -327,7 +327,7 @@
 		msg("Wearing %s", inv_name(obj,TRUE));
 		cur_misc[WEAR_GAUNTLET] = obj;
 		if (obj->o_which == MM_FUMBLE)
-		    start_daemon(fumble, 0, AFTER);
+		    start_daemon(fumble, NULL, AFTER);
 	    /*
 	     * the jewel of attacks does an aggavate monster
 	     */
@@ -351,7 +351,7 @@
 		msg("Wearing %s",inv_name(obj,TRUE));
 		cur_misc[WEAR_NECKLACE] = obj;
 		msg("The necklace is beginning to strangle you!");
-		start_daemon(strangle, 0, AFTER);
+		start_daemon(strangle, NULL, AFTER);
 	    otherwise:
 		msg("What a strange item you have!");
 	    }
--- a/xrogue/daemon.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/xrogue/daemon.c	Fri Mar 11 17:40:00 2016 -0500
@@ -172,7 +172,10 @@
         if (wire != NULL) {
                 wire->d_type = type;
                 wire->d_func = dfunc;
-                wire->d_arg.vp = arg;
+                if (dfunc == changeclass || dfunc == res_strength)
+                        wire->d_arg.i = *(int *) arg;
+                else
+                        wire->d_arg.vp = arg;
                 wire->d_time = time;
                 fusecnt += 1;                   /* update count */
         }
@@ -220,26 +223,28 @@
 void
 do_fuses(int flag)
 {
-        struct delayed_action *wire;
-        int i;
+    struct delayed_action *wire;
+    int i;
 
-        /*
-         * Step though the list
-         */
-        for (i = 0; i < MAXFUSES; i++) {
-            wire = &f_list[i];
+    /*
+     * Step though the list
+     */
+    for (i = 0; i < MAXFUSES; i++) {
+        wire = &f_list[i];
         /*
          * Decrementing counters and starting things we want.  We also need
          * to remove the fuse from the list once it has gone off.
          */
-            if(flag == wire->d_type && wire->d_time > 0 &&
+        if(flag == wire->d_type && wire->d_time > 0 &&
               --wire->d_time == 0) {
-                wire->d_type = EMPTY;
-				if (wire->d_func != NULL)
-					(*wire->d_func)(wire->d_arg.vp);
-                fusecnt -= 1;
-            }
+            wire->d_type = EMPTY;
+            if (*wire->d_func == changeclass || *wire->d_func == res_strength)
+                (*wire->d_func)(wire->d_arg.i);
+            else if (wire->d_func != NULL)
+                (*wire->d_func)(wire->d_arg.vp);
+            fusecnt -= 1;
         }
+    }
 }
 
 /*
--- a/xrogue/effects.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/xrogue/effects.c	Fri Mar 11 17:40:00 2016 -0500
@@ -323,8 +323,10 @@
                     msg("You cringe at %s's chilling touch.",
                                 prname(attname, FALSE));
                     chg_str(-1);
-                    if (lost_str++ == 0)
-                        fuse(res_strength, NULL, CHILLTIME, AFTER);
+                    if (lost_str++ == 0) {
+                        int temp_arg = 0;
+                        fuse(res_strength, &temp_arg, CHILLTIME, AFTER);
+                    }
                     else lengthen(res_strength, CHILLTIME);
                 }
             }
@@ -548,11 +550,12 @@
 
                 else {
                     int odor_str = -(rnd(6)+1);
+                    int temp_arg2 = 0;
 
                     msg("You are overcome by a foul odor!");
                     if (lost_str == 0) {
                         chg_str(odor_str);
-                        fuse(res_strength, NULL, SMELLTIME, AFTER);
+                        fuse(res_strength, &temp_arg2, SMELLTIME, AFTER);
                         lost_str -= odor_str;
                     }
                     else lengthen(res_strength, SMELLTIME);
--- a/xrogue/fight.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/xrogue/fight.c	Fri Mar 11 17:40:00 2016 -0500
@@ -966,7 +966,6 @@
     register struct linked_list *pitem, *nexti, *mitem;
     char *monst;
     int adj;    /* used for hit point adj. below. */
-    long temp;
 
     tp = THINGPTR(item);
 
@@ -1029,8 +1028,7 @@
                 if (roll(1,100) < killed_chance) {
             msg("You had a feeling this was going to happen... ");
                     msg("**POOF**  ");
-                    temp = C_ASSASSIN;  /* make him pay */
-                    changeclass(&temp);
+                    changeclass(C_ASSASSIN);  /* make him pay */
                 }
                 else {
                     switch (rnd(9)) {
--- a/xrogue/misc.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/xrogue/misc.c	Fri Mar 11 17:40:00 2016 -0500
@@ -24,9 +24,9 @@
  */
 
 void
-changeclass(long *newclass)
+changeclass(int newclass)
 {
-    if (*newclass == player.t_ctype) {
+    if (newclass == player.t_ctype) {
         msg("You feel more skillful.");
         raise_level();
     }
@@ -38,19 +38,19 @@
          */
         long save;
 
-        msg("You are transformed into a %s! ", char_class[*newclass].name);
+        msg("You are transformed into a %s! ", char_class[newclass].name);
 
         /*
          * if he becomes a thief or an assassin give him studded leather armor
          */
-        if ((*newclass == C_THIEF || *newclass == C_ASSASSIN) &&
+        if ((newclass == C_THIEF || newclass == C_ASSASSIN) &&
             cur_armor != NULL && cur_armor->o_which != STUDDED_LEATHER)
                 cur_armor->o_which = STUDDED_LEATHER;
         /*
          * if he becomes a monk he can't wear any armor
      * so give him a cloak of protection
          */
-        if (*newclass == C_MONK && cur_armor != NULL) {
+        if (newclass == C_MONK && cur_armor != NULL) {
                 cur_armor->o_ac = armors[cur_armor->o_which].a_class - 
                                   cur_armor->o_ac;
                 cur_armor->o_type = MM;
@@ -62,8 +62,8 @@
     /*
      * otherwise give him plate armor
      */
-        if ((*newclass != C_THIEF ||
-         *newclass != C_ASSASSIN || *newclass != C_MONK) &&
+        if ((newclass != C_THIEF ||
+         newclass != C_ASSASSIN || newclass != C_MONK) &&
          cur_armor != NULL && cur_armor->o_which != PLATE_ARMOR) 
                 cur_armor->o_which = PLATE_ARMOR;
 
@@ -81,11 +81,11 @@
         /*
          * if he becomes a spell caster of some kind, give him a fuse
          */
-        if (*newclass == C_MAGICIAN || *newclass == C_RANGER)
+        if (newclass == C_MAGICIAN || newclass == C_RANGER)
                 fuse(spell_recovery, NULL, SPELLTIME, AFTER);
-        if (*newclass == C_DRUID || *newclass == C_MONK)
+        if (newclass == C_DRUID || newclass == C_MONK)
                 fuse(chant_recovery, NULL, SPELLTIME, AFTER);
-        if ((*newclass==C_CLERIC || *newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
+        if ((newclass==C_CLERIC || newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
                 fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
         /*
          * if he's changing from a fighter, ranger, or paladin then we
@@ -98,8 +98,8 @@
         cur_weapon != NULL && cur_weapon->o_type == WEAPON &&
             (cur_weapon->o_which == BASWORD  ||
         cur_weapon->o_which == TWOSWORD) &&
-            !(*newclass == C_FIGHTER || *newclass == C_RANGER ||
-            *newclass == C_PALADIN)  &&
+            !(newclass == C_FIGHTER || newclass == C_RANGER ||
+            newclass == C_PALADIN)  &&
         cur_weapon->o_which == TWOSWORD)
                 cur_weapon->o_which = SWORD;
 
@@ -113,8 +113,8 @@
         cur_weapon != NULL && cur_weapon->o_type == WEAPON &&
             (cur_weapon->o_which == BASWORD  ||
             cur_weapon->o_which == TWOSWORD) &&
-            !(*newclass == C_THIEF || *newclass == C_ASSASSIN ||
-            *newclass == C_MONK)   &&
+            !(newclass == C_THIEF || newclass == C_ASSASSIN ||
+            newclass == C_MONK)   &&
         cur_weapon->o_which == BASWORD)
                 cur_weapon->o_which = SWORD;
 
@@ -130,12 +130,12 @@
          * if he becomes a thief, assassin, or monk then add 
      * the trap_look() daemon
          */
-        if (*newclass == C_THIEF || *newclass == C_ASSASSIN ||
-        *newclass == C_MONK)
+        if (newclass == C_THIEF || newclass == C_ASSASSIN ||
+        newclass == C_MONK)
                 start_daemon(trap_look, NULL, AFTER);
 
     /* adjust stats */
-        char_type = player.t_ctype = *newclass;
+        char_type = player.t_ctype = newclass;
         save = pstats.s_hpt;
         max_stats.s_hpt = pstats.s_hpt = 0;
         max_stats.s_lvl = pstats.s_lvl = 0; 
@@ -1103,7 +1103,7 @@
         when MM_SKILLS:
             detach (pack, item);
             inpack--;
-            changeclass(&obj->o_ac);
+            changeclass(obj->o_ac);
     when MM_CRYSTAL:
     {
         register char *str;
--- a/xrogue/pack.c	Tue Mar 08 20:47:57 2016 -0500
+++ b/xrogue/pack.c	Fri Mar 11 17:40:00 2016 -0500
@@ -36,15 +36,7 @@
     register struct object *obj, *op = NULL;
     register bool exact, from_floor;
     bool giveflag = 0;
-    static long cleric   = C_CLERIC,
-        monk     = C_MONK,
-        magician = C_MAGICIAN,
-        assassin = C_ASSASSIN,
-        druid    = C_DRUID,
-        thief    = C_THIEF,
-        fighter  = C_FIGHTER,
-        ranger   = C_RANGER,
-        paladin  = C_PALADIN;
+    int newclass;
 
     if (item == NULL)
     {
@@ -263,8 +255,10 @@
         /* start a fuse to change player into a paladin */
         if (quest_item != HEIL_ANKH) {
             msg("You hear a strange, distant hypnotic calling... ");
-            if (player.t_ctype != C_PALADIN && obj->o_which ==HEIL_ANKH)
-                        fuse(changeclass, &paladin, roll(8, 8), AFTER);
+            if (player.t_ctype != C_PALADIN && obj->o_which ==HEIL_ANKH) {
+                newclass = C_PALADIN;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
+            }
         }
 
             /* A cloak must be worn. */
@@ -287,8 +281,10 @@
         /* start a fuse to change player into a monk */
         if (quest_item != EMORI_CLOAK) {
             msg("You suddenly become calm and quiet. ");
-            if (player.t_ctype != C_MONK && obj->o_which == EMORI_CLOAK)
-                        fuse(changeclass, &monk, roll(8, 8), AFTER);
+            if (player.t_ctype != C_MONK && obj->o_which == EMORI_CLOAK) {
+                newclass = C_MONK;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
+            }
         }
 
             /* The amulet must be worn. */
@@ -312,7 +308,8 @@
             if (player.t_ctype != C_MAGICIAN &&
             obj->o_which == STONEBONES_AMULET) {
                 msg("You sense approaching etheric forces... ");
-                        fuse(changeclass, &magician, roll(8, 8), AFTER);
+                newclass = C_MAGICIAN;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
             }
         }
 
@@ -331,8 +328,10 @@
         /* start a fuse to change player into an assassin */
         if (quest_item != EYE_VECNA) {
             msg("Your blood rushes and you begin to sweat profusely... ");
-            if (player.t_ctype != C_ASSASSIN && obj->o_which == EYE_VECNA)
-                        fuse(changeclass, &assassin, roll(8, 8), AFTER);
+            if (player.t_ctype != C_ASSASSIN && obj->o_which == EYE_VECNA) {
+                newclass = C_ASSASSIN;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
+            }
         }
                 
             when QUILL_NAGROM:
@@ -340,8 +339,10 @@
         /* start a fuse to change player into a druid */
         if (quest_item != QUILL_NAGROM) {
             msg("You begin to see things differently... ");
-            if (player.t_ctype != C_DRUID && obj->o_which == QUILL_NAGROM)
-                        fuse(changeclass, &druid, roll(8, 8), AFTER);
+            if (player.t_ctype != C_DRUID && obj->o_which == QUILL_NAGROM) {
+                newclass = C_DRUID;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
+            }
         }
 
             /* Weapons will insist on being wielded. */
@@ -362,7 +363,8 @@
             if (player.t_ctype != C_THIEF &&
             obj->o_which == MUSTY_DAGGER) {
                 msg("You look about furtively. ");
-                        fuse(changeclass, &thief, roll(8, 8), AFTER);
+                newclass = C_THIEF;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
             }
         }
         /* start a fuse to change player into a fighter */
@@ -370,7 +372,8 @@
             if (player.t_ctype != C_FIGHTER &&
             obj->o_which == AXE_AKLAD) {
                 msg("Your bones feel strengthened. ");
-                        fuse(changeclass, &fighter, roll(8, 8), AFTER);
+                newclass = C_FIGHTER;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
             }
                 }
                 if (cur_weapon != NULL) {
@@ -405,8 +408,10 @@
         /* start a fuse to change player into a ranger */
         if (quest_item != BRIAN_MANDOLIN) {
             msg("You are transfixed with empathy. ");
-            if (player.t_ctype != C_RANGER && obj->o_which == BRIAN_MANDOLIN)
-                        fuse(changeclass, &ranger, roll(8, 8), AFTER);
+            if (player.t_ctype != C_RANGER && obj->o_which == BRIAN_MANDOLIN) {
+                newclass = C_RANGER;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
+            }
         }
 
         /* add to the music */
@@ -415,8 +420,10 @@
         /* start a fuse to change player into a cleric */
         if (quest_item != GERYON_HORN) {
             msg("You follow their calling. ");
-            if (player.t_ctype != C_CLERIC && obj->o_which == GERYON_HORN)
-                        fuse(changeclass, &cleric, roll(8, 8), AFTER);
+            if (player.t_ctype != C_CLERIC && obj->o_which == GERYON_HORN) {
+                newclass = C_CLERIC;
+                fuse(changeclass, &newclass, roll(8, 8), AFTER);
+            }
         }
 
         /* the card can not be picked up, it must be traded for */
--- a/xrogue/rogue.h	Tue Mar 08 20:47:57 2016 -0500
+++ b/xrogue/rogue.h	Fri Mar 11 17:40:00 2016 -0500
@@ -1245,7 +1245,7 @@
 bool    cansee(int y, int x);
 void    carry_obj(struct thing *mp, int chance);
 void    cast(void);
-void    changeclass(long *newclass);
+void    changeclass(int newclass);
 void    chant(void);
 void    chant_recovery(void);
 void    chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree,