Stabilizes the add/remove behavior of menubars by also tracking the modeless background control the menubars use for proper cleanup as well.

Also fixes an issue where the findMenu call wasn't properly translating the incoming string to StringTableEntry.
This commit is contained in:
Areloch 2018-02-08 16:00:11 -06:00
parent cfbdf63cd7
commit 40fff8ef50
3 changed files with 19 additions and 10 deletions

View file

@ -1519,9 +1519,10 @@ DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nu
object->insert(pObject, pos);
}
DefineConsoleMethod(GuiMenuBar, findMenu, S32, (StringTableEntry barTitle), (""), "(barTitle)")
DefineConsoleMethod(GuiMenuBar, findMenu, S32, (const char* barTitle), (""), "(barTitle)")
{
PopupMenu* menu = object->findMenu(barTitle);
StringTableEntry barTitleStr = StringTable->insert(barTitle);
PopupMenu* menu = object->findMenu(barTitleStr);
if (menu)
return menu->getId();