]> granicus.if.org Git - nethack/commitdiff
fix "unique monster doppelganger and bones bug"
authorPatR <rankin@nethack.org>
Sun, 25 Sep 2022 01:49:48 +0000 (18:49 -0700)
committerPatR <rankin@nethack.org>
Sun, 25 Sep 2022 01:49:48 +0000 (18:49 -0700)
Reported by paxed 8 years ago:  if a bones file contains a
doppelganger imitating a unique monster, when it gets loaded
that monster ends up being marked as having been created.  The
doppelganger itself will shapechange to other forms, but the
unique monster won't be created when it should be because it has
become extinct.

Report involved creating a statue of a unique monster which
yields a doppelganger in that monster's shape, then using stone
to flesh to animate the statue, dying before it changes to some
other shape, and having bones be saved.

doc/fixes3-7-0.txt
src/restore.c

index 69b74c818c48f437d925b4b5fbdce42225681ac8..f671c5921147e2bb52441d00965943059e7e5afe 100644 (file)
@@ -1029,6 +1029,11 @@ improve consistency between applying a key and explicitly opening a door:
        isn't any door in the direction supplied, you're told "no door" and
        time elapses if you discover the non-door's terrain type but doesn't
        if you already knew the type there
+if a bones file contains a doppelganger imitating a unique monster, a game
+       that loads those bones will end up with that monster counted as
+       having already been created so it won't be created if/when the time
+       for that arrives (the doppelganger will change its shape normally,
+       not be stuck in the unique monster's form)
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index d864864b5b34b937891dd7ef0a37b29390726543..feffd1c30528bff56e97aa39e621d24302f1002b 100644 (file)
@@ -402,7 +402,9 @@ restmonchn(NHFILE* nhfp)
         offset = mtmp->mnum;
         mtmp->data = &mons[offset];
         if (ghostly) {
-            int mndx = monsndx(mtmp->data);
+            int mndx = (mtmp->cham == NON_PM) ? monsndx(mtmp->data)
+                                              : mtmp->cham;
+
             if (propagate(mndx, TRUE, ghostly) == 0) {
                 /* cookie to trigger purge in getbones() */
                 mtmp->mhpmax = DEFUNCT_MONSTER;