]> granicus.if.org Git - nethack/commitdiff
fix #Q108 - adding candles to Candelabrum while underwater
authornethack.rankin <nethack.rankin>
Sun, 4 Feb 2007 05:34:59 +0000 (05:34 +0000)
committernethack.rankin <nethack.rankin>
Sun, 4 Feb 2007 05:34:59 +0000 (05:34 +0000)
     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.

doc/fixes34.4
src/apply.c

index feaca00ff3a6754064921c03887618dbc382dd96..56813781e3876c97839e18215435896b9588bcd6 100644 (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
        hangup save took place during level change; leaving the level by any
        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
index 16ac4ae8232990100e5b94778aa5ba6d6bb13313..5f705602a36c174a1ef5f94b7b09de24cb151c50 100644 (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. */
 /* 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";
 
-       if(Underwater) {
-               You("cannot make fire under water.");
-               return;
-       }
        if(obj->lamplit) {
                You("snuff the %s.", s);
                end_burn(obj, TRUE);
@@ -975,6 +971,10 @@ register struct obj *obj;
                pline("This %s has no %s.", xname(obj), s);
                return;
        }
+       if (Underwater) {
+               You("cannot make fire under water.");
+               return;
+       }
        if(u.uswallow || obj->cursed) {
                if (!Blind)
                    pline_The("%s %s for a moment, then %s.",
@@ -1020,10 +1020,6 @@ struct obj **optr;
                You(no_elbow_room);
                return;
        }
-       if(Underwater) {
-               pline("Sorry, fire and water don't mix.");
-               return;
-       }
 
        otmp = carrying(CANDELABRUM_OF_INVOCATION);
        if(!otmp || otmp->spe == 7) {
@@ -1168,10 +1164,6 @@ struct obj *obj;
 {
        char buf[BUFSZ];
 
-       if(Underwater) {
-               pline("This is not a diving lamp.");
-               return;
-       }
        if(obj->lamplit) {
                if(obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP ||
                                obj->otyp == BRASS_LANTERN)
@@ -1181,6 +1173,11 @@ struct obj *obj;
                end_burn(obj, TRUE);
                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 */
        if ((!Is_candle(obj) && obj->age == 0)
                        || (obj->otyp == MAGIC_LAMP && obj->spe == 0)) {