]> granicus.if.org Git - nethack/commitdiff
mimics mimicking strange objects
authorPatR <rankin@nethack.org>
Wed, 27 May 2015 00:16:30 +0000 (17:16 -0700)
committerPatR <rankin@nethack.org>
Wed, 27 May 2015 00:16:30 +0000 (17:16 -0700)
The code that intended to have mimics occasionally take on the form
of "strange object" always produced downstairs instead because
S_MIMIC_DEF is greater than MAXOCLASSES.

This problem was present in 3.4.3.  I didn't try to go back to see
how long it's been there, but strange objects used to occur once
upon a time.  Either nobody noticed that they'd gone away or there's
an alternate way to produce them.

doc/fixes35.0
src/makemon.c
src/pager.c

index 44a6a38c41de6164fcf900dcea959e2a8d462418..4180fd84c53bb7d1dfcfe8ab279b859f599dae14 100644 (file)
@@ -917,6 +917,7 @@ scroll of earth messages cleaned up
 long worms can no longer be leashed
 the chest in the Castle containing the wishing wand can never be trapped
 the vibrating square is now a trap
+mimics wouldn't take on the form of "strange object"
 
 
 Platform- and/or Interface-Specific Fixes
index d11079cf77ff06a86d2a54dc71b382e2d0ae785f..ea0ca262c40a5e05217e171477501d48a420ffdb 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 makemon.c       $NHDT-Date: 1432512767 2015/05/25 00:12:47 $  $NHDT-Branch: master $:$NHDT-Revision: 1.88 $ */
+/* NetHack 3.6 makemon.c       $NHDT-Date: 1432685497 2015/05/27 00:11:37 $  $NHDT-Branch: master $:$NHDT-Revision: 1.89 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1908,10 +1908,11 @@ static NEARDATA char syms[] = {
     MAXOCLASSES,  MAXOCLASSES + 1, RING_CLASS,   WAND_CLASS,   WEAPON_CLASS,
     FOOD_CLASS,   COIN_CLASS,      SCROLL_CLASS, POTION_CLASS, ARMOR_CLASS,
     AMULET_CLASS, TOOL_CLASS,      ROCK_CLASS,   GEM_CLASS,    SPBOOK_CLASS,
-    S_MIMIC_DEF,  S_MIMIC_DEF,     S_MIMIC_DEF,
+    S_MIMIC_DEF,  S_MIMIC_DEF,
 };
 
-void set_mimic_sym(mtmp) /* KAA, modified by ERS */
+void
+set_mimic_sym(mtmp)
 register struct monst *mtmp;
 {
     int typ, roomno, rt;
@@ -1999,9 +2000,9 @@ register struct monst *mtmp;
     } else {
         s_sym = syms[rn2((int) sizeof(syms))];
     assign_sym:
-        if (s_sym >= MAXOCLASSES) {
+        if (s_sym == MAXOCLASSES || s_sym == MAXOCLASSES + 1) {
             ap_type = M_AP_FURNITURE;
-            appear = s_sym == MAXOCLASSES ? S_upstair : S_dnstair;
+            appear = (s_sym == MAXOCLASSES) ? S_upstair : S_dnstair;
         } else {
             ap_type = M_AP_OBJECT;
             if (s_sym == S_MIMIC_DEF) {
index 0f307af3bcf4bbd254f95d440ccbfda1055a1a33..5ab64103f64a79d0756dfd223920367553938ace 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 pager.c $NHDT-Date: 1432512762 2015/05/25 00:12:42 $  $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */
+/* NetHack 3.6 pager.c $NHDT-Date: 1432685499 2015/05/27 00:11:39 $  $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -248,7 +248,8 @@ char *buf, *monbuf;
                     otmp->corpsenm = MCORPSENM(mtmp);
                 Strcpy(buf, distant_name(otmp, xname));
                 dealloc_obj(otmp);
-            }
+            } else
+                Strcpy(buf, obj_descr[STRANGE_OBJECT].oc_name);
         } else
             Strcpy(buf, distant_name(otmp, xname));