Correct timing when attaching lit candles to the candelabrum
Before this commit, attaching a lit candle would reduce the amount of fuel in the candelabrum to 0, 15 or 75 turns due to a failure to account for time stored in the candle's burn timer. Fixing this is very important because a time of 0 turns on the candelabrum is not supposed to be possible.
This commit is contained in:
@@ -84,6 +84,9 @@ when Punished and carrying the iron ball and levitating, hurtling in the
|
|||||||
opposite direction of a thrown object didn't bring along the chain
|
opposite direction of a thrown object didn't bring along the chain
|
||||||
recognize "kirin" as alias for "ki-rin" when asked to create a monster
|
recognize "kirin" as alias for "ki-rin" when asked to create a monster
|
||||||
make unique swallowing monsters (Juiblex) resist magical digging from inside
|
make unique swallowing monsters (Juiblex) resist magical digging from inside
|
||||||
|
correctly account for fuel remaining when lit candles are attached
|
||||||
|
to candelabrum (the previous code would make the game unwinnable if
|
||||||
|
there were 15 or fewer turns remaining)
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
17
src/apply.c
17
src/apply.c
@@ -1215,12 +1215,14 @@ struct obj **optr;
|
|||||||
register struct obj *otmp;
|
register struct obj *otmp;
|
||||||
const char *s = (obj->quan != 1) ? "candles" : "candle";
|
const char *s = (obj->quan != 1) ? "candles" : "candle";
|
||||||
char qbuf[QBUFSZ], qsfx[QBUFSZ], *q;
|
char qbuf[QBUFSZ], qsfx[QBUFSZ], *q;
|
||||||
|
boolean was_lamplit;
|
||||||
|
|
||||||
if (u.uswallow) {
|
if (u.uswallow) {
|
||||||
You(no_elbow_room);
|
You(no_elbow_room);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* obj is the candle; otmp is the candelabrum */
|
||||||
otmp = carrying(CANDELABRUM_OF_INVOCATION);
|
otmp = carrying(CANDELABRUM_OF_INVOCATION);
|
||||||
if (!otmp || otmp->spe == 7) {
|
if (!otmp || otmp->spe == 7) {
|
||||||
use_lamp(obj);
|
use_lamp(obj);
|
||||||
@@ -1247,14 +1249,23 @@ struct obj **optr;
|
|||||||
s = (obj->quan != 1) ? "candles" : "candle";
|
s = (obj->quan != 1) ? "candles" : "candle";
|
||||||
} else
|
} else
|
||||||
*optr = 0;
|
*optr = 0;
|
||||||
|
|
||||||
|
/* The candle's age field doesn't correctly reflect the amount
|
||||||
|
of fuel in it while it's lit, because the fuel is measured
|
||||||
|
by the timer. So to get accurate age updating, we need to
|
||||||
|
end the burn temporarily while attaching the candle. */
|
||||||
|
was_lamplit = obj->lamplit;
|
||||||
|
if (was_lamplit)
|
||||||
|
end_burn(obj, TRUE);
|
||||||
|
|
||||||
You("attach %ld%s %s to %s.", obj->quan, !otmp->spe ? "" : " more", s,
|
You("attach %ld%s %s to %s.", obj->quan, !otmp->spe ? "" : " more", s,
|
||||||
the(xname(otmp)));
|
the(xname(otmp)));
|
||||||
if (!otmp->spe || otmp->age > obj->age)
|
if (!otmp->spe || otmp->age > obj->age)
|
||||||
otmp->age = obj->age;
|
otmp->age = obj->age;
|
||||||
otmp->spe += (int) obj->quan;
|
otmp->spe += (int) obj->quan;
|
||||||
if (otmp->lamplit && !obj->lamplit)
|
if (otmp->lamplit && !was_lamplit)
|
||||||
pline_The("new %s magically %s!", s, vtense(s, "ignite"));
|
pline_The("new %s magically %s!", s, vtense(s, "ignite"));
|
||||||
else if (!otmp->lamplit && obj->lamplit)
|
else if (!otmp->lamplit && was_lamplit)
|
||||||
pline("%s out.", (obj->quan > 1L) ? "They go" : "It goes");
|
pline("%s out.", (obj->quan > 1L) ? "They go" : "It goes");
|
||||||
if (obj->unpaid)
|
if (obj->unpaid)
|
||||||
verbalize("You %s %s, you bought %s!",
|
verbalize("You %s %s, you bought %s!",
|
||||||
@@ -1268,8 +1279,6 @@ struct obj **optr;
|
|||||||
if (otmp->lamplit)
|
if (otmp->lamplit)
|
||||||
obj_merge_light_sources(otmp, otmp);
|
obj_merge_light_sources(otmp, otmp);
|
||||||
/* candles are no longer a separate light source */
|
/* candles are no longer a separate light source */
|
||||||
if (obj->lamplit)
|
|
||||||
end_burn(obj, TRUE);
|
|
||||||
/* candles are now gone */
|
/* candles are now gone */
|
||||||
useupall(obj);
|
useupall(obj);
|
||||||
/* candelabrum's weight is changing */
|
/* candelabrum's weight is changing */
|
||||||
|
|||||||
Reference in New Issue
Block a user