]> granicus.if.org Git - nethack/commitdiff
fix shop ownership of saddle dropped by dead pet (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 9 Jul 2011 02:56:38 +0000 (02:56 +0000)
committernethack.rankin <nethack.rankin>
Sat, 9 Jul 2011 02:56:38 +0000 (02:56 +0000)
     From a bug report, you could obtain
a saddle for free if it was dropped (while worn) by a dying pet inside a
shop.  That's intentional, but it was happening even when the hero was
not in the shop, which doesn't seem right.  Change things to only set it
no_charge if hero is within the same shop (including standing in the
doorway or a temporary wall breach, not just when all the way inside) at
the time of the drop.

doc/fixes35.0
src/steal.c

index a7b12e7ccfaa1d8f94f0e69d30b73f7631f455c4..c5b9a898ee21aa7a3237bead28746cbcc60acd1a 100644 (file)
@@ -364,6 +364,8 @@ surviving in lava boils away carried potions, but dying in lava and being
        life-saved or leaving bones would keep them intact
 when applicable, give "your body rises from the dead as an <undead>..."
        even when bones data isn't being saved
+have shk claim ownership of worn saddle dropped by dying pet if hero is
+       not within the same shop at the time of the drop
 
 
 Platform- and/or Interface-Specific Fixes
index bfe773572d9294010786a2a66cb8a6070cb1ebc3..32ffbf0033adca09269307d28006453add9fb971 100644 (file)
@@ -631,9 +631,12 @@ boolean verbosely;
            mon->misc_worn_check &= ~obj->owornmask;
            update_mon = TRUE;
 #ifdef STEED
-       /* don't charge for an owned saddle on dead steed */
+       /* don't charge for an owned saddle on dead steed (provided
+          that the hero is within the same shop at the time) */
        } else if (mon->mtame && (obj->owornmask & W_SADDLE) && 
-               !obj->unpaid && costly_spot(omx, omy)) {
+               !obj->unpaid && costly_spot(omx, omy) &&
+               /* being at a costly_spot guarantees lev->roomno is not 0 */
+               index(in_rooms(u.ux, u.uy, SHOPBASE), levl[omx][omy].roomno)) {
            obj->no_charge = 1;
 #endif
        }