From: PatR Date: Sat, 21 Oct 2017 01:31:07 +0000 (-0700) Subject: boulder pickup: contradictory message sequence X-Git-Tag: NetHack-3.6.1_RC01~247 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08a3297f6466a435a76461e49eb60fde89ebca49;p=nethack boulder pickup: contradictory message sequence Poly'd into a giant with a full inventory that already contains at least one boulder, moving onto a boulder (that can't be pushed due to a wall or other obstacle) yielded You try to move the boulder, but in vain. However, you can easily pick it up. You are carrying too much stuff to pick up another boulder. You see here a boulder. The second and third statements contradict each other. Make the code that dishes out the second message smarter. If autopickup is set for it and you will pick up the boulder: However, you easily pick it up. If autopickup is not set for it but would have worked if it was: However, you could easily pick it up. If your inventory is full and you have a boulder (or are in Sokoban) However, you easily push it aside. That last one is instead of "however, you can squeeze yourself into a small opening" that you'd get if not a giant and not carrying much. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 2b20433be..7403cbaf4 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -457,6 +457,9 @@ hero could "pronounce the words on the scroll" when blind (if its label is known) even while being strangled at the time hero could cast spells while poly'd into a form which can't speak (or grunt,&c) or while being strangled +when poly'd into a giant and moving onto a boulder's spot, you could get "you + try to move the boulder, but in vain", "however, you can easily pick + it up", "you are carrying too much stuff to pick up another boulder" Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index abc38311b..bc1c183ab 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1508479720 2017/10/20 06:08:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.618 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1508549428 2017/10/21 01:30:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.619 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1830,6 +1830,7 @@ E int FDECL(use_container, (struct obj **, int, BOOLEAN_P)); E int FDECL(loot_mon, (struct monst *, int *, boolean *)); E int NDECL(dotip); E boolean FDECL(is_autopickup_exception, (struct obj *, BOOLEAN_P)); +E boolean FDECL(autopick_testobj, (struct obj *, BOOLEAN_P)); /* ### pline.c ### */ diff --git a/src/hack.c b/src/hack.c index 1aabddbdc..64bc25e3b 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1496619131 2017/06/04 23:32:11 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.175 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1508549436 2017/10/21 01:30:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.180 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -315,14 +315,30 @@ moverock() feel_location(sx, sy); cannot_push: if (throws_rocks(youmonst.data)) { + boolean + canpickup = (!Sokoban + /* similar exception as in can_lift(): + when poly'd into a giant, you can + pick up a boulder if you have a free + slot or into the overflow ('#') slot + unless already carrying at least one */ + && (inv_cnt(FALSE) < 52 || !carrying(BOULDER))), + willpickup = (canpickup && autopick_testobj(otmp, TRUE)); + if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) { You("aren't skilled enough to %s %s from %s.", - (flags.pickup && !Sokoban) ? "pick up" : "push aside", + willpickup ? "pick up" : "push aside", the(xname(otmp)), y_monnam(u.usteed)); } else { - pline("However, you can easily %s.", - (flags.pickup && !Sokoban) ? "pick it up" - : "push it aside"); + /* + * willpickup: you easily pick it up + * canpickup: you could easily pick it up + * otherwise: you easily push it aside + */ + pline("However, you %seasily %s.", + (willpickup || !canpickup) ? "" : "could ", + (willpickup || canpickup) ? "pick it up" + : "push it aside"); sokoban_guilt(); break; } diff --git a/src/pickup.c b/src/pickup.c index 56ff922f9..aa147080b 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1498078877 2017/06/21 21:01:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.185 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1508549438 2017/10/21 01:30:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.192 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -21,7 +21,6 @@ STATIC_DCL boolean FDECL(all_but_uchain, (struct obj *)); #if 0 /* not used */ STATIC_DCL boolean FDECL(allow_cat_no_uchain, (struct obj *)); #endif -STATIC_DCL boolean FDECL(autopick_testobj, (struct obj *, BOOLEAN_P)); STATIC_DCL int FDECL(autopick, (struct obj *, int, menu_item **)); STATIC_DCL int FDECL(count_categories, (struct obj *, int)); STATIC_DCL long FDECL(carry_count, (struct obj *, struct obj *, long, @@ -743,7 +742,7 @@ boolean grab; /* forced pickup, rather than forced leave behind? */ return FALSE; } -STATIC_OVL boolean +boolean autopick_testobj(otmp, calc_costly) struct obj *otmp; boolean calc_costly;