From c319ff062dfbe672e7f58cdf0e2fa1663dc363af Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 7 Nov 2015 17:36:31 +0000 Subject: [PATCH] Partial fix to a formation "gliding" issue, unsure so far what is causing this. This was SVN commit r17198. --- .../simulation2/components/CCmpUnitMotion.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/simulation2/components/CCmpUnitMotion.cpp b/source/simulation2/components/CCmpUnitMotion.cpp index 837d8c9e67..148d6b9e56 100644 --- a/source/simulation2/components/CCmpUnitMotion.cpp +++ b/source/simulation2/components/CCmpUnitMotion.cpp @@ -581,6 +581,12 @@ private: void StartSucceeded() { + CmpPtr cmpObstruction(GetEntityHandle()); + if (cmpObstruction) + cmpObstruction->SetMovingFlag(true); + + m_Moving = true; + CMessageMotionChanged msg(true, false); GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg); } @@ -1023,6 +1029,10 @@ void CCmpUnitMotion::Move(fixed dt) CmpPtr cmpUnitMotion(GetSimContext(), m_TargetEntity); if (cmpUnitMotion && !cmpUnitMotion->IsMoving()) { + CmpPtr cmpObstruction(GetEntityHandle()); + if (cmpObstruction) + cmpObstruction->SetMovingFlag(false); + m_Moving = false; CMessageMotionChanged msg(false, false); GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg); @@ -1294,8 +1304,16 @@ ControlGroupMovementObstructionFilter CCmpUnitMotion::GetObstructionFilter(bool void CCmpUnitMotion::BeginPathing(const CFixedVector2D& from, const PathGoal& goal) { - // Cancel any pending path requests + // reset our state for sanity. m_ExpectedPathTicket = 0; + + CmpPtr cmpObstruction(GetEntityHandle()); + if (cmpObstruction) + cmpObstruction->SetMovingFlag(false); + + m_Moving = false; + + m_PathState = PATHSTATE_NONE; #if DISABLE_PATHFINDER {