]> granicus.if.org Git - nethack/commitdiff
fix pull request #479 - statues of stoning-immunes
authorPatR <rankin@nethack.org>
Thu, 1 Apr 2021 19:12:05 +0000 (12:12 -0700)
committerPatR <rankin@nethack.org>
Thu, 1 Apr 2021 19:12:05 +0000 (12:12 -0700)
Statues on Medusa's level are supposed to be from petrified creatures
rather than somebody's artwork, so creatures that can't be turned to
stone aren't eligible.  However, creatures who change form when hit
with stoning damage (foo golems to stone golem) were being allowed.
Also, statues in cockatrice nest rooms are supposed to be from former
characters and take their names from the high scores file.  But when
'record' is empty, the statue would be of a random creature instead
of being changed into a player character, so both not the latter and
possibly something that can't be petrified.

I've taken the Medusa part as-is but did the cockatrice nest part
differently.  It rejected statues of non-stonable creatures in case
the named character attempt failed.  I've changed things so that when
a named player character can't be created, it will use an unnamed one
instead of random creature.  The issue of maybe ending up with a non-
stonable form goes away because all player characters are vulnerable.

Fixes #479

doc/fixes37.0
src/mkobj.c
src/mplayer.c
src/sp_lev.c

index 8c1dd981334e9ea42a5421a8886ff5f8f404d718..221502d7f412a9c0bc23424a2ef1732c9d8fb1e5 100644 (file)
@@ -428,6 +428,11 @@ poly'd hero who exploded when attacking a monster didn't wake up other
        woke other monsters within different radius than same monster's would
 troll corpse revival was inhibited by hero wielding Trollsbane; do that if
        anyone on level is wielding it
+statues representing petrified creatures on Medusa's level might be from
+       monsters who change form (golems) when hit with stoning damage
+attempt to make corpse or statue of a named player character would yield that
+       of a random monster instead when 'record' was empty; could result in
+       statues of non-stonable creatures in cockatrice nests
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 9cae221457c29394f1a74869b7c956b434880890..50aa4c3ea1eb4c930ace684af0c45316398d9437 100644 (file)
@@ -1627,10 +1627,15 @@ mk_tt_object(
     /* player statues never contain books */
     initialize_it = (objtype != STATUE);
     otmp = mksobj_at(objtype, x, y, initialize_it, FALSE);
-    /* tt_oname() will return null if the scoreboard is empty;
-       assigning an object name used to allocate a new obj but
-       doesn't any more so we can safely ignore the return value */
-    (void) tt_oname(otmp);
+
+    /* tt_oname() will return null if the scoreboard is empty, which in
+       turn leaves the random corpsenm value; force it to match a player */
+    if (!tt_oname(otmp)) {
+        int pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
+
+        /* update weight for either, force timer sanity for corpses */
+        set_corpsenm(otmp, pm);
+    }
 
     return otmp;
 }
index d50f8daa23cd30ea65226597c0f288c0f7a74cbc..b5e50c005298fbc9dcdfd34ed1d86655490b0dbf 100644 (file)
@@ -114,9 +114,9 @@ mk_mplayer_armor(struct monst* mon, short typ)
 }
 
 struct monst *
-mk_mplayer(register struct permonst* ptr, xchar x, xchar y, register boolean special)
+mk_mplayer(struct permonst *ptr, xchar x, xchar y, boolean special)
 {
-    register struct monst *mtmp;
+    struct monst *mtmp;
     char nam[PL_NSIZ];
 
     if (!is_mplayer(ptr))
index efbc5d3395a51f6b39950156d28d89ae0d53dfb8..4335c53649253835bedcf75774e9187634845257 100755 (executable)
@@ -2206,7 +2206,7 @@ create_object(object* o, struct mkroom* croom)
             /* makemon without rndmonst() might create a group */
             was = makemon(&mons[wastyp], 0, 0, MM_NOCOUNTBIRTH);
             if (was) {
-                if (!resists_ston(was)) {
+                if (!resists_ston(was) && !poly_when_stoned(&mons[wastyp])) {
                     (void) propagate(wastyp, TRUE, FALSE);
                     break;
                 }