Fix use of data from deleted vault teleport trap

This commit is contained in:
Pasi Kallinen
2015-11-15 18:55:09 +02:00
parent d813c6f0ee
commit 8a07e2cdc5

View File

@@ -490,12 +490,14 @@ int
dotele()
{
struct trap *trap;
boolean trap_once = FALSE;
trap = t_at(u.ux, u.uy);
if (trap && (!trap->tseen || trap->ttyp != TELEP_TRAP))
trap = 0;
if (trap) {
trap_once = trap->once; /* trap may get deleted, save this */
if (trap->once) {
pline("This is a vault teleport, usable once only.");
if (yn("Jump in?") == 'n')
@@ -569,7 +571,7 @@ dotele()
}
if (next_to_u()) {
if (trap && trap->once)
if (trap && trap_once)
vault_tele();
else
tele();