1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fixed not working shortcuts on some buttons in main menu

This commit is contained in:
Ivan Savenko
2024-04-11 22:00:54 +03:00
parent 76fd271251
commit ac1c36b7e2
2 changed files with 8 additions and 3 deletions

View File

@@ -241,6 +241,11 @@ std::shared_ptr<CButton> CMenuEntry::createButton(CMenuScreen * parent, const Js
EShortcut shortcut = GH.shortcuts().findShortcut(button["shortcut"].String()); EShortcut shortcut = GH.shortcuts().findShortcut(button["shortcut"].String());
if (shortcut == EShortcut::NONE && !button["shortcut"].String().empty())
{
logGlobal->warn("Unknown shortcut '%s' found when loading main menu config!", button["shortcut"].String());
}
auto result = std::make_shared<CButton>(Point(posx, posy), AnimationPath::fromJson(button["name"]), help, command, shortcut); auto result = std::make_shared<CButton>(Point(posx, posy), AnimationPath::fromJson(button["name"]), help, command, shortcut);
if (button["center"].Bool()) if (button["center"].Bool())

View File

@@ -21,9 +21,9 @@
"name" : "main", "name" : "main",
"buttons": "buttons":
[ [
{"x": 644, "y": 70, "center" : true, "name":"MMENUNG", "shortcut" : "mainMenuNew", "help": 3, "command": "to new"}, {"x": 644, "y": 70, "center" : true, "name":"MMENUNG", "shortcut" : "mainMenuNewGame", "help": 3, "command": "to new"},
{"x": 645, "y": 192, "center" : true, "name":"MMENULG", "shortcut" : "mainMenuLoad", "help": 4, "command": "to load"}, {"x": 645, "y": 192, "center" : true, "name":"MMENULG", "shortcut" : "mainMenuLoadGame", "help": 4, "command": "to load"},
{"x": 643, "y": 296, "center" : true, "name":"MMENUHS", "shortcut" : "mainMenuScores", "help": 5, "command": "highscores"}, {"x": 643, "y": 296, "center" : true, "name":"MMENUHS", "shortcut" : "mainMenuHighScores", "help": 5, "command": "highscores"},
{"x": 643, "y": 414, "center" : true, "name":"MMENUCR", "shortcut" : "mainMenuCredits", "help": 6, "command": "to credits"}, {"x": 643, "y": 414, "center" : true, "name":"MMENUCR", "shortcut" : "mainMenuCredits", "help": 6, "command": "to credits"},
{"x": 643, "y": 520, "center" : true, "name":"MMENUQT", "shortcut" : "mainMenuQuit", "help": 7, "command": "exit"} {"x": 643, "y": 520, "center" : true, "name":"MMENUQT", "shortcut" : "mainMenuQuit", "help": 7, "command": "exit"}
] ]