lit candles generated by wishing could have wrong light radius

begin_burn() was called before the quantity of wished lit candles was
restricted which meant that the light source radius could depend on a
larger quantity than the final object actually had.
This commit is contained in:
Patric Mueller
2022-08-26 21:36:42 +02:00
parent d5abf903fa
commit 14007e9483
2 changed files with 9 additions and 8 deletions

View File

@@ -4590,14 +4590,6 @@ readobjnam(char *bp, struct obj *no_wish)
d.otmp = d.typ ? mksobj(d.typ, TRUE, FALSE) : mkobj(d.oclass, FALSE);
d.typ = d.otmp->otyp, d.oclass = d.otmp->oclass; /* what we actually got */
if (d.islit && (d.typ == OIL_LAMP || d.typ == MAGIC_LAMP
|| d.typ == BRASS_LANTERN
|| Is_candle(d.otmp) || d.typ == POT_OIL)) {
place_object(d.otmp, u.ux, u.uy); /* make it viable light source */
begin_burn(d.otmp, FALSE);
obj_extract_self(d.otmp); /* now release it for caller's use */
}
/* if player specified a reasonable count, maybe honor it;
quantity for gold is handled elsewhere and d.cnt is 0 for it here */
if (d.otmp->globby) {
@@ -4644,6 +4636,14 @@ readobjnam(char *bp, struct obj *no_wish)
d.otmp->quan = (long) d.cnt;
}
if (d.islit && (d.typ == OIL_LAMP || d.typ == MAGIC_LAMP
|| d.typ == BRASS_LANTERN
|| Is_candle(d.otmp) || d.typ == POT_OIL)) {
place_object(d.otmp, u.ux, u.uy); /* make it viable light source */
begin_burn(d.otmp, FALSE);
obj_extract_self(d.otmp); /* now release it for caller's use */
}
if (d.spesgn == 0) {
/* spe not specifed; retain the randomly assigned value */
d.spe = d.otmp->spe;