]> granicus.if.org Git - nethack/commitdiff
fix #2276 - unlightable candelabrum
authornethack.rankin <nethack.rankin>
Tue, 10 May 2011 02:32:37 +0000 (02:32 +0000)
committernethack.rankin <nethack.rankin>
Tue, 10 May 2011 02:32:37 +0000 (02:32 +0000)
     From a bug report, applying unlit Candelabrum
of Invocation when its candles had 1 turn's worth of burning left would
give a message that the candles were burning but not actually light them
if done anywhere other than the invocation location.  Their burn time is
cut it half when not at that spot, and dividing an age of 1 yielded 0,
confusing begin_burn().  They wouldn't light and they couldn't be replaced
since they'd never get used up.

     The problem is real, but the chance of it actually happening in
normal play is just about zero.  This applies his suggested fix of
rounding the halved burn time up instead of down so that it can't yield 0.
It also applies his suggestion that the Candelabrum treat the invocation
spot like any other location once invocation has produced stairs there,
just as the Bell and the Book do.

doc/fixes34.4
src/apply.c

index de8e38476484eec186e6347c093deba410b87036..710fc871c63c3e7b6b5bfb4334a10a2c02117996 100644 (file)
@@ -405,6 +405,8 @@ the weight of a non-cursed bag of holding was sometimes off by 1 unit
 for number_pad:2 (MSDOS compatibility), M-5 (Alt+5, or Shift+keypad5 using
        MSDOS/Windows keystroke hackery) didn't function as G movement prefix
 objects inside the Wizard's Tower can't be teleport to outside and vica versa
+unlit candelabrum would become unlightable if its candles had exactly 1 turn
+       of fuel left and it was applied anywhere other than the invocation spot
 
 
 Platform- and/or Interface-Specific Fixes
index d3de0fd369766c8d3bfa131d149b2d2dca363af8..979a63860d333b8f5720d8ffd6405bdc95bca141 100644 (file)
@@ -1040,9 +1040,12 @@ register struct obj *obj;
                pline("%s's %s burn%s", The(xname(obj)), s,
                        (Blind ? "." : " brightly!"));
        }
-       if (!invocation_pos(u.ux, u.uy)) {
+       if (!invocation_pos(u.ux, u.uy) || On_stairs(u.ux, u.uy)) {
                pline_The("%s %s being rapidly consumed!", s, vtense(s, "are"));
-               obj->age /= 2;
+               /* this used to be obj->age /= 2, rounding down; an age of
+                  1 would yield 0, confusing begin_burn() and producing an
+                  unlightable, unrefillable candelabrum; round up instead */
+               obj->age = (obj->age + 1L) / 2L;
        } else {
                if(obj->spe == 7) {
                    if (Blind)