igniting unpaid potions of oil (trunk only)

From another many year old news posting:  if you picked up a stack
of potions of oil in a shop and then applied them, one potion was split
off and started burning but you were forced to pay for all of them.
Split the to-be-lit one off first so that the remainder of the stack
stays as ordinary unpaid shop goods.

     This also fixes an old bug with bill_dummy_object sometimes charging
a different price than the player got quoted when an object was picked up.
This commit is contained in:
nethack.rankin
2007-06-03 02:33:34 +00:00
parent 66f95ef37c
commit e08b97597c
3 changed files with 18 additions and 13 deletions

View File

@@ -465,11 +465,6 @@ struct obj *otmp;
* an object which is different from what it started out as; the "I x"
* command needs to display the original object.
*
* [BUG: The cost might end up being different if item originally had a
* surcharge but doesn't get one now or vice versa. Having the dummy keep
* the same o_id value as the original would avoid this; is that viable?
* (Mustn't give the original itself a new o_id, so can't just swap them.)]
*
* The caller is responsible for checking otmp->unpaid and
* costly_spot(u.ux, u.uy). This function will make otmp no charge.
*
@@ -481,9 +476,12 @@ bill_dummy_object(otmp)
register struct obj *otmp;
{
register struct obj *dummy;
long cost = 0L;
if (otmp->unpaid)
if (otmp->unpaid) {
cost = unpaid_cost(otmp, FALSE);
subfrombill(otmp, shop_keeper(*u.ushops));
}
dummy = newobj();
*dummy = *otmp;
dummy->oextra = (struct oextra *)0;
@@ -495,6 +493,7 @@ register struct obj *otmp;
if (has_omid(dummy)) free_omid(dummy); /* only one association with m_id*/
if (Is_candle(dummy)) dummy->lamplit = 0;
addtobill(dummy, FALSE, TRUE, TRUE);
if (cost) alter_cost(dummy, -cost);
/* no_charge is only valid for some locations */
otmp->no_charge = (otmp->where == OBJ_FLOOR ||
otmp->where == OBJ_CONTAINED) ? 1 : 0;