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
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 *));
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)
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)
-/* 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. */
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
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 */
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