Mercurial > hg > early-roguelike
comparison rogue4/potions.c @ 227:696277507a2e
Rogue V4, V5: disable a cheat granting permanent monster detection.
In these two games, a potion of monster detection turns on the player's
SEEMONST flag. A fuse is set to call turn_see() to turn the flag back
off. But the save and restore functions do not recognize turn_see() and
fail to set the fuse up again.
When restoring, Rogue V4 merely sets the fuse's function to NULL and
leaves it burning. When it goes off, a segfault results. Rogue V5
clears all the fuse's fields, and the player retains the ability to see
all monsters on the level.
The save and restore code can now handle the fuse. The function used is
a new wrapper, turn_see_off(), which should lead to less problems with
daemons being multiple incompatible types.
Also, Rogue V4 and Super-Rogue now properly clear unrecognized daemon
and fuse slots when restoring a saved game.
author | John "Elwin" Edwards |
---|---|
date | Sat, 05 Mar 2016 12:10:20 -0500 |
parents | 1b73a8641b37 |
children | 3900f3cfe07d |
comparison
equal
deleted
inserted
replaced
226:b922f66acf4d | 227:696277507a2e |
---|---|
75 p_know[P_STRENGTH] = TRUE; | 75 p_know[P_STRENGTH] = TRUE; |
76 chg_str(1); | 76 chg_str(1); |
77 msg("you feel stronger, now. What bulging muscles!"); | 77 msg("you feel stronger, now. What bulging muscles!"); |
78 when P_MFIND: | 78 when P_MFIND: |
79 player.t_flags |= SEEMONST; | 79 player.t_flags |= SEEMONST; |
80 fuse(turn_see, TRUE, HUHDURATION, AFTER); | 80 fuse(turn_see_off, TRUE, HUHDURATION, AFTER); |
81 if (mlist == NULL) | 81 if (mlist == NULL) |
82 msg("you have a strange feeling for a moment"); | 82 msg("you have a strange feeling for a moment"); |
83 else | 83 else |
84 p_know[P_MFIND] |= turn_see(FALSE); | 84 p_know[P_MFIND] |= turn_see(FALSE); |
85 when P_TFIND: | 85 when P_TFIND: |
254 player.t_flags &= ~SEEMONST; | 254 player.t_flags &= ~SEEMONST; |
255 else | 255 else |
256 player.t_flags |= SEEMONST; | 256 player.t_flags |= SEEMONST; |
257 return add_new; | 257 return add_new; |
258 } | 258 } |
259 | |
260 /* | |
261 * A wrapper for turn_see(TRUE), to be used as a fuse. | |
262 */ | |
263 void | |
264 turn_see_off(void) | |
265 { | |
266 turn_see(TRUE); | |
267 } |