From: cohrs Date: Mon, 21 Jan 2002 03:25:50 +0000 (+0000) Subject: cost of eating an unpaid tin X-Git-Tag: MOVE2GIT~3410 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=371bbc2fb8ebb919e5021a6807b30d7d96f6c7f5;p=nethack cost of eating an unpaid tin 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. --- diff --git a/doc/fixes33.2 b/doc/fixes33.2 index 223921822..0ac6fc3d5 100644 --- a/doc/fixes33.2 +++ b/doc/fixes33.2 @@ -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 diff --git a/src/eat.c b/src/eat.c index 001cd09e3..2bf3c3997 100644 --- 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);