Merge pull request #765 from FlightControl-Master/ET-rat_remove_menu

Possible fix for removal of menus in RAT
This commit is contained in:
Sven Van de Velde 2017-12-13 14:25:40 +01:00 committed by GitHub
commit ee698722a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3185,8 +3185,10 @@ end
-- @param #RAT self -- @param #RAT self
-- @param Wrapper.Group#GROUP group Group to be despawned. -- @param Wrapper.Group#GROUP group Group to be despawned.
function RAT:_Despawn(group) function RAT:_Despawn(group)
if group ~= nil then
local index=self:GetSpawnIndexFromGroup(group) local index=self:GetSpawnIndexFromGroup(group)
if index ~= nil then
--self.ratcraft[index].group:Destroy() --self.ratcraft[index].group:Destroy()
self.ratcraft[index].group=nil self.ratcraft[index].group=nil
group:Destroy() group:Destroy()
@ -3195,9 +3197,11 @@ function RAT:_Despawn(group)
self.alive=self.alive-1 self.alive=self.alive-1
-- Remove submenu for this group. -- Remove submenu for this group.
if self.f10menu then if self.f10menu ~= nil and self.SubMenuName =~ nil then
self.Menu[self.SubMenuName]["groups"][index]:Remove() self.Menu[self.SubMenuName]["groups"][index]:Remove()
end end
end
end
--TODO: Maybe here could be some more arrays deleted? --TODO: Maybe here could be some more arrays deleted?
end end