From 97ed6a2af73608dad953e740f58432921a6ac700 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 21 Aug 2017 19:40:05 +0200 Subject: GRAPHICS: MACGUI: Pass command id when creating menu to avoid namespace clashes This fixes Command menu in WAGE. --- engines/wage/gui.cpp | 2 +- graphics/macgui/macmenu.cpp | 9 ++------- graphics/macgui/macmenu.h | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 53f83bb97c..ffc4e41e66 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -199,7 +199,7 @@ bool Gui::processSceneEvents(WindowClick click, Common::Event &event) { // Menu stuff //////////////// void Gui::regenCommandsMenu() { - _menu->createSubMenuFromString(_commandsMenuId, _engine->_world->_commandsMenu.c_str()); + _menu->createSubMenuFromString(_commandsMenuId, _engine->_world->_commandsMenu.c_str(), kMenuActionCommand); } void Gui::regenWeaponsMenu() { diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index dcf2e20470..cecdcabcea 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -56,11 +56,6 @@ enum { kFontStyleExtended = 64 }; -enum { - kMenuActionCommand -}; - - struct MacMenuSubItem { Common::String text; int action; @@ -216,7 +211,7 @@ void MacMenu::clearSubMenu(int id) { menu->subitems.clear(); } -void MacMenu::createSubMenuFromString(int id, const char *str) { +void MacMenu::createSubMenuFromString(int id, const char *str, int commandId) { clearSubMenu(id); MacMenuItem *menu = _items[id]; @@ -278,7 +273,7 @@ void MacMenu::createSubMenuFromString(int id, const char *str) { } } - menu->subitems.push_back(new MacMenuSubItem(item.c_str(), kMenuActionCommand, style, shortcut, enabled)); + menu->subitems.push_back(new MacMenuSubItem(item.c_str(), commandId, style, shortcut, enabled)); } item.clear(); diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h index a25b65afbc..8b3e8ff258 100644 --- a/graphics/macgui/macmenu.h +++ b/graphics/macgui/macmenu.h @@ -52,7 +52,7 @@ public: int addMenuItem(const char *name); void addMenuSubItem(int id, const char *text, int action, int style = 0, char shortcut = 0, bool enabled = true); - void createSubMenuFromString(int id, const char *string); + void createSubMenuFromString(int id, const char *string, int commandId); void clearSubMenu(int id); bool draw(ManagedSurface *g, bool forceRedraw = false); -- cgit v1.2.3