Skip to content
Permalink
Browse files

fix key shortcuts for save/load states

* Fix key shortcuts for save/load states.

We show the wrong description for these shortcuts, although it works
correctly for the keybinding.

* Use the proper labels for save/load states.
  • Loading branch information
denisfa authored and rkitover committed Jun 26, 2019
1 parent 9fa20b4 commit 8b8efa1b2deffe15581d53058510969b908dc9e3
Showing with 21 additions and 5 deletions.
  1. +21 −5 src/wx/guiinit.cpp
@@ -2244,12 +2244,28 @@ void MainFrame::add_menu_accels(wxTreeCtrl* tc, wxTreeItemId& parent, wxMenu* me
// but then if the user overides main menu, that req. is broken..
wxString txt = (*mi)->GetItemLabelText();

for (int i = 0; i < 10; i++)
if (*mi == loadst_mi[i] || *mi == savest_mi[i]) {
txt = cmdtab[i].name;
break;
// we could probably have a global hashmap:
// cmdtab[i].cmd -> cmdtab[i]
for (int i = 0; i < 10; i++) {
wxString slot;
if (*mi == loadst_mi[i]) {
slot.Printf(wxT("LoadGame%02d"), wxAtoi(txt));
}

else if (*mi == savest_mi[i]) {
slot.Printf(wxT("SaveGame%02d"), wxAtoi(txt));
}
else {
continue;
}
for (int j = 0; j < ncmds; ++j) {
if (cmdtab[j].cmd == slot) {
txt = cmdtab[j].name;
break;
}
}
// no need to look further
break;
}
tc->AppendItem(parent, txt, -1, -1, val);
}
}

0 comments on commit 8b8efa1

Please sign in to comment.
You can’t perform that action at this time.