mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-29 04:12:46 +00:00
[Petra] do not pass min == max range in moveToRange
Original diff D2512 Reported on forum by gameboy: https://wildfiregames.com/forum/index.php?/topic/27384-strange-landing-on-the-island-and-unable-to-attack/ Units with goal where minrange = maxrange rarely arrive to destination, because they miss it. See Todo in unitmotion Relative part: In the meantime, one should avoid that 'Speed over a turn' > MaxRange - MinRange, in case where min-range is not 0 and max-range is not infinity. For that reason avoid passing minrange = maxrange from ai. Also warn in cpp unitmoition when getting this kind of command. Differential revision: D3149 Reviewed by: @wraitii This was SVN commit r24315.
This commit is contained in:
@@ -1501,6 +1501,9 @@ bool CCmpUnitMotion::MoveTo(MoveRequest request)
|
||||
{
|
||||
PROFILE("MoveTo");
|
||||
|
||||
if (request.m_MinRange == request.m_MaxRange && !request.m_MinRange.IsZero())
|
||||
LOGWARNING("MaxRange must be larger than MinRange; See CCmpUnitMotion.cpp for more information");
|
||||
|
||||
CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
|
||||
if (!cmpPosition || !cmpPosition->IsInWorld())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user