fixed groupTableCheck and added some ldoc

This commit is contained in:
Lukas Kropatschek 2016-01-12 20:23:36 +01:00
parent 42e67cf481
commit 864e89d43b

View File

@ -2763,27 +2763,24 @@ do -- group functions scope
-- @treturn boolean true if a group can be spawned using -- @treturn boolean true if a group can be spawned using
-- this table, false otherwise. -- this table, false otherwise.
function mist.groupTableCheck(groupData) function mist.groupTableCheck(groupData)
local isOk = false -- return false if country, category
-- or units are missing
if groupData.country then if not groupData.country and
isOk = true not groupData.category and
not groupData.units then
return false
end end
if groupData.category then -- return false if unitData misses
isOk = true -- x, y or type
else
isOk = false
end
if groupData.units then
for unitId, unitData in pairs(groupData.units) do for unitId, unitData in pairs(groupData.units) do
if unitData.x and unitData.y and unitData.type then if not unitData.x and
isOk = true not unitData.y and
not unitData.type then
return false
end end
end end
else -- everything we need is here return true
isOk = false return true
end
return isOk
end end
function mist.getCurrentGroupData(gpName) function mist.getCurrentGroupData(gpName)
@ -5733,6 +5730,13 @@ do -- group tasks scope
mist.air.fixedWing = {} mist.air.fixedWing = {}
mist.air.heli = {} mist.air.heli = {}
--- Tasks group to follow a route.
-- This sets the mission task for the given group.
-- Any wrapped actions inside the path (like enroute
-- tasks) will be executed.
-- @tparam Group group group to task.
-- @tparam table path containing
-- points defining a route.
function mist.goRoute(group, path) function mist.goRoute(group, path)
local misTask = { local misTask = {
id = 'Mission', id = 'Mission',
@ -5745,15 +5749,13 @@ do -- group tasks scope
if type(group) == 'string' then if type(group) == 'string' then
group = Group.getByName(group) group = Group.getByName(group)
end end
local groupCon = nil
if group then if group then
groupCon = group:getController() local groupCon = group:getController()
if groupCon then if groupCon then
groupCon:setTask(misTask) groupCon:setTask(misTask)
return true return true
end end
end end
--Controller.setTask(groupCon, misTask)
return false return false
end end