pet->meating doesn't imply helplessness

The overly simplistic fix to prevent pets from picking up objects
while they were busy eating had unwanted side-effects, making them
seem to be paralyzed in some situations such as #chat.  Reverse the
recent change done in commit 754e9333f5
("fix pet picking something up while eating") and handle it in the
pet pick-up code instead.
This commit is contained in:
PatR
2023-03-25 12:47:17 -07:00
parent c70c9ec793
commit a3d8557ea6
2 changed files with 8 additions and 6 deletions

View File

@@ -239,7 +239,7 @@ struct monst {
((m)->data->mlet == S_TROLL && (o) && (o)->oartifact == ART_TROLLSBANE)
#define engulfing_u(mon) (u.uswallow && (u.ustuck == (mon)))
#define helpless(mon) ((mon)->msleeping || !(mon)->mcanmove || (mon)->meating)
#define helpless(mon) ((mon)->msleeping || !(mon)->mcanmove)
/* Get the maximum difficulty monsters that can currently be generated,
given the current level difficulty and the hero's level. */

View File

@@ -385,7 +385,7 @@ dog_invent(struct monst *mtmp, struct edog *edog, int udist)
int carryamt = 0;
struct obj *obj, *otmp;
if (helpless(mtmp))
if (helpless(mtmp) || mtmp->meating)
return 0;
omx = mtmp->mx;
@@ -938,13 +938,14 @@ pet_ranged_attk(struct monst *mtmp)
* (may have attacked something)
*/
int
dog_move(register struct monst *mtmp,
int after) /* this is extra fast monster movement */
dog_move(
struct monst *mtmp, /* pet */
int after) /* this is extra fast monster movement */
{
int omx, omy; /* original mtmp position */
int appr, whappr, udist;
int i, j, k;
register struct edog *edog = EDOG(mtmp);
struct edog *edog = EDOG(mtmp);
struct obj *obj = (struct obj *) 0;
xint16 otyp;
boolean has_edog, cursemsg[9], do_eat = FALSE;
@@ -979,9 +980,10 @@ dog_move(register struct monst *mtmp,
return MMOVE_MOVED;
}
udist = 1;
} else if (!udist)
} else if (!udist) {
/* maybe we tamed him while being swallowed --jgm */
return MMOVE_NOTHING;
}
nix = omx; /* set before newdogpos */
niy = omy;