polyself bit (trunk only)

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.
This commit is contained in:
nethack.rankin
2006-06-13 03:15:03 +00:00
parent f139b67e43
commit c243a06c79

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