]> granicus.if.org Git - nethack/commitdiff
fix #K3440/github issue #586 - losing object info
authorPatR <rankin@nethack.org>
Wed, 8 Sep 2021 00:50:50 +0000 (17:50 -0700)
committerPatR <rankin@nethack.org>
Wed, 8 Sep 2021 00:50:50 +0000 (17:50 -0700)
when an unseen monster picks up an item that the hero knows some
things about.  That's intentional, but vision is turned off while
engulfed so throwing or dropping something while swallowed always
treated it as being handled by an unseen monster.

If hero is swallowed or held by a monster or poly'd and holding a
monster, behave as it the monster can 'seen' by touch when items are
added to its inventory.

Closes #586

doc/fixes37.0
src/steal.c

index 09abc5aea3d9115ac587fbffeb7246147d795b2d..a4eef3c3831269d0d272b713e7605bd2b285bc74 100644 (file)
@@ -800,6 +800,8 @@ if hero died while wearing gold dragon scales/mail and left bones, they would
        still be emitting light witout being worn when bones got loaded
 if an invisible monster put on or took off armor while out of hero's sight
        spurious message "Suddenly you cannot see it" would be given
+an item thrown or dropped while swallowed was treated as being picked up by an
+       unseen monster so object fields {known, dknown, bknown} got cleared
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 0094fe4208cbd6fe662f18d8af92cab7473e65dd..970f0f8af149ee202070efa80da4df06a126a8c6 100644 (file)
@@ -529,8 +529,10 @@ mpickobj(register struct monst* mtmp, register struct obj* otmp)
         otmp->no_charge = 0;
     /* if monster is unseen, info hero knows about this object becomes lost;
        continual pickup and drop by pets makes this too annoying if it is
-       applied to them */
-    if (!mtmp->mtame && !canseemon(mtmp))
+       applied to them; when engulfed (where monster can't be seen because
+       vision is disabled), or when held (or poly'd and holding) while blind,
+       behave as if the monster can be 'seen' by touch */
+    if (!mtmp->mtame && !(canseemon(mtmp) || mtmp == u.ustuck))
         unknow_object(otmp);
     /* Must do carrying effects on object prior to add_to_minv() */
     carry_obj_effects(otmp);