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:
parent
dafa5cc722
commit
758c6b1bf0
21 changed files with 147 additions and 124 deletions
|
|
@ -150,7 +150,7 @@ add_haste(bool blessed)
|
|||
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 @@ add_slow(void)
|
|||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
}
|
||||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
{
|
||||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
}
|
||||
}
|
||||
else {
|
||||
fuse(land, 0, duration*FLYTIME, AFTER);
|
||||
fuse(land, NULL, duration*FLYTIME, AFTER);
|
||||
turn_on(player, ISFLY);
|
||||
}
|
||||
if (say_message) {
|
||||
|
|
@ -610,7 +610,7 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
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 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
}
|
||||
}
|
||||
else {
|
||||
fuse(nofire, 0, duration*FIRETIME, AFTER);
|
||||
fuse(nofire, NULL, duration*FIRETIME, AFTER);
|
||||
turn_on(player, NOFIRE);
|
||||
}
|
||||
if (say_message) {
|
||||
|
|
@ -789,7 +789,7 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
}
|
||||
}
|
||||
else {
|
||||
fuse(nocold, 0, duration*COLDTIME, AFTER);
|
||||
fuse(nocold, NULL, duration*COLDTIME, AFTER);
|
||||
turn_on(player, NOCOLD);
|
||||
}
|
||||
if (say_message) {
|
||||
|
|
@ -811,7 +811,7 @@ quaff(int which, int kind, int flags, bool is_potion)
|
|||
lengthen(nobolt, duration*BOLTTIME);
|
||||
}
|
||||
else {
|
||||
fuse(nobolt, 0, duration*BOLTTIME, AFTER);
|
||||
fuse(nobolt, NULL, duration*BOLTTIME, AFTER);
|
||||
turn_on(player, NOBOLT);
|
||||
}
|
||||
if (say_message)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue