From 5850279090bc29f3f76811baaf719eb319bdf1bc Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 18 Sep 2013 22:03:59 -0500 Subject: [PATCH] - 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. --- src/p_lnspec.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 869fd5169..12c877116 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -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;