]> granicus.if.org Git - nethack/commitdiff
monsters taking possession of shop items
authornethack.rankin <nethack.rankin>
Sun, 16 Jan 2011 00:31:28 +0000 (00:31 +0000)
committernethack.rankin <nethack.rankin>
Sun, 16 Jan 2011 00:31:28 +0000 (00:31 +0000)
     Noticed while looking through steal.c:  theft that takes multiple
turns uses stealarm() callback which removes stolen armor from hero's
shopping bill, but theft that happened without delay did not.  So theft
of an unpaid non-armor or non-worn item while in a shop left it on the
bill where it wouldn't show up for either ``I u'' or ``I x'', hiding the
charge from the player ('$' did disclose the total amount that the shk
was owed though), and the shopkeeper would persist in blocking the door.
This makes immediate theft behave the same as delayed theft; the stolen
item is removed from shop's bill when the thieving monster takes it away
from the hero.

     Dropped items that a shopkeeper doesn't want have their no_charge
bit set; that's only supposed to be used for floor items inside shops.
But no_charge would stick when an object was picked up by a monster, so
the object would stay free for player if that monster was subsequently
killed in another shop which stocked that kind of item.  Probably never
noticed because most monsters won't pick up items off of shop floors,
also most levels don't have other shops dealing with alternate types of
stuff.  This clears no_charge, except when the monster picking up the
item is tame (so that a pet picking up and then dropping a no_change
object in the same shop won't cause the shk to silently take possession,
which would certainly lead to reports of a bug...).

doc/fixes34.4
src/steal.c

index 16f539ae1047abf38b0a145310bd38efc5b9067f..6ee51cc27724aec453ca5ad9231255d8b36051bc 100644 (file)
@@ -393,6 +393,7 @@ blanking items in pools while blind shouldn't reveal new obj description
        for ones which had been seen before becoming blind
 avoid infinite loop in topten output when killed by long-named monster
 grid bug could move diagonally 1 step using travel command
+unpaid shop items stolen from hero by a monster remained on hero's shop bill
 
 
 Platform- and/or Interface-Specific Fixes
index a852633985fbb04430cd57fe9727929193eae2da..fa1f49a326d04eb11d09f9441cd6a3441e7e1cda 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 steal.c $Date$  $Revision$ */
-/*     SCCS Id: @(#)steal.c    3.5     2008/11/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -469,6 +468,8 @@ gotobj:
         */
        mtmp->mavenge = 1;
 
+       if(otmp->unpaid)
+           subfrombill(otmp, shop_keeper(*u.ushops));
        freeinv(otmp);
        pline("%s stole %s.", named ? "She" : Monnam(mtmp), doname(otmp));
        could_petrify = (otmp->otyp == CORPSE &&
@@ -508,6 +509,9 @@ register struct obj *otmp;
            pline("%s out.", Tobjnam(otmp, "go"));
        snuff_otmp = TRUE;
     }
+    /* for hero owned object on shop floor, mtmp is taking possession
+       and if it's eventually dropped in a shop, shk will claim it */
+    if (!mtmp->mtame) otmp->no_charge = 0;
     /* Must do carrying effects on object prior to add_to_minv() */
     carry_obj_effects(otmp);
     /* add_to_minv() might free otmp [if merged with something else],
@@ -555,6 +559,8 @@ struct monst *mtmp;
     if (otmp) { /* we have something to snatch */
        if (otmp->owornmask)
            remove_worn_item(otmp, TRUE);
+       if(otmp->unpaid)
+           subfrombill(otmp, shop_keeper(*u.ushops));
        freeinv(otmp);
        /* mpickobj wont merge otmp because none of the above things
           to steal are mergable */