fix #Q108 - adding candles to Candelabrum while underwater

From a bug report, but just received:
you can't affix candles to the candelabrum while underwater, because the
underwater check (can't light candles while underwater) is made too soon.
If you somehow managed to get a lit lamp, candle, or candelabrum while
underwater, you wouldn't be able to extinguish it for same reason.  The
bug report included a URL for a fix, but I didn't look at that.  This
changes use_candle() to rely on use_lamp() for underwater handling, and
changes use_lamp() and use_candelabrum() to check for extinguishing
before making the underwater check.
This commit is contained in:
nethack.rankin
2007-02-04 05:34:59 +00:00
parent 0f0f7190f3
commit 8465f87d2f
2 changed files with 11 additions and 13 deletions

View File

@@ -302,6 +302,7 @@ don't access freed memory after engraving "wrests one last charnge" from wand
a magic portal could be rendered inactive for the hero if a successful a magic portal could be rendered inactive for the hero if a successful
hangup save took place during level change; leaving the level by any hangup save took place during level change; leaving the level by any
means other than triggering the portal would reactivate it means other than triggering the portal would reactivate it
hero wasn't allowed to affix candles to the candelabrum while underwater
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)apply.c 3.5 2006/11/29 */ /* SCCS Id: @(#)apply.c 3.5 2007/02/03 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -962,10 +962,6 @@ register struct obj *obj;
{ {
const char *s = (obj->spe != 1) ? "candles" : "candle"; const char *s = (obj->spe != 1) ? "candles" : "candle";
if(Underwater) {
You("cannot make fire under water.");
return;
}
if(obj->lamplit) { if(obj->lamplit) {
You("snuff the %s.", s); You("snuff the %s.", s);
end_burn(obj, TRUE); end_burn(obj, TRUE);
@@ -975,6 +971,10 @@ register struct obj *obj;
pline("This %s has no %s.", xname(obj), s); pline("This %s has no %s.", xname(obj), s);
return; return;
} }
if (Underwater) {
You("cannot make fire under water.");
return;
}
if(u.uswallow || obj->cursed) { if(u.uswallow || obj->cursed) {
if (!Blind) if (!Blind)
pline_The("%s %s for a moment, then %s.", pline_The("%s %s for a moment, then %s.",
@@ -1020,10 +1020,6 @@ struct obj **optr;
You(no_elbow_room); You(no_elbow_room);
return; return;
} }
if(Underwater) {
pline("Sorry, fire and water don't mix.");
return;
}
otmp = carrying(CANDELABRUM_OF_INVOCATION); otmp = carrying(CANDELABRUM_OF_INVOCATION);
if(!otmp || otmp->spe == 7) { if(!otmp || otmp->spe == 7) {
@@ -1168,10 +1164,6 @@ struct obj *obj;
{ {
char buf[BUFSZ]; char buf[BUFSZ];
if(Underwater) {
pline("This is not a diving lamp.");
return;
}
if(obj->lamplit) { if(obj->lamplit) {
if(obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP || if(obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP ||
obj->otyp == BRASS_LANTERN) obj->otyp == BRASS_LANTERN)
@@ -1181,6 +1173,11 @@ struct obj *obj;
end_burn(obj, TRUE); end_burn(obj, TRUE);
return; return;
} }
if (Underwater) {
pline(!Is_candle(obj) ? "This is not a diving lamp" :
"Sorry, fire and water don't mix.");
return;
}
/* magic lamps with an spe == 0 (wished for) cannot be lit */ /* magic lamps with an spe == 0 (wished for) cannot be lit */
if ((!Is_candle(obj) && obj->age == 0) if ((!Is_candle(obj) && obj->age == 0)
|| (obj->otyp == MAGIC_LAMP && obj->spe == 0)) { || (obj->otyp == MAGIC_LAMP && obj->spe == 0)) {