mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Takeoff in Air fixed.
NewFromGroupName Fixed
This commit is contained in:
@@ -2279,7 +2279,7 @@ local M = { }
|
|||||||
|
|
||||||
-- log system
|
-- log system
|
||||||
local LEVELS = { ERROR = 0, WARNING = 1, INFO = 2, DETAIL = 3, DEBUG = 4 }
|
local LEVELS = { ERROR = 0, WARNING = 1, INFO = 2, DETAIL = 3, DEBUG = 4 }
|
||||||
local LOG_LEVEL = LEVELS.WARNING
|
local LOG_LEVEL = LEVELS.INFO
|
||||||
|
|
||||||
-- Debugger features handling. Any feature can be get like any regular table, setting features result in
|
-- Debugger features handling. Any feature can be get like any regular table, setting features result in
|
||||||
-- error for unknown or read-only features.
|
-- error for unknown or read-only features.
|
||||||
@@ -2438,6 +2438,108 @@ function M.log(level, msg, ...)
|
|||||||
env.info(string.format("DEBUGGER\t%s\t%s\n", level, msg))
|
env.info(string.format("DEBUGGER\t%s\t%s\n", level, msg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.ser(level, ...)
|
||||||
|
local msg = ""
|
||||||
|
if (LEVELS[level] or -1) > LOG_LEVEL then return end
|
||||||
|
if select("#", ...) > 0 then msg = M.serialize(...) end
|
||||||
|
env.info(string.format("DEBUGGER\t%s\t%s\n", level, msg))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- porting in Slmod's serialize_slmod2
|
||||||
|
function M.serialize(tbl) -- serialization of a table all on a single line, no comments, made to replace old get_table_string function
|
||||||
|
|
||||||
|
lookup_table = {}
|
||||||
|
|
||||||
|
local function _Serialize( tbl )
|
||||||
|
|
||||||
|
if type(tbl) == 'table' then --function only works for tables!
|
||||||
|
|
||||||
|
if lookup_table[tbl] then
|
||||||
|
return lookup_table[object]
|
||||||
|
end
|
||||||
|
|
||||||
|
local tbl_str = {}
|
||||||
|
|
||||||
|
lookup_table[tbl] = tbl_str
|
||||||
|
|
||||||
|
tbl_str[#tbl_str + 1] = '{'
|
||||||
|
|
||||||
|
for ind,val in pairs(tbl) do -- serialize its fields
|
||||||
|
local ind_str = {}
|
||||||
|
if type(ind) == "number" then
|
||||||
|
ind_str[#ind_str + 1] = '['
|
||||||
|
ind_str[#ind_str + 1] = tostring(ind)
|
||||||
|
ind_str[#ind_str + 1] = ']='
|
||||||
|
else --must be a string
|
||||||
|
ind_str[#ind_str + 1] = '['
|
||||||
|
ind_str[#ind_str + 1] = M.basicserialize(ind)
|
||||||
|
ind_str[#ind_str + 1] = ']='
|
||||||
|
end
|
||||||
|
|
||||||
|
local val_str = {}
|
||||||
|
if ((type(val) == 'number') or (type(val) == 'boolean')) then
|
||||||
|
val_str[#val_str + 1] = tostring(val)
|
||||||
|
val_str[#val_str + 1] = ','
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||||
|
elseif type(val) == 'string' then
|
||||||
|
val_str[#val_str + 1] = M.basicserialize(val)
|
||||||
|
val_str[#val_str + 1] = ','
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||||
|
elseif type(val) == 'nil' then -- won't ever happen, right?
|
||||||
|
val_str[#val_str + 1] = 'nil,'
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||||
|
elseif type(val) == 'table' then
|
||||||
|
if ind == "__index" then
|
||||||
|
-- tbl_str[#tbl_str + 1] = "__index"
|
||||||
|
-- tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||||
|
else
|
||||||
|
|
||||||
|
val_str[#val_str + 1] = _Serialize(val)
|
||||||
|
val_str[#val_str + 1] = ',' --I think this is right, I just added it
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||||
|
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||||
|
end
|
||||||
|
elseif type(val) == 'function' then
|
||||||
|
-- tbl_str[#tbl_str + 1] = "function " .. tostring(ind)
|
||||||
|
-- tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||||
|
else
|
||||||
|
-- env.info('unable to serialize value type ' .. routines.utils.basicSerialize(type(val)) .. ' at index ' .. tostring(ind))
|
||||||
|
-- env.info( debug.traceback() )
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
tbl_str[#tbl_str + 1] = '}'
|
||||||
|
return table.concat(tbl_str)
|
||||||
|
else
|
||||||
|
if type(tbl) == 'string' then
|
||||||
|
return tbl
|
||||||
|
else
|
||||||
|
return tostring(tbl)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local objectreturn = _Serialize(tbl)
|
||||||
|
return objectreturn
|
||||||
|
end
|
||||||
|
|
||||||
|
--porting in Slmod's "safestring" basic serialize
|
||||||
|
function M.basicserialize(s)
|
||||||
|
if s == nil then
|
||||||
|
return "\"\""
|
||||||
|
else
|
||||||
|
if ((type(s) == 'number') or (type(s) == 'boolean') or (type(s) == 'function') or (type(s) == 'table') or (type(s) == 'userdata') ) then
|
||||||
|
return tostring(s)
|
||||||
|
elseif type(s) == 'string' then
|
||||||
|
s = string.format('%s', s:gsub( "%%", "%%%%" ) )
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -2795,7 +2897,7 @@ local context = require "debugger.context"
|
|||||||
local url = require "debugger.url"
|
local url = require "debugger.url"
|
||||||
|
|
||||||
local log = util.log
|
local log = util.log
|
||||||
|
local ser = util.ser
|
||||||
|
|
||||||
-- TODO complete the stdlib access
|
-- TODO complete the stdlib access
|
||||||
local corunning, cocreate, cowrap, coyield, coresume, costatus = coroutine.running, coroutine.create, coroutine.wrap, coroutine.yield, coroutine.resume, coroutine.status
|
local corunning, cocreate, cowrap, coyield, coresume, costatus = coroutine.running, coroutine.create, coroutine.wrap, coroutine.yield, coroutine.resume, coroutine.status
|
||||||
@@ -2930,6 +3032,8 @@ do
|
|||||||
filereg[bp.lineno] = linereg
|
filereg[bp.lineno] = linereg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ser( "INFO", { bp=bp } )
|
||||||
|
|
||||||
table.insert(linereg, bp)
|
table.insert(linereg, bp)
|
||||||
|
|
||||||
id_mapping[bpid] = bp
|
id_mapping[bpid] = bp
|
||||||
@@ -3157,6 +3261,7 @@ local function line_hook(line)
|
|||||||
--ModifiedSource = ModifiedSource
|
--ModifiedSource = ModifiedSource
|
||||||
|
|
||||||
local uri = platform.get_uri(ModifiedSource)
|
local uri = platform.get_uri(ModifiedSource)
|
||||||
|
ser( "INFO", {uri=uri} )
|
||||||
if uri and uri ~= debugger_uri and uri ~= transportmodule_uri then -- the debugger does not break if the source is not known
|
if uri and uri ~= debugger_uri and uri ~= transportmodule_uri then -- the debugger does not break if the source is not known
|
||||||
do_break = core.breakpoints.at(uri, line) or core.events.does_match()
|
do_break = core.breakpoints.at(uri, line) or core.events.does_match()
|
||||||
if do_break then
|
if do_break then
|
||||||
|
|||||||
@@ -1191,7 +1191,7 @@ function SPAWN:SpawnAtAirbase( SpawnAirbase, Takeoff, TakeoffAltitude ) -- R2.2
|
|||||||
|
|
||||||
if Takeoff == GROUP.Takeoff.Air then
|
if Takeoff == GROUP.Takeoff.Air then
|
||||||
for UnitID, UnitSpawned in pairs( GroupSpawned:GetUnits() ) do
|
for UnitID, UnitSpawned in pairs( GroupSpawned:GetUnits() ) do
|
||||||
SCHEDULER:New( nil, BASE.CreateEventTakeoff, { timer.getTime(), UnitSpawned:GetDCSObject() } , 1 )
|
SCHEDULER:New( nil, BASE.CreateEventTakeoff, { BASE, timer.getTime(), UnitSpawned:GetDCSObject() } , 1 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1385,14 +1385,14 @@ end
|
|||||||
-- @param #string ZoneName Name of the zone.
|
-- @param #string ZoneName Name of the zone.
|
||||||
-- @param #string GroupName The group name of the GROUP defining the waypoints within the Mission Editor to define the polygon shape.
|
-- @param #string GroupName The group name of the GROUP defining the waypoints within the Mission Editor to define the polygon shape.
|
||||||
-- @return #ZONE_POLYGON self
|
-- @return #ZONE_POLYGON self
|
||||||
function ZONE_POLYGON:NewFromGroupName( ZoneName, GroupName )
|
function ZONE_POLYGON:NewFromGroupName( GroupName )
|
||||||
|
|
||||||
local ZoneGroup = GROUP:FindByName( GroupName )
|
local ZoneGroup = GROUP:FindByName( GroupName )
|
||||||
|
|
||||||
local GroupPoints = ZoneGroup:GetTaskRoute()
|
local GroupPoints = ZoneGroup:GetTaskRoute()
|
||||||
|
|
||||||
local self = BASE:Inherit( self, ZONE_POLYGON_BASE:New( ZoneName, GroupPoints ) )
|
local self = BASE:Inherit( self, ZONE_POLYGON_BASE:New( GroupName, GroupPoints ) )
|
||||||
self:F( { ZoneName, ZoneGroup, self._.Polygon } )
|
self:F( { GroupName, ZoneGroup, self._.Polygon } )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user