comparison rogue5/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 f502bf60e6e4
children
comparison
equal deleted inserted replaced
226:b922f66acf4d 227:696277507a2e
109 pot_info[P_STRENGTH].oi_know = TRUE; 109 pot_info[P_STRENGTH].oi_know = TRUE;
110 chg_str(1); 110 chg_str(1);
111 msg("you feel stronger, now. What bulging muscles!"); 111 msg("you feel stronger, now. What bulging muscles!");
112 when P_MFIND: 112 when P_MFIND:
113 player.t_flags |= SEEMONST; 113 player.t_flags |= SEEMONST;
114 fuse((void(*)())turn_see, TRUE, HUHDURATION, AFTER); 114 fuse(turn_see_off, TRUE, HUHDURATION, AFTER);
115 if (!turn_see(FALSE)) 115 if (!turn_see(FALSE))
116 msg("you have a %s feeling for a moment, then it passes", 116 msg("you have a %s feeling for a moment, then it passes",
117 choose_str("normal", "strange")); 117 choose_str("normal", "strange"));
118 when P_TFIND: 118 when P_TFIND:
119 /* 119 /*
304 player.t_flags |= SEEMONST; 304 player.t_flags |= SEEMONST;
305 return add_new; 305 return add_new;
306 } 306 }
307 307
308 /* 308 /*
309 * A wrapper for turn_see(TRUE), intended to be a fuse.
310 */
311 void
312 turn_see_off(void)
313 {
314 turn_see(TRUE);
315 }
316
317 /*
309 * seen_stairs: 318 * seen_stairs:
310 * Return TRUE if the player has seen the stairs 319 * Return TRUE if the player has seen the stairs
311 */ 320 */
312 int 321 int
313 seen_stairs(void) 322 seen_stairs(void)