From 14007e94834b2d77505f2c3043706ff168d7265b Mon Sep 17 00:00:00 2001 From: Patric Mueller Date: Fri, 26 Aug 2022 21:36:42 +0200 Subject: [PATCH] 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. --- doc/fixes3-7-0.txt | 1 + src/objnam.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 7a88b4446..131620155 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1016,6 +1016,7 @@ monsters which cannot move due to boulders or walls try to escape intelligent monsters see and remember when others trigger traps random figurines are of harder monsters monsters can blind you with a camera +lit candles generated by wishing could have wrong light radius Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index fba567353..08406c627 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -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;