Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/components/CCmpUnitMotion.cpp
Show First 20 Lines • Show All 1,075 Lines • ▼ Show 20 Lines | bool CCmpUnitMotion::ComputeTargetPosition(CFixedVector2D& out) const | ||||
else | else | ||||
out = cmpPosition->GetPosition2D(); | out = cmpPosition->GetPosition2D(); | ||||
return true; | return true; | ||||
} | } | ||||
bool CCmpUnitMotion::TryGoingStraightToGoalPoint(const CFixedVector2D& from) | bool CCmpUnitMotion::TryGoingStraightToGoalPoint(const CFixedVector2D& from) | ||||
{ | { | ||||
// Make sure the goal is a point (and not a point-like target like a formation controller) | // Make sure the goal is a point (and not a point-like target like a formation controller) | ||||
if (m_MoveRequest.m_Type != MoveRequest::POINT) | if (m_MoveRequest.m_Type != MoveRequest::POINT || | ||||
m_MoveRequest.m_MinRange > fixed::Zero()) | |||||
return false; | return false; | ||||
// Fail if the goal is too far away | // Fail if the goal is too far away | ||||
CFixedVector2D goalPos(m_FinalGoal.x, m_FinalGoal.z); | CFixedVector2D goalPos(m_FinalGoal.x, m_FinalGoal.z); | ||||
if ((goalPos - from).CompareLength(DIRECT_PATH_RANGE) > 0) | if ((goalPos - from).CompareLength(DIRECT_PATH_RANGE) > 0) | ||||
return false; | return false; | ||||
CmpPtr<ICmpPathfinder> cmpPathfinder(GetSystemEntity()); | CmpPtr<ICmpPathfinder> cmpPathfinder(GetSystemEntity()); | ||||
▲ Show 20 Lines • Show All 572 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator