From: Pasi Kallinen Date: Tue, 24 Mar 2020 19:56:19 +0000 (+0200) Subject: Try to fix pet location inconsistency again X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8fb419a2c1e71432b876c107e58ec6084aaa979;p=nethack Try to fix pet location inconsistency again --- diff --git a/src/dogmove.c b/src/dogmove.c index 57ebcb66a..b10870555 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -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;