]> granicus.if.org Git - nethack/commitdiff
boulder pickup: contradictory message sequence
authorPatR <rankin@nethack.org>
Sat, 21 Oct 2017 01:31:07 +0000 (18:31 -0700)
committerPatR <rankin@nethack.org>
Sat, 21 Oct 2017 01:31:07 +0000 (18:31 -0700)
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.

doc/fixes36.1
include/extern.h
src/hack.c
src/pickup.c

index 2b20433be00ff513eba0c4ce51629502d9e426b0..7403cbaf413f8c035cce9080901fdd6645ec2379 100644 (file)
@@ -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
index abc38311ba14ce187aec4324cb17b29622b8c118..bc1c183ab77726df5ca614d6cd53b34d6c2401ff 100644 (file)
@@ -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 ### */
 
index 1aabddbdc2c187c1a7211ae8b8cbf369f60a735e..64bc25e3b4e002834f5fd3a78655e31b0f0fb7c0 100644 (file)
@@ -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;
                 }
index 56ff922f9f27ec448d4698477273f0e343c2c405..aa147080bad75d189c2a73d3c963b560fb29684d 100644 (file)
@@ -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;