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

@@ -1265,6 +1265,7 @@ light_cocktail(obj)
struct obj *obj; /* obj is a potion of oil */
{
char buf[BUFSZ];
boolean split1off;
if (u.uswallow) {
You(no_elbow_room);
@@ -1287,8 +1288,12 @@ light_cocktail(obj)
return;
}
split1off = (obj->quan > 1L);
if (split1off) obj = splitobj(obj, 1L);
You("light %spotion.%s", shk_your(buf, obj),
Blind ? "" : " It gives off a dim light.");
if (obj->unpaid && costly_spot(u.ux, u.uy)) {
/* Normally, we shouldn't both partially and fully charge
* for an item, but (Yendorian Fuel) Taxes are inevitable...
@@ -1299,16 +1304,14 @@ light_cocktail(obj)
}
makeknown(obj->otyp);
if (obj->quan > 1L) {
obj = splitobj(obj, 1L);
begin_burn(obj, FALSE); /* burn before free to get position */
begin_burn(obj, FALSE); /* after shop billing */
if (split1off) {
obj_extract_self(obj); /* free from inv */
/* shouldn't merge */
obj->nomerge = 1;
obj = hold_another_object(obj, "You drop %s!",
doname(obj), (const char *)0);
} else
begin_burn(obj, FALSE);
if (obj) obj->nomerge = 0;
}
}
static NEARDATA const char cuddly[] = { TOOL_CLASS, GEM_CLASS, 0 };