Fixes to resolve exceptions in multi player situations

This commit is contained in:
FlightControl
2017-07-08 05:54:33 +02:00
parent 367c4d74af
commit 8e2aef17e7
3 changed files with 117 additions and 109 deletions

View File

@@ -1724,14 +1724,16 @@ do -- AI_A2A_DISPATCHER
self:E( { DefenderSquadron } )
local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE
local TargetCoord = Target.Set:GetFirst():GetCoordinate()
local Distance = SpawnCoord:Get2DDistance( TargetCoord )
if ClosestDistance == 0 or Distance < ClosestDistance then
if TargetCoord then
local Distance = SpawnCoord:Get2DDistance( TargetCoord )
-- Only intercept if the distance to target is smaller or equal to the GciRadius limit.
if Distance <= self.GciRadius then
ClosestDistance = Distance
ClosestDefenderSquadronName = SquadronName
if ClosestDistance == 0 or Distance < ClosestDistance then
-- Only intercept if the distance to target is smaller or equal to the GciRadius limit.
if Distance <= self.GciRadius then
ClosestDistance = Distance
ClosestDefenderSquadronName = SquadronName
end
end
end
end