ZONE: Set down trials for getting a random coordinate on a given land type to 100

Cohort -ensure fallback of mission range
This commit is contained in:
Applevangelist 2021-12-22 11:48:42 +01:00
parent 485e2e18bf
commit 472a4883f0
2 changed files with 4 additions and 2 deletions

View File

@ -1182,7 +1182,7 @@ end
-- @param #ZONE_RADIUS self -- @param #ZONE_RADIUS self
-- @param #number inner (Optional) Minimal distance from the center of the zone. Default is 0. -- @param #number inner (Optional) Minimal distance from the center of the zone. Default is 0.
-- @param #number outer (Optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone. -- @param #number outer (Optional) Maximal distance from the outer edge of the zone. Default is the radius of the zone.
-- @param #table surfacetypes (Optional) Table of surface types. Can also be a single surface type. We will try max 1000 times to find the right type! -- @param #table surfacetypes (Optional) Table of surface types. Can also be a single surface type. We will try max 100 times to find the right type!
-- @return DCS#Vec2 The random location within the zone. -- @return DCS#Vec2 The random location within the zone.
function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes) function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes)
@ -1215,7 +1215,7 @@ function ZONE_RADIUS:GetRandomVec2(inner, outer, surfacetypes)
local point=_getpoint() local point=_getpoint()
if surfacetypes then if surfacetypes then
local N=1 ; local Nmax=1000 ; local gotit=false local N=1 ; local Nmax=100 ; local gotit=false
while gotit==false and N<=Nmax do while gotit==false and N<=Nmax do
gotit=_checkSurface(point) gotit=_checkSurface(point)
if gotit then if gotit then

View File

@ -141,6 +141,8 @@ function COHORT:New(TemplateGroupName, Ngroups, CohortName)
self:SetMissionRange(100) self:SetMissionRange(100)
elseif self.category==Group.Category.TRAIN then elseif self.category==Group.Category.TRAIN then
self:SetMissionRange(100) self:SetMissionRange(100)
else
self:SetMissionRange(150)
end end
-- Units. -- Units.