]> granicus.if.org Git - nethack/commitdiff
Try to fix pet location inconsistency again
authorPasi Kallinen <paxed@alt.org>
Tue, 24 Mar 2020 19:56:19 +0000 (21:56 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 24 Mar 2020 19:56:24 +0000 (21:56 +0200)
src/dogmove.c

index 57ebcb66a8bbeba53769aed4daae890240af6d4d..b10870555e26e38bdb17af7dabcbee0fb150961f 100644 (file)
@@ -859,7 +859,13 @@ struct monst *mtmp;   /* Pet */
     return best_targ;
 }
 
-/* return 0 (no move), 1 (move) or 2 (dead) */
+/* Return values (same as m_move):
+ * 0: did not move, but can still attack and do other stuff.
+ * 1: moved, possibly can attack.
+ * 2: monster died.
+ * 3: did not move, and can't do anything else either.
+ *    (may have attacked something)
+ */
 int
 dog_move(mtmp, after)
 register struct monst *mtmp;
@@ -1038,7 +1044,7 @@ int after; /* this is extra fast monster movement */
                 if (mstatus & MM_DEF_DIED)
                     return 2;
             }
-            return 0;
+            return 3;
         }
         if ((info[i] & ALLOW_MDISP) && MON_AT(nx, ny)
             && better_with_displacing && !undesirable_disp(mtmp, nx, ny)) {
@@ -1181,10 +1187,7 @@ int after; /* this is extra fast monster movement */
                     }
                 }
             }
-
-            /* pet moved when attacking */
-            if (mtmp->mx != omx || mtmp->my != omy)
-                return 0;
+            return 3;
         }
     }
 
@@ -1199,7 +1202,7 @@ int after; /* this is extra fast monster movement */
                 m_unleash(mtmp, FALSE);
             }
             (void) mattacku(mtmp);
-            return 0;
+            return 3;
         }
         if (!m_in_out_region(mtmp, nix, niy))
             return 1;