diff options
author | Eugene Sandulenko | 2019-10-03 14:14:57 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-10-03 14:14:57 +0200 |
commit | e4c3c690902e546f2a093815cfe2ae6ec19e6c67 (patch) | |
tree | dadcf990c9aef20c51a76a0961c3d0a237411c89 /graphics/macgui | |
parent | b5573c8e2af74079cbe2583f75f5dfe3220a4376 (diff) | |
download | scummvm-rg350-e4c3c690902e546f2a093815cfe2ae6ec19e6c67.tar.gz scummvm-rg350-e4c3c690902e546f2a093815cfe2ae6ec19e6c67.tar.bz2 scummvm-rg350-e4c3c690902e546f2a093815cfe2ae6ec19e6c67.zip |
GRAPHICS: MACGUI: Fix nested menus parsing
Diffstat (limited to 'graphics/macgui')
-rw-r--r-- | graphics/macgui/macmenu.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 917e1ff8f1..3bcfdcc996 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -225,12 +225,12 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager MacMenu *menu = wm->addMenu(); Common::Stack<MacMenuSubMenu *> menus; + Common::Stack<bool> popups; int depth = 0; int curMenuItemId = 0; int action = 0; bool lastPopUp = false; - bool lastPopUpCopy = false; // no more than 2 level menu for now while (depth >= 0) { uint16 flags = menuData->readUint16LE(); if (flags & kPopUp) { @@ -244,12 +244,10 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager MacMenuSubMenu *submenu = menu->addSubMenu(menus.size() ? menus.top() : nullptr); menus.push(submenu); - - if (lastPopUp) { - lastPopUpCopy = lastPopUp; - } + popups.push(lastPopUp); lastPopUp = (flags & kEndMenu) != 0; + depth++; } else { menuData->readUint16LE(); // menu id @@ -262,17 +260,19 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager } if (flags & kEndMenu) { menus.pop(); + depth--; - if (lastPopUp) - depth -= 2; - else + if (lastPopUp) { depth--; + if (menus.size()) + menus.pop(); + } + if (depth == 0) curMenuItemId++; - lastPopUp = lastPopUpCopy; - lastPopUpCopy = false; + lastPopUp = popups.pop(); } } } |