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.
This commit is contained in:
parent
cfda1f88e8
commit
6dfde944f0
7 changed files with 44 additions and 2 deletions
|
|
@ -77,7 +77,7 @@ quaff(void)
|
||||||
msg("you feel stronger, now. What bulging muscles!");
|
msg("you feel stronger, now. What bulging muscles!");
|
||||||
when P_MFIND:
|
when P_MFIND:
|
||||||
player.t_flags |= SEEMONST;
|
player.t_flags |= SEEMONST;
|
||||||
fuse(turn_see, TRUE, HUHDURATION, AFTER);
|
fuse(turn_see_off, TRUE, HUHDURATION, AFTER);
|
||||||
if (mlist == NULL)
|
if (mlist == NULL)
|
||||||
msg("you have a strange feeling for a moment");
|
msg("you have a strange feeling for a moment");
|
||||||
else
|
else
|
||||||
|
|
@ -256,3 +256,12 @@ turn_see(bool turn_off)
|
||||||
player.t_flags |= SEEMONST;
|
player.t_flags |= SEEMONST;
|
||||||
return add_new;
|
return add_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A wrapper for turn_see(TRUE), to be used as a fuse.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
turn_see_off(void)
|
||||||
|
{
|
||||||
|
turn_see(TRUE);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -614,6 +614,7 @@ int teleport(void);
|
||||||
void total_winner(void);
|
void total_winner(void);
|
||||||
char *tr_name(char type);
|
char *tr_name(char type);
|
||||||
bool turn_see(bool turn_off);
|
bool turn_see(bool turn_off);
|
||||||
|
void turn_see_off(void);
|
||||||
void unconfuse(void);
|
void unconfuse(void);
|
||||||
char *unctrol(char ch);
|
char *unctrol(char ch);
|
||||||
void unlock_sc(void);
|
void unlock_sc(void);
|
||||||
|
|
|
||||||
|
|
@ -967,6 +967,8 @@ rs_write_daemons(FILE *savef, struct delayed_action *d_list, int count)
|
||||||
func = 8;
|
func = 8;
|
||||||
else if (d_list[i].d_func == sight)
|
else if (d_list[i].d_func == sight)
|
||||||
func = 9;
|
func = 9;
|
||||||
|
else if (d_list[i].d_func == turn_see_off)
|
||||||
|
func = 10;
|
||||||
else
|
else
|
||||||
func = 0;
|
func = 0;
|
||||||
|
|
||||||
|
|
@ -1037,9 +1039,18 @@ rs_read_daemons(int inf, struct delayed_action *d_list, int count)
|
||||||
break;
|
break;
|
||||||
case 9: d_list[i].d_func = sight;
|
case 9: d_list[i].d_func = sight;
|
||||||
break;
|
break;
|
||||||
|
case 10: d_list[i].d_func = turn_see_off;
|
||||||
|
break;
|
||||||
default:d_list[i].d_func = NULL;
|
default:d_list[i].d_func = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d_list[i].d_func == NULL)
|
||||||
|
{
|
||||||
|
d_list[i].d_type = 0;
|
||||||
|
d_list[i].d_arg = 0;
|
||||||
|
d_list[i].d_time = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ quaff(void)
|
||||||
msg("you feel stronger, now. What bulging muscles!");
|
msg("you feel stronger, now. What bulging muscles!");
|
||||||
when P_MFIND:
|
when P_MFIND:
|
||||||
player.t_flags |= SEEMONST;
|
player.t_flags |= SEEMONST;
|
||||||
fuse((void(*)())turn_see, TRUE, HUHDURATION, AFTER);
|
fuse(turn_see_off, TRUE, HUHDURATION, AFTER);
|
||||||
if (!turn_see(FALSE))
|
if (!turn_see(FALSE))
|
||||||
msg("you have a %s feeling for a moment, then it passes",
|
msg("you have a %s feeling for a moment, then it passes",
|
||||||
choose_str("normal", "strange"));
|
choose_str("normal", "strange"));
|
||||||
|
|
@ -305,6 +305,15 @@ turn_see(int turn_off)
|
||||||
return add_new;
|
return add_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A wrapper for turn_see(TRUE), intended to be a fuse.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
turn_see_off(void)
|
||||||
|
{
|
||||||
|
turn_see(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* seen_stairs:
|
* seen_stairs:
|
||||||
* Return TRUE if the player has seen the stairs
|
* Return TRUE if the player has seen the stairs
|
||||||
|
|
|
||||||
|
|
@ -758,6 +758,7 @@ int trip_ch(int y, int x, int ch);
|
||||||
void tstp(int ignored);
|
void tstp(int ignored);
|
||||||
int turn_ok(int y, int x);
|
int turn_ok(int y, int x);
|
||||||
int turn_see(int turn_off);
|
int turn_see(int turn_off);
|
||||||
|
void turn_see_off(void);
|
||||||
void turnref(void);
|
void turnref(void);
|
||||||
const char *type_name(int type);
|
const char *type_name(int type);
|
||||||
void u_level(void);
|
void u_level(void);
|
||||||
|
|
|
||||||
|
|
@ -598,6 +598,8 @@ rs_write_daemons(FILE *savef, struct delayed_action *dlist, int cnt)
|
||||||
func = 8;
|
func = 8;
|
||||||
else if (dlist[i].d_func == sight)
|
else if (dlist[i].d_func == sight)
|
||||||
func = 9;
|
func = 9;
|
||||||
|
else if (dlist[i].d_func == turn_see_off)
|
||||||
|
func = 10;
|
||||||
else if (dlist[i].d_func == NULL)
|
else if (dlist[i].d_func == NULL)
|
||||||
func = 0;
|
func = 0;
|
||||||
else
|
else
|
||||||
|
|
@ -657,6 +659,8 @@ rs_read_daemons(FILE *savef, struct delayed_action *dlist, int cnt)
|
||||||
break;
|
break;
|
||||||
case 9: dlist[i].d_func = sight;
|
case 9: dlist[i].d_func = sight;
|
||||||
break;
|
break;
|
||||||
|
case 10: dlist[i].d_func = turn_see_off;
|
||||||
|
break;
|
||||||
default:dlist[i].d_func = NULL;
|
default:dlist[i].d_func = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1098,6 +1098,13 @@ rs_read_daemons(int inf, struct delayed_action *d_list, int count)
|
||||||
default: d_list[i].d_func = NULL;
|
default: d_list[i].d_func = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d_list[i].d_func == NULL)
|
||||||
|
{
|
||||||
|
d_list[i].d_type = 0;
|
||||||
|
d_list[i].d_arg = 0;
|
||||||
|
d_list[i].d_time = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue