From: nethack.rankin Date: Tue, 13 Jun 2006 03:15:03 +0000 (+0000) Subject: polyself bit (trunk only) X-Git-Tag: MOVE2GIT~986 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c243a06c79a541578de72f6a1bc877a1e06d51ad;p=nethack 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. --- diff --git a/src/polyself.c b/src/polyself.c index 94cdbba14..e8de4d486 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -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);