Urgent fixes

* DESIGNATE: Messages not appearing correctly and crashing the logic is
fixed. (due to a stupid typo).
* TASK_A2G: Tasking is fixed. Status menus are now displayed properly.
Also when the task is planned.
* MENU_COMMAND: I found now why DCS is displayer "error in error
handler" sometimes when a menu was selected. The error handler is DCS is
bugged, so made my own one.
This commit is contained in:
FlightControl_Master
2017-09-18 06:10:45 +02:00
parent 56813a800c
commit 4edc8363e1
5 changed files with 28 additions and 8 deletions

View File

@@ -139,11 +139,24 @@ do -- MENU_COMMAND_BASE
function MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, CommandMenuArguments )
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) ) -- #MENU_COMMAND_BASE
-- When a menu function goes into error, DCS displays an obscure menu message.
-- This error handler catches the menu error and displays the full call stack.
local ErrorHandler = function( errmsg )
env.info( "MOOSE error in MENU COMMAND function: " .. errmsg )
if debug ~= nil then
env.info( debug.traceback() )
end
return errmsg
end
self:SetCommandMenuFunction( CommandMenuFunction )
self:SetCommandMenuArguments( CommandMenuArguments )
self.MenuCallHandler = function()
self.CommandMenuFunction( unpack( self.CommandMenuArguments ) )
local function MenuFunction()
return self.CommandMenuFunction( unpack( self.CommandMenuArguments ) )
end
local Status, Result = xpcall( MenuFunction, ErrorHandler )
end
return self