From de3ea6b85075105170893d24e5e58a5b7c42d4bc Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Fri, 26 May 2023 10:58:17 -0700 Subject: [PATCH] fix info menu bug on DC/PC --- src/Menu.hh | 1 + src/SendCommands.cc | 3 +++ src/ServerState.cc | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Menu.hh b/src/Menu.hh index 3c7d7936..26c550fd 100644 --- a/src/Menu.hh +++ b/src/Menu.hh @@ -94,6 +94,7 @@ struct MenuItem { REQUIRES_MESSAGE_BOXES = 0x080, REQUIRES_SEND_FUNCTION_CALL = 0x100, REQUIRES_SAVE_DISABLED = 0x200, + INVISIBLE_IN_INFO_MENU = 0x400, }; uint32_t item_id; diff --git a/src/SendCommands.cc b/src/SendCommands.cc index ddf0cae9..b7bd5251 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -1061,6 +1061,9 @@ void send_menu_t(shared_ptr c, shared_ptr menu, bool is_info if (item.flags & MenuItem::Flag::REQUIRES_SAVE_DISABLED) { is_visible &= !(c->flags & Client::Flag::SAVE_ENABLED); } + if (item.flags & MenuItem::Flag::INVISIBLE_IN_INFO_MENU) { + is_visible &= !is_info_menu; + } if (is_visible) { auto& e = entries.emplace_back(); diff --git a/src/ServerState.cc b/src/ServerState.cc index c0ba1c89..132b4c40 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -391,9 +391,9 @@ void ServerState::create_menus(shared_ptr config_json) { shared_ptr> information_contents(new vector()); information_menu_v2->items.emplace_back(InformationMenuItemID::GO_BACK, u"Go back", - u"Return to the\nmain menu", 0); + u"Return to the\nmain menu", MenuItem::Flag::INVISIBLE_IN_INFO_MENU); information_menu_v3->items.emplace_back(InformationMenuItemID::GO_BACK, u"Go back", - u"Return to the\nmain menu", 0); + u"Return to the\nmain menu", MenuItem::Flag::INVISIBLE_IN_INFO_MENU); { uint32_t item_id = 0; for (const auto& item : d.at("InformationMenuContents")->as_list()) {