]> granicus.if.org Git - nethack/commitdiff
cost of eating an unpaid tin
authorcohrs <cohrs>
Mon, 21 Jan 2002 03:25:50 +0000 (03:25 +0000)
committercohrs <cohrs>
Mon, 21 Jan 2002 03:25:50 +0000 (03:25 +0000)
The cost of an unpaid tin should be calculated before eating, not after,
so the cost will be based on your pre-eating hunger, not post.

doc/fixes33.2
src/eat.c

index 2239218220c93216c05c975b0f50028813244e7d..0ac6fc3d5617d119cea947df49fd998bdbd89793 100644 (file)
@@ -398,6 +398,7 @@ pets should not try to go after food that they can't reach
 monsters shouldn't use wands of digging in Sokoban
 objects dropped in or travelling across java pools can take damage
 monsters that enter lava can take damage
+eating an unpaid tin should calculate cost before not after eating
 
 
 Platform- and/or Interface-Specific Fixes
index 001cd09e3c76bcbde237c36b5d93b11815fae450..2bf3c3997a8b7eb5082012f12591a4c009233725 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1014,6 +1014,13 @@ opentin()                /* called during each move whilst opening a tin */
            tin.tin->dknown = tin.tin->known = TRUE;
            cprefx(tin.tin->corpsenm); cpostfx(tin.tin->corpsenm);
 
+           if(((!carried(tin.tin) && costly_spot(tin.tin->ox, tin.tin->oy) &&
+                !tin.tin->no_charge)
+               || tin.tin->unpaid)) {
+               verbalize("You open it, you bought it!");
+               bill_dummy_object(tin.tin);
+           }
+
            /* check for vomiting added by GAN 01/16/87 */
            if(tintxts[r].nut < 0) make_vomiting((long)rn1(15,10), FALSE);
            else lesshungry(tintxts[r].nut);
@@ -1038,6 +1045,15 @@ opentin()                /* called during each move whilst opening a tin */
                    You("discard the open tin.");
                goto use_me;
            }
+
+           tin.tin->dknown = tin.tin->known = TRUE;
+           if(((!carried(tin.tin) && costly_spot(tin.tin->ox, tin.tin->oy) &&
+                !tin.tin->no_charge)
+               || tin.tin->unpaid)) {
+               verbalize("You open it, you bought it!");
+               bill_dummy_object(tin.tin);
+           }
+
            if (!tin.tin->cursed)
                pline("This makes you feel like %s!",
                      Hallucination ? "Swee'pea" : "Popeye");
@@ -1045,7 +1061,6 @@ opentin()         /* called during each move whilst opening a tin */
            gainstr(tin.tin, 0);
            u.uconduct.food++;
        }
-       tin.tin->dknown = tin.tin->known = TRUE;
 use_me:
        if (carried(tin.tin)) useup(tin.tin);
        else useupf(tin.tin, 1L);