diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 9b40d87f6..cdfdb46e2 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -53,6 +53,7 @@ dipping fruit juice into enlightenment gave different result than the inverse make travel walk up to a trap and stop when the trap blocks the only way forward, instead of trying to go straight line travel will displace pets rather than stop +discard travel cache when moving to a different dungeon level do not autopickup unpaid items in shops death due an unseen gas spore's explosion resulted in "killed by a died" allow optional parameter "true", "yes", "false", or "no" for boolean options diff --git a/include/extern.h b/include/extern.h index 3d9c6c5f4..1a20b24f2 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1013,6 +1013,7 @@ E boolean FDECL(picking_lock, (int *, int *)); E boolean FDECL(picking_at, (int, int)); E void FDECL(breakchestlock, (struct obj *, BOOLEAN_P)); E void NDECL(reset_pick); +E void NDECL(maybe_reset_pick); E int FDECL(pick_lock, (struct obj *)); E int NDECL(doforce); E boolean FDECL(boxlock, (struct obj *, struct obj *)); diff --git a/src/apply.c b/src/apply.c index 24db211d3..544619b94 100644 --- a/src/apply.c +++ b/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) diff --git a/src/do.c b/src/do.c index 5efa0da87..2cbfa3660 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1454033599 2016/01/29 02:13:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.153 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1464487100 2016/05/29 01:58:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.156 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1523,13 +1523,20 @@ boolean at_stairs, falling, portal; save_currentstate(); #endif - if ((annotation = get_annotation(&u.uz))) + if ((annotation = get_annotation(&u.uz)) != 0) You("remember this level as %s.", annotation); /* assume this will always return TRUE when changing level */ (void) in_out_region(u.ux, u.uy); (void) pickup(1); - context.polearm.hitmon = NULL; + + /* discard context which applied to previous level */ + maybe_reset_pick(); /* for door or for box not accompanying hero */ + reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */ + iflags.travelcc.x = iflags.travelcc.y = -1; /* travel destination cache */ + context.polearm.hitmon = (struct monst *) 0; /* polearm target */ + /* digging context is level-aware and can actually be resumed if + hero returns to the previous level without any intervening dig */ } STATIC_OVL void diff --git a/src/lock.c b/src/lock.c index 16f1c63b1..f899f9a0b 100644 --- a/src/lock.c +++ b/src/lock.c @@ -75,7 +75,8 @@ STATIC_PTR int picklock(VOID_ARGS) { if (xlock.box) { - if ((xlock.box->ox != u.ux) || (xlock.box->oy != u.uy)) { + if (xlock.box->where != OBJ_FLOOR + || xlock.box->ox != u.ux || xlock.box->oy != u.uy) { return ((xlock.usedtime = 0)); /* you or it moved */ } } else { /* door */ @@ -228,6 +229,14 @@ reset_pick() xlock.box = 0; } +/* level change; don't reset if hero is carrying xlock.box with him/her */ +void +maybe_reset_pick() +{ + if (!xlock.box || !carried(xlock.box)) + reset_pick(); +} + /* for doapply(); if player gives a direction or resumes an interrupted previous attempt then it costs hero a move even if nothing ultimately happens; when told "can't do that" before being asked for direction