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

@ -111,7 +111,7 @@ doctor(struct thing *tp)
void
swander(void)
{
start_daemon(rollwand, 0, BEFORE);
start_daemon(rollwand, NULL, BEFORE);
}
/*
@ -134,7 +134,7 @@ rollwand(void)
if (levtype != POSTLEV)
wanderer();
kill_daemon(rollwand);
fuse(swander, 0, WANDERTIME, BEFORE);
fuse(swander, NULL, WANDERTIME, BEFORE);
}
between = 0;
}
@ -663,7 +663,7 @@ spell_recovery(void)
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 @@ prayer_recovery(void)
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 @@ chant_recovery(void)
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);
}