"partly used candle" fix

If you wished for "lit candle" you'd get an unused candle that
is pre-lit but the feedback as it's added to inventory would be
"partly used candle (lit)".  If snuffed out immediately, it reverts
to "candle" (ie, not partly used).

This fixes the first aspect:  you will get "candle (lit)" added to
inventory.  On the next turn it changes to partly used as expected.
The second aspect, reverting to not-used-yet after being lit during
the wish is left as-is.
This commit is contained in:
PatR
2023-12-23 16:15:38 -08:00
parent 4f96accfb1
commit 35eb289cc3
2 changed files with 21 additions and 3 deletions

View File

@@ -1335,6 +1335,8 @@ riding negates stealth unless the steed is flying
previous hero rising as undead in bones retains intrinsics
level temperature affects monster generation
amulet of unchanging cannot be polymorphed
wishing for a "lit candle" provided one, but the feedback as it was added into
invent was "partly used candle (lit)" because of how 'lit' timer works
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -1293,9 +1293,25 @@ doname_base(
break;
} else if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
|| obj->otyp == BRASS_LANTERN || Is_candle(obj)) {
if (Is_candle(obj)
&& obj->age < 20L * (long) objects[obj->otyp].oc_cost)
Strcat(prefix, "partly used ");
if (Is_candle(obj)) {
anything timer;
long full_burn_time = 20L * (long) objects[obj->otyp].oc_cost,
turns_left = obj->age;
if (obj->lamplit) {
timer = cg.zeroany;
timer.a_obj = obj;
/* without this, wishing for "lit candle" yields
"partly used candle (lit)" because the time it can
burn gets adjusted when it becomes lit; matters for
the message as it gets added to invent and also if it
gets snuffed out immediately (where it will end up as
not partly used after all) */
turns_left += peek_timer(BURN_OBJECT, &timer) - gm.moves;
}
if (turns_left < full_burn_time)
Strcat(prefix, "partly used ");
}
if (obj->lamplit)
Strcat(bp, " (lit)");
break;