fix github issue #279 - boulder feedback

Polymophed into a giant and moving onto a boulder's location could
yield "you easily pick it up" (without actually doing so) followed
by "you see a boulder here".  It would happen if autopickup was Off,
or if the 'm' move-without-autopickup prefix was used, while either
boulder was included in pickup_types (including when that is set
for 'all') or hero had thrown that particular boulder and
pickup_thrown was On.  The check for whether auto-pick should try
on an object relied on its caller verifying that autopickup was On.
pickup() does that for
 pickup() -> autopick() -> autopick_testobj()
but moverock() wasn't doing that for
 moverock() -> autopick_testobj()
so the logic controlling moverock's message was subverted.

I first thought that logic itself was incorrect and changed the
message.  This keeps the new message even though it turned out not
to be cause of the problem.

Fixes #279
This commit is contained in:
PatR
2020-01-12 05:05:24 -08:00
parent 1efc2d8e5e
commit 07a2c1c813
2 changed files with 20 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.62 $ $NHDT-Date: 1578764038 2020/01/11 17:33:58 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.63 $ $NHDT-Date: 1578834315 2020/01/12 13:05:15 $
General Fixes and Modified Features
-----------------------------------
@@ -42,6 +42,8 @@ walking out of tethered-to-buried-object trap condition was supposed to
reinstate punishment but wasn't finding the buried iron ball because
the trap condition was cleared first to indicate escape; result was
attached chain that got dragged around but had no ball attached
when poly'd into a giant and moving onto a boulder's spot, message given was
confused about whether autopickup would occur so could be misleading
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 hack.c $NHDT-Date: 1578690701 2020/01/10 21:11:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.240 $ */
/* NetHack 3.6 hack.c $NHDT-Date: 1578834315 2020/01/12 13:05:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.241 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -340,7 +340,8 @@ moverock()
slot or into the overflow ('#') slot
unless already carrying at least one */
&& (inv_cnt(FALSE) < 52 || !carrying(BOULDER))),
willpickup = (canpickup && autopick_testobj(otmp, TRUE));
willpickup = (canpickup && flags.pickup
&& autopick_testobj(otmp, TRUE));
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) {
You("aren't skilled enough to %s %s from %s.",
@@ -348,14 +349,21 @@ moverock()
the(xname(otmp)), y_monnam(u.usteed));
} else {
/*
* willpickup: you easily pick it up
* canpickup: you could easily pick it up
* otherwise: you easily push it aside
* will pick up: you easily pick it up
* can but won't: you manuver over it and could pick it up
* can't pick up: you manuver over it (possibly followed
* by feedback from failed auto-pickup attempt)
*/
pline("However, you %seasily %s.",
(willpickup || !canpickup) ? "" : "could ",
(willpickup || canpickup) ? "pick it up"
: "push it aside");
pline("However, you %s%s.",
willpickup ? "easily pick it up"
: "manuver over it",
(canpickup && !willpickup)
? " and could pick it up"
: "");
/* similar to dropping everything and squeezing onto
a Sokoban boulder's spot, moving to same breaks the
Sokoban rules because on next step you could go
past it without pushing it to plug a pit or hole */
sokoban_guilt();
break;
}