mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user