fix #K3251 - "some bugs: empty lamp catching fire"
If an empty lamp was hit by fire, the feedback was "the lamp catches fire!" even though it wouldn't light. ingite_items() imperfectly duplicated catch_lit(). Just call the latter. The resulting message will be slightly different but that's insignificant.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.430 $ $NHDT-Date: 1611104371 2021/01/20 00:59:31 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.431 $ $NHDT-Date: 1611182248 2021/01/20 22:37:28 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -368,6 +368,8 @@ give barrow wights a cold touch
|
||||
for configuration using external compression on save files that applied a name
|
||||
suffix, 'selectsaved' (restore via menu) couldn't handle any which had
|
||||
been manually uncompressed, mangling file name trying to remove suffix
|
||||
an empty lamp hit by fire reported "the oil lamp catches fire" (but at least
|
||||
didn't light)
|
||||
|
||||
|
||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||
|
||||
34
src/apply.c
34
src/apply.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 apply.c $NHDT-Date: 1605184220 2020/11/12 12:30:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.331 $ */
|
||||
/* NetHack 3.7 apply.c $NHDT-Date: 1611182249 2021/01/20 22:37:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.337 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1414,28 +1414,36 @@ struct obj *obj;
|
||||
{
|
||||
xchar x, y;
|
||||
|
||||
if (!obj->lamplit && ignitable(obj)) {
|
||||
if ((obj->otyp == MAGIC_LAMP
|
||||
|| obj->otyp == CANDELABRUM_OF_INVOCATION) && obj->spe == 0)
|
||||
return FALSE;
|
||||
else if (obj->otyp != MAGIC_LAMP && obj->age == 0)
|
||||
return FALSE;
|
||||
if (!get_obj_location(obj, &x, &y, 0))
|
||||
if (!obj->lamplit && ignitable(obj) && get_obj_location(obj, &x, &y, 0)) {
|
||||
if (((obj->otyp == MAGIC_LAMP /* spe==0 => no djinni inside */
|
||||
/* spe==0 => no candles attached */
|
||||
|| obj->otyp == CANDELABRUM_OF_INVOCATION) && obj->spe == 0)
|
||||
/* age_is_relative && age==0 && still-exists means out of fuel */
|
||||
|| (age_is_relative(obj) && obj->age == 0)
|
||||
/* lantern is classified as ignitable() but not by fire */
|
||||
|| obj->otyp == BRASS_LANTERN)
|
||||
return FALSE;
|
||||
if (obj->otyp == CANDELABRUM_OF_INVOCATION && obj->cursed)
|
||||
return FALSE;
|
||||
if ((obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
|
||||
|| obj->otyp == BRASS_LANTERN) && obj->cursed && !rn2(2))
|
||||
if ((obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP)
|
||||
/* once lit, cursed lamp is as good as non-cursed one, so failure
|
||||
to light is a minor inconvenience to make cursed be worse */
|
||||
&& obj->cursed && !rn2(2))
|
||||
return FALSE;
|
||||
if (obj->where == OBJ_MINVENT ? cansee(x, y) : !Blind)
|
||||
pline("%s %s light!", Yname2(obj), otense(obj, "catch"));
|
||||
|
||||
if (obj->where == OBJ_INVENT || cansee(x, y))
|
||||
pline("%s %s %s", Yname2(obj),
|
||||
/* "catches light!" or "feels warm." */
|
||||
otense(obj, Blind ? "feel" : "catch"),
|
||||
Blind ? "warm." : "light!");
|
||||
if (obj->otyp == POT_OIL)
|
||||
makeknown(obj->otyp);
|
||||
if (carried(obj) && obj->unpaid && costly_spot(u.ux, u.uy)) {
|
||||
/* if it catches while you have it, then it's your tough luck */
|
||||
check_unpaid(obj);
|
||||
verbalize("That's in addition to the cost of %s %s, of course.",
|
||||
yname(obj), obj->quan == 1L ? "itself" : "themselves");
|
||||
yname(obj),
|
||||
(obj->quan == 1L) ? "itself" : "themselves");
|
||||
bill_dummy_object(obj);
|
||||
}
|
||||
begin_burn(obj, FALSE);
|
||||
|
||||
42
src/trap.c
42
src/trap.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 trap.c $NHDT-Date: 1606558763 2020/11/28 10:19:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.367 $ */
|
||||
/* NetHack 3.7 trap.c $NHDT-Date: 1611182256 2021/01/20 22:37:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.398 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -5944,44 +5944,20 @@ boolean override;
|
||||
return defsyms[trap_to_defsym(ttyp)].explanation;
|
||||
}
|
||||
|
||||
/* Ignite ignitable items in the given object chain, due to some external
|
||||
* source of fire. The object chain should be somewhere exposed, like
|
||||
* someone's open inventory or the floor.
|
||||
* This is modeled after destroy_item() somewhat and hopefully will be able to
|
||||
* merge into it in the future.
|
||||
*/
|
||||
/* Ignite ignitable items (limited to light sources) in the given object
|
||||
chain, due to some external source of fire. The object chain should
|
||||
be somewhere exposed, like someone's open inventory or the floor. */
|
||||
void
|
||||
ignite_items(objchn)
|
||||
struct obj *objchn;
|
||||
{
|
||||
struct obj *obj;
|
||||
boolean vis = FALSE;
|
||||
if (!objchn)
|
||||
return;
|
||||
boolean bynexthere = (objchn && objchn->where == OBJ_FLOOR);
|
||||
|
||||
if (objchn->where == OBJ_INVENT)
|
||||
vis = TRUE; /* even when blind; lit-state can be seen in inventory */
|
||||
else if (objchn->where == OBJ_MINVENT)
|
||||
vis = canseemon(objchn->ocarry);
|
||||
else if (objchn->where == OBJ_FLOOR)
|
||||
vis = cansee(objchn->ox, objchn->oy);
|
||||
else {
|
||||
impossible("igniting item in a weird location %d", objchn->where);
|
||||
return;
|
||||
}
|
||||
|
||||
for (obj = objchn; obj; obj = obj->nobj) {
|
||||
if (!ignitable(obj)
|
||||
/* The Candelabrum requires intention to be lit */
|
||||
|| obj->otyp == CANDELABRUM_OF_INVOCATION
|
||||
|| obj->otyp == BRASS_LANTERN /* doesn't ignite via fire */
|
||||
|| obj->in_use /* not available */
|
||||
|| obj->lamplit) { /* already burning */
|
||||
continue;
|
||||
}
|
||||
begin_burn(obj, FALSE);
|
||||
if (vis)
|
||||
pline("%s on fire!", Yobjnam2(obj, "catch"));
|
||||
for (obj = objchn; obj; obj = bynexthere ? obj->nexthere : obj->nobj) {
|
||||
/* ignitable items like lamps and candles will catch fire */
|
||||
if (!obj->lamplit && !obj->in_use)
|
||||
catch_lit(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user