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.
This commit is contained in:
John "Elwin" Edwards 2016-03-11 17:40:00 -05:00
parent dafa5cc722
commit 758c6b1bf0
21 changed files with 147 additions and 124 deletions

View file

@ -81,11 +81,11 @@ changeclass(int newclass)
* 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 @@ changeclass(int newclass)
* 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 @@ use_mm(int which)
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 @@ use_mm(int which)
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);