Index: source/simulation2/components/CCmpUnitMotion.cpp =================================================================== --- source/simulation2/components/CCmpUnitMotion.cpp +++ source/simulation2/components/CCmpUnitMotion.cpp @@ -145,38 +145,6 @@ bool m_FacePointAfterMove; - enum State - { - /* - * Not moving at all. - */ - STATE_IDLE, - - /* - * Not moving at all. Will go to IDLE next turn. - * (This one-turn delay is a hack to fix animation timings.) - */ - STATE_STOPPING, - - /* - * Member of a formation. - * Pathing to the target (depending on m_PathState). - * Target is m_TargetEntity plus m_TargetOffset. - */ - STATE_FORMATIONMEMBER_PATH, - - /* - * Individual unit or formation controller. - * Pathing to the target (depending on m_PathState). - * Target is m_TargetPos, m_TargetMinRange, m_TargetMaxRange; - * if m_TargetEntity is not INVALID_ENTITY then m_TargetPos is tracking it. - */ - STATE_INDIVIDUAL_PATH, - - STATE_MAX - }; - u8 m_State; - enum PathState { /* @@ -324,7 +292,6 @@ cmpObstruction->SetUnitClearance(m_Clearance); } - m_State = STATE_IDLE; m_PathState = PATHSTATE_NONE; m_ExpectedPathTicket = 0; @@ -343,7 +310,6 @@ template void SerializeCommon(S& serialize) { - serialize.NumberU8("state", m_State, 0, STATE_MAX-1); serialize.NumberU8("path state", m_PathState, 0, PATHSTATE_MAX-1); serialize.StringASCII("pass class", m_PassClassName, 0, 64); @@ -532,7 +498,6 @@ m_MoveRequest = MoveRequest(); m_ExpectedPathTicket = 0; - m_State = STATE_STOPPING; m_PathState = PATHSTATE_NONE; m_LongPath.m_Waypoints.clear(); m_ShortPath.m_Waypoints.clear(); @@ -551,7 +516,8 @@ bool IsFormationMember() const { - return m_State == STATE_FORMATIONMEMBER_PATH; + // TODO: this really shouldn't be what we are checking for. + return m_MoveRequest.m_Type == MoveRequest::OFFSET; } entity_id_t GetGroup() const @@ -800,25 +766,16 @@ m_PathState = PATHSTATE_FOLLOWING; } else - LOGWARNING("unexpected PathResult (%u %d %d)", GetEntityId(), m_State, m_PathState); + LOGWARNING("unexpected PathResult (%u %d)", GetEntityId(), m_PathState); } void CCmpUnitMotion::Move(fixed dt) { PROFILE("Move"); - if (m_State == STATE_STOPPING) - { - m_State = STATE_IDLE; - MoveSucceeded(); - m_CurSpeed = fixed::Zero(); - CmpPtr cmpObstruction(GetEntityHandle()); - if (cmpObstruction) - cmpObstruction->SetMovingFlag(false); - return; - } - - if (m_State == STATE_IDLE) + // If we were idle and will still be, we can return. + // TODO: this will need to be removed if pushing is implented. + if (m_CurSpeed == fixed::Zero() && m_MoveRequest.m_Type == MoveRequest::NONE) return; if (m_PathState == PATHSTATE_FOLLOWING && PossiblyAtDestination()) @@ -1431,7 +1388,6 @@ } } - m_State = STATE_INDIVIDUAL_PATH; m_MoveRequest = MoveRequest(CFixedVector2D(x, z), minRange, maxRange); m_FinalGoal = goal; m_Tries = 0; @@ -1598,7 +1554,6 @@ } } - m_State = STATE_INDIVIDUAL_PATH; m_MoveRequest = MoveRequest(target, minRange, maxRange); m_FinalGoal = goal; m_Tries = 0; @@ -1621,7 +1576,6 @@ goal.x = pos.X; goal.z = pos.Y; - m_State = STATE_FORMATIONMEMBER_PATH; m_MoveRequest = MoveRequest(target, CFixedVector2D(x, z)); m_FinalGoal = goal; m_Tries = 0;