]> granicus.if.org Git - nethack/commitdiff
wizard mode light source bug
authorPatR <rankin@nethack.org>
Wed, 4 Aug 2021 20:26:56 +0000 (13:26 -0700)
committerPatR <rankin@nethack.org>
Wed, 4 Aug 2021 20:26:56 +0000 (13:26 -0700)
In wizard mode if you're already polymorphed and you choose your
role's form when polymorphing again, polyself() calls rehumanize()
to restore your original shape.  rehumanize() turns off any light
the hero is emitting from polymorph form.  After it returned,
polyself() then tried to do the same thing based on a cached value.
If the previous form had been emitting light, that resulted in an
impossible() warning "del_light_source: not found type=1, id=N".

Couldn't happen in normal play because a request to polymorph into
any role monster is usually rejected; it's only honored in wizard
mode for current role.  Noticed when testing something while in
gold dragon form but this bug predates addition of that monster.

Clear the cached value when rehumanize() returns to polyself().

doc/fixes37.0
src/polyself.c

index 449ad3ce9157a5bc09d0f785981f56d835b0e5af..0e9d3eda62858c249f9fad2f6d3b3cabab0288d4 100644 (file)
@@ -584,6 +584,10 @@ describe a couple of isolated moat spots on Samurai quest home level as water
        rather than as moat
 crawling out of water to avoid drowning didn't work as intended when trying
        to move diagonally through a tight squeeze
+in wizard mode, polymorphing into hero's role monster in order to revert to
+       normal form would complain about missing light source if hero was
+       changing back from the form of a light-emitting monster [didn't affect
+       normal play because role monsters are invalid polymorph targets there]
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index fe349bc19a6026df8b78973e275a21ef3da6a1e2..78f620f6c449b4ddcce2c327aaa6eb32cad2c3ab 100644 (file)
@@ -423,7 +423,7 @@ polyself(int psflags)
     old_light = emits_light(g.youmonst.data);
     mntmp = NON_PM;
 
-    if (formrevert){
+    if (formrevert) {
         mntmp = g.youmonst.cham;
         monsterpoly = TRUE;
         controllable_poly = FALSE;
@@ -469,6 +469,7 @@ polyself(int psflags)
                 /* in wizard mode, picking own role while poly'd reverts to
                    normal without newman()'s chance of level or sex change */
                 rehumanize();
+                old_light = 0; /* rehumanize() extinguishes u-as-mon light */
                 goto made_change;
             } else if (iswere && (were_beastie(mntmp) == u.ulycn
                                   || mntmp == counter_were(u.ulycn)