mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-22 21:27:36 +00:00
Unit Motion - Face point when calling StopMoving()
FacePointAfterMoving intends for the unit to face the destination once a
move is done. Since 4fda917f46, stopping is the responsibility of UnitAI
(through a call to StopMoving()). Thus we should move that code in that
function, as this ensures we don't forget to do it and removes
duplications.
Differential Revision: https://code.wildfiregames.com/D1889
This was SVN commit r22355.
This commit is contained in:
@@ -518,6 +518,13 @@ public:
|
||||
|
||||
virtual void StopMoving()
|
||||
{
|
||||
if (m_FacePointAfterMove)
|
||||
{
|
||||
CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
|
||||
if (cmpPosition && cmpPosition->IsInWorld())
|
||||
FaceTowardsPointFromPos(cmpPosition->GetPosition2D(), m_FinalGoal.x, m_FinalGoal.z);
|
||||
}
|
||||
|
||||
m_MoveRequest = MoveRequest();
|
||||
m_ExpectedPathTicket = 0;
|
||||
m_State = STATE_STOPPING;
|
||||
@@ -750,9 +757,6 @@ void CCmpUnitMotion::PathResult(u32 ticket, const WaypointPath& path)
|
||||
if (CloseEnoughFromDestinationToStop(pos))
|
||||
{
|
||||
MoveSucceeded();
|
||||
|
||||
if (m_FacePointAfterMove)
|
||||
FaceTowardsPointFromPos(pos, m_FinalGoal.x, m_FinalGoal.z);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -930,10 +934,6 @@ void CCmpUnitMotion::Move(fixed dt)
|
||||
if (CloseEnoughFromDestinationToStop(pos))
|
||||
{
|
||||
MoveSucceeded();
|
||||
|
||||
if (m_FacePointAfterMove)
|
||||
FaceTowardsPointFromPos(pos, m_FinalGoal.x, m_FinalGoal.z);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user