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.
This commit is contained in:
Edênis Freindorfer Azevedo 2019-06-25 23:30:31 -03:00 committed by Rafael Kitover
parent 9fa20b49ca
commit 8b8efa1b2d
1 changed files with 21 additions and 5 deletions

View File

@ -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);
}
}