reset travel cache when changing levels
When travel fails to reach its destination, it remembers the target spot to use as default next time. But that spot is only meaningful on the current level. Discard last travel destination when moving to a different level. Also, discard unlocking context when changing level unless the context is for a container being brought along (after having been picked up since you can't unlock a carried box). Previously, a door pointer on the new level could happen to match the last one being unlocked on the old level. Discard trap setting context when changing level even if the trap object is brought along. Somehow the code for applying a touchstone got inserted in between two sections of code for applying a trap (ages ago; probably since touchstone was first introduced however many versions back), so clean that up.
This commit is contained in:
28
src/apply.c
28
src/apply.c
@@ -2179,20 +2179,6 @@ struct obj *obj;
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
static struct trapinfo {
|
||||
struct obj *tobj;
|
||||
xchar tx, ty;
|
||||
int time_needed;
|
||||
boolean force_bungle;
|
||||
} trapinfo;
|
||||
|
||||
void
|
||||
reset_trapset()
|
||||
{
|
||||
trapinfo.tobj = 0;
|
||||
trapinfo.force_bungle = 0;
|
||||
}
|
||||
|
||||
/* touchstones - by Ken Arnold */
|
||||
STATIC_OVL void
|
||||
use_stone(tstone)
|
||||
@@ -2322,6 +2308,20 @@ struct obj *tstone;
|
||||
return;
|
||||
}
|
||||
|
||||
static struct trapinfo {
|
||||
struct obj *tobj;
|
||||
xchar tx, ty;
|
||||
int time_needed;
|
||||
boolean force_bungle;
|
||||
} trapinfo;
|
||||
|
||||
void
|
||||
reset_trapset()
|
||||
{
|
||||
trapinfo.tobj = 0;
|
||||
trapinfo.force_bungle = 0;
|
||||
}
|
||||
|
||||
/* Place a landmine/bear trap. Helge Hafting */
|
||||
STATIC_OVL void
|
||||
use_trap(otmp)
|
||||
|
||||
Reference in New Issue
Block a user