]> granicus.if.org Git - nethack/commitdiff
Fix up msgs when dropping obj on trapdoor
authorMichael Meyer <me@entrez.cc>
Wed, 11 Aug 2021 00:21:11 +0000 (20:21 -0400)
committerMichael Meyer <me@entrez.cc>
Wed, 11 Aug 2021 12:57:53 +0000 (08:57 -0400)
Messages for dropping an object on a trapdoor or hole seemed to
imply they still operate by the rules of a pit (that any object on the
same square as the trap is automatically inaccessible).  Since this is
no longer true for trapdoors and holes as of 1b7c372f, it seems
misleading to say an item "tumbles into the hole" even when it doesn't
fall through and stays on the current level.

Even for an item which really did fall through to the level below, these
messages were redundant since they were immediately followed by
near-identical messages from down_gate(dokick.c).

Limit the "tumbles into the pit" messages to pits only, and rely on the
standard down_gate message for items which fall through a trap door
or hole.

src/do.c

index 55ed926bf78f54583368db0d557bca0a6a209c73..802374eba5a500fa11639976318737234711d366 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -245,14 +245,17 @@ flooreffects(struct obj *obj, int x, int y, const char *verb)
         res = water_damage(obj, NULL, FALSE) == ER_DESTROYED;
     } else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0
                && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) {
-        if (Blind && !Deaf)
-            You_hear("%s tumble downwards.", the(xname(obj)));
-        else
-            pline("%s %s into %s %s.", The(xname(obj)),
-                  otense(obj, "tumble"), the_your[t->madeby_u],
-                  is_pit(t->ttyp) ? "pit" : "hole");
-        if (is_hole(t->ttyp) && ship_object(obj, x, y, FALSE))
+        if (is_pit(t->ttyp)) {
+            if (Blind && !Deaf)
+                You_hear("%s tumble downwards.", the(xname(obj)));
+            else
+                pline("%s into %s pit.", Tobjnam(obj, "tumble"),
+                      the_your[t->madeby_u]);
+        } else if (ship_object(obj, x, y, FALSE)) {
+            /* ship_object will print an appropriate "the item falls
+             * through the hole" message, so no need to do it here. */
             res = TRUE;
+        }
     } else if (obj->globby) {
         /* Globby things like puddings might stick together */
         while (obj && (otmp = obj_nexto_xy(obj, x, y, TRUE)) != 0) {