]> granicus.if.org Git - nethack/commitdiff
polyself bit (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 13 Jun 2006 03:15:03 +0000 (03:15 +0000)
committernethack.rankin <nethack.rankin>
Tue, 13 Jun 2006 03:15:03 +0000 (03:15 +0000)
     Some recent code shuffling introduced an unintended change in behavior
(not observable to the player; just unnecessary deletion and re-creation of
light source with identical radius when polymorphing from one light emitting
form to another).  The fixup for light range 1 would need to be repeated for
`old_light' when outside the `if (old_light != new_light)' block; move it
back inside where that isn't required.  Also, youmonst.data is valid all the
time so a couple of `Upolyd' tests in the surrounding code can be dropped.

src/polyself.c

index 94cdbba14356a146c442142215b8d61110eb64ae..e8de4d48617a2e16d4d6819a08a9d100a0f110d7 100644 (file)
@@ -255,7 +255,7 @@ int psflags;
                return;
            }
        }
-       old_light = Upolyd ? emits_light(youmonst.data) : 0;
+       old_light = emits_light(youmonst.data);
        mntmp = NON_PM;
 
        if ((Polymorph_control || forcecontrol) && !monsterpoly) {
@@ -350,11 +350,11 @@ int psflags;
 
  made_change:
        if (!uarmg) selftouch("No longer petrify-resistant, you");
-       new_light = Upolyd ? emits_light(youmonst.data) : 0;
-       if (new_light == 1) ++new_light;    /* otherwise it's undetectable */
+       new_light = emits_light(youmonst.data);
        if (old_light != new_light) {
            if (old_light)
                del_light_source(LS_MONSTER, (genericptr_t)&youmonst);
+           if (new_light == 1) ++new_light;  /* otherwise it's undetectable */
            if (new_light)
                new_light_source(u.ux, u.uy, new_light,
                                 LS_MONSTER, (genericptr_t)&youmonst);