Abort activities when we don't know how close to move to a target.
This commit is contained in:
committed by
Oliver Brakmann
parent
2d4bad66ae
commit
49621bebd0
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
|
||||
if (!checkTarget.IsInRange(pos, lastVisibleMaxRange) || checkTarget.IsInRange(pos, lastVisibleMinRange))
|
||||
{
|
||||
if (!allowMovement)
|
||||
if (!allowMovement || lastVisibleMaxRange == WDist.Zero || lastVisibleMaxRange < lastVisibleMinRange)
|
||||
return NextActivity;
|
||||
|
||||
QueueChild(mobile.MoveWithinRange(target, lastVisibleMinRange, lastVisibleMaxRange, checkTarget.CenterPosition, Color.Red));
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (useLastVisibleTarget)
|
||||
{
|
||||
// We've reached the assumed position but it is not there or we can't move any further - give up
|
||||
if (checkTarget.IsInRange(pos, lastVisibleMaximumRange) || move == null)
|
||||
if (checkTarget.IsInRange(pos, lastVisibleMaximumRange) || move == null || lastVisibleMaximumRange == WDist.Zero)
|
||||
return NextActivity;
|
||||
|
||||
// Move towards the last known position
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// We can't move into range, so give up
|
||||
if (move == null)
|
||||
if (move == null || maxRange == WDist.Zero || maxRange < minRange)
|
||||
{
|
||||
attack.requestedTarget = Target.Invalid;
|
||||
return NextActivity;
|
||||
|
||||
Reference in New Issue
Block a user