fix info menu bug on DC/PC

This commit is contained in:
Martin Michelsen
2023-05-26 10:58:17 -07:00
parent dbd6c59a0b
commit de3ea6b850
3 changed files with 6 additions and 2 deletions
+1
View File
@@ -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;
+3
View File
@@ -1061,6 +1061,9 @@ void send_menu_t(shared_ptr<Client> c, shared_ptr<const Menu> 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();
+2 -2
View File
@@ -391,9 +391,9 @@ void ServerState::create_menus(shared_ptr<const JSONObject> config_json) {
shared_ptr<vector<u16string>> information_contents(new vector<u16string>());
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()) {