Fixed bug in MENU_GROUP_COMMAND

This commit is contained in:
FlightControl_Master 2017-07-26 22:17:15 +02:00
parent dddcb42e32
commit a6830237f4
2 changed files with 26 additions and 22 deletions

View File

@ -140,8 +140,9 @@ do -- MENU_COMMAND_BASE
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) ) local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) )
self.CommandMenuFunction = CommandMenuFunction self.CommandMenuFunction = CommandMenuFunction
self.MenuCallHandler = function( CommandMenuArguments ) self.CommandMenuArguments = CommandMenuArguments
self.CommandMenuFunction( unpack( CommandMenuArguments ) ) self.MenuCallHandler = function()
self.CommandMenuFunction( unpack( self.CommandMenuArguments ) )
end end
return self return self
@ -893,7 +894,9 @@ do
if MenuGroup._Menus[Path] then if MenuGroup._Menus[Path] then
self = MenuGroup._Menus[Path] self = MenuGroup._Menus[Path]
self:F2( { "Re-using Group Command Menu:", MenuGroup:GetName(), MenuText } ) self:F2( { "Re-using Group Command Menu:", MenuGroup:GetName(), MenuText } )
else missionCommands.removeItemForGroup( self.MenuGroupID, self.MenuPath )
end
self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, arg ) ) self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, arg ) )
--if MenuGroup:IsAlive() then --if MenuGroup:IsAlive() then
@ -914,7 +917,7 @@ do
self.ParentMenu.MenuCount = self.ParentMenu.MenuCount + 1 self.ParentMenu.MenuCount = self.ParentMenu.MenuCount + 1
self:F2( { ParentMenu.Menus, MenuText } ) self:F2( { ParentMenu.Menus, MenuText } )
end end
end -- end
return self return self
end end

View File

@ -745,6 +745,7 @@ function TASK:SetPlannedMenuForGroup( TaskGroup, MenuTime )
local ReportTaskMenu = MENU_GROUP_COMMAND:New( TaskGroup, string.format( "Report Task Status" ), TaskTypeMenu, self.MenuTaskStatus, self, TaskGroup ):SetTime( MenuTime ):SetTag( "Tasking" ):SetRemoveParent( true ) local ReportTaskMenu = MENU_GROUP_COMMAND:New( TaskGroup, string.format( "Report Task Status" ), TaskTypeMenu, self.MenuTaskStatus, self, TaskGroup ):SetTime( MenuTime ):SetTag( "Tasking" ):SetRemoveParent( true )
if not Mission:IsGroupAssigned( TaskGroup ) then if not Mission:IsGroupAssigned( TaskGroup ) then
self:F( { "Replacing Join Task menu" } )
local JoinTaskMenu = MENU_GROUP_COMMAND:New( TaskGroup, string.format( "Join Task" ), TaskTypeMenu, self.MenuAssignToGroup, self, TaskGroup ):SetTime( MenuTime ):SetTag( "Tasking" ):SetRemoveParent( true ) local JoinTaskMenu = MENU_GROUP_COMMAND:New( TaskGroup, string.format( "Join Task" ), TaskTypeMenu, self.MenuAssignToGroup, self, TaskGroup ):SetTime( MenuTime ):SetTag( "Tasking" ):SetRemoveParent( true )
end end