- Fixed: Thing_SetGoal could put an actor's target and goal out of sync.

If an actor is already targeting a goal, and Thing_SetGoal is used on
  it, it would still be left targeting the old goal instead of the new
  one. This messed up checks in A_Chase for walking towards a goal vs a
  real target.
This commit is contained in:
Randy Heit 2013-09-18 22:03:59 -05:00
parent ad7aefff20
commit 5850279090

View file

@ -1562,9 +1562,21 @@ FUNC(LS_Thing_SetGoal)
ok = true;
if (self->flags & MF_SHOOTABLE)
{
if (self->target == self->goal)
{ // Targeting a goal already? -> don't target it anymore.
// A_Look will set it to the goal, presuming no real targets
// come into view by then.
self->target = NULL;
}
self->goal = goal;
if (arg3 == 0) self->flags5 &=~ MF5_CHASEGOAL;
else self->flags5 |= MF5_CHASEGOAL;
if (arg3 == 0)
{
self->flags5 &= ~MF5_CHASEGOAL;
}
else
{
self->flags5 |= MF5_CHASEGOAL;
}
if (self->target == NULL)
{
self->reactiontime = arg2 * TICRATE;