]> granicus.if.org Git - nethack/commitdiff
more mimic follow-up bits
authornethack.allison <nethack.allison>
Thu, 9 Jan 2003 02:37:03 +0000 (02:37 +0000)
committernethack.allison <nethack.allison>
Thu, 9 Jan 2003 02:37:03 +0000 (02:37 +0000)
Address some complaints about an earlier patch.

src/mhitu.c
src/objnam.c
src/polyself.c
src/vault.c

index 49d0f34d20eac95e675b33673aaca0455f10e867..00e0225b69647fa21e246b65f402fd362a087759 100644 (file)
@@ -316,10 +316,6 @@ mattacku(mtmp)
                /* Might be attacking your image around the corner, or
                 * invisible, or you might be blind....
                 */
-       boolean mimickobj = (youmonst.m_ap_type == M_AP_OBJECT && 
-                               (youmonst.mappearance > STRANGE_OBJECT &&
-                                youmonst.mappearance < NUM_OBJECTS));
-               /* you are mimicking an object */
        
        if(!ranged) nomul(0);
        if(mtmp->mhp <= 0 || (Underwater && !is_swimmer(mtmp->data)))
@@ -443,7 +439,7 @@ mattacku(mtmp)
        }
 
        /* player might be mimicking an object */
-       if (mimickobj && !range2 && foundyou && !u.uswallow) {
+       if (youmonst.m_ap_type == M_AP_OBJECT && !range2 && foundyou && !u.uswallow) {
            if (!youseeit)
                 pline("%s %s!", Something,
                        (likes_gold(mtmp->data) && youmonst.mappearance == GOLD_PIECE) ?
index 6bc5568f836e8443e8e24ba0d726b146dee0cee8..feb5c7dac25d37f1af24528a49ea0b390f00eabd 100644 (file)
@@ -2671,14 +2671,12 @@ const char *
 mimic_obj_name(mtmp)
 struct monst *mtmp;
 {
-    boolean mimickobj = (mtmp->m_ap_type == M_AP_OBJECT &&
-                       (mtmp->mappearance > STRANGE_OBJECT &&
-                        mtmp->mappearance < NUM_OBJECTS));
-    if (mimickobj) {
-       if (mtmp->mappearance == GOLD_PIECE) return "gold";
-       else return obj_descr[objects[mtmp->mappearance].oc_descr_idx].oc_name;
-    }
-    return "whatcha-may-callit";
+       if (mtmp->m_ap_type == M_AP_OBJECT && mtmp->mappearance != STRANGE_OBJECT) {
+               int idx = objects[mtmp->mappearance].oc_descr_idx;
+               if (mtmp->mappearance == GOLD_PIECE) return "gold";
+               return obj_descr[idx].oc_name;
+       }
+       return "whatcha-may-callit";
 }
 #endif /* OVLB */
 
index 7b7848f74e9ff66705dcaca369fe74ceea499051..cca8ceab666cea55def049936133d7a1395a9acc 100644 (file)
@@ -33,9 +33,8 @@ polyman(fmt, arg)
 const char *fmt, *arg;
 {
        boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow,
-               was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT &&
-                               (youmonst.mappearance > STRANGE_OBJECT &&
-                                youmonst.mappearance < NUM_OBJECTS));
+               was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT);
+
        boolean was_blind = !!Blind;
 
        if (Upolyd) {
@@ -332,9 +331,6 @@ int mntmp;
 {
        boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow,
                was_blind = !!Blind, dochange = FALSE;
-       boolean was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT &&
-                               (youmonst.mappearance > STRANGE_OBJECT &&
-                                youmonst.mappearance < NUM_OBJECTS));
        int mlvl;
 
        if (mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
@@ -360,7 +356,7 @@ int mntmp;
                flags.female = u.mfemale;
        }
 
-       if (was_mimicking) {
+       if (youmonst.m_ap_type) {
            /* stop mimicking immediately */
            if (multi < 0) unmul("");
        } else if (mons[mntmp].mlet != S_MIMIC) {
index 432bf9f697ca52c9e5f077ac401b6b8d0e57f4be..a81322b1dc426842e569467ec7f03f45e81299cb 100644 (file)
@@ -134,9 +134,6 @@ invault()
 #endif
     struct monst *guard;
     int trycount, vaultroom = (int)vault_occupied(u.urooms);
-    boolean mimickobj = (youmonst.m_ap_type == M_AP_OBJECT &&
-                       (youmonst.mappearance > STRANGE_OBJECT &&
-                        youmonst.mappearance < NUM_OBJECTS));
 
     if(!vaultroom) {
        u.uinvault = 0;
@@ -244,8 +241,9 @@ fnd:
        else
            pline("Someone else has entered the Vault.");
        newsym(guard->mx,guard->my);
-       if (mimickobj || u.uundetected) {
-           if (mimickobj && youmonst.mappearance != GOLD_PIECE)
+       if (youmonst.m_ap_type == M_AP_OBJECT || u.uundetected) {
+           if (youmonst.m_ap_type == M_AP_OBJECT &&
+                       youmonst.mappearance != GOLD_PIECE)
                verbalize("Hey! who left that %s in here?", mimic_obj_name(&youmonst));
            /* You're mimicking some object or you're hidden. */
            pline("Puzzled, %s turns around and leaves.", mhe(guard));