[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:
Angen
2020-12-02 18:11:02 +00:00
parent 5a66f89044
commit 3ffc23008d
6 changed files with 19 additions and 16 deletions
@@ -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;