fix #2276 - unlightable candelabrum

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.
This commit is contained in:
nethack.rankin
2011-05-10 02:32:37 +00:00
parent c780d239a1
commit b16fa5084e
2 changed files with 7 additions and 2 deletions

View 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

View 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)