summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_gui.cpp56
-rw-r--r--src/airport_gui.cpp16
-rw-r--r--src/dock_gui.cpp28
-rw-r--r--src/hotkeys.cpp117
-rw-r--r--src/hotkeys.h100
-rw-r--r--src/main_gui.cpp86
-rw-r--r--src/order_gui.cpp32
-rw-r--r--src/rail_gui.cpp40
-rw-r--r--src/road_gui.cpp36
-rw-r--r--src/signs_gui.cpp14
-rw-r--r--src/terraform_gui.cpp54
-rw-r--r--src/toolbar_gui.cpp140
12 files changed, 335 insertions, 384 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index c16efee88..d49657bd8 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -1309,7 +1309,7 @@ struct AIDebugWindow : public Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
- int num = CheckHotkeyMatch(aidebug_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(aidebug_hotkeys, keycode);
if (num != -1) {
if (this->show_break_box && num == WID_AID_BREAK_STR_EDIT_BOX) {
this->SetFocusedWidget(WID_AID_BREAK_STR_EDIT_BOX);
@@ -1400,7 +1400,7 @@ struct AIDebugWindow : public Window {
this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL);
}
- static Hotkey<AIDebugWindow> aidebug_hotkeys[];
+ static Hotkey aidebug_hotkeys[];
};
const int AIDebugWindow::top_offset = WD_FRAMERECT_TOP + 2;
@@ -1417,32 +1417,32 @@ NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index)
return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
}
-Hotkey<AIDebugWindow> AIDebugWindow::aidebug_hotkeys[] = {
- Hotkey<AIDebugWindow>('1', "company_1", WID_AID_COMPANY_BUTTON_START),
- Hotkey<AIDebugWindow>('2', "company_2", WID_AID_COMPANY_BUTTON_START + 1),
- Hotkey<AIDebugWindow>('3', "company_3", WID_AID_COMPANY_BUTTON_START + 2),
- Hotkey<AIDebugWindow>('4', "company_4", WID_AID_COMPANY_BUTTON_START + 3),
- Hotkey<AIDebugWindow>('5', "company_5", WID_AID_COMPANY_BUTTON_START + 4),
- Hotkey<AIDebugWindow>('6', "company_6", WID_AID_COMPANY_BUTTON_START + 5),
- Hotkey<AIDebugWindow>('7', "company_7", WID_AID_COMPANY_BUTTON_START + 6),
- Hotkey<AIDebugWindow>('8', "company_8", WID_AID_COMPANY_BUTTON_START + 7),
- Hotkey<AIDebugWindow>('9', "company_9", WID_AID_COMPANY_BUTTON_START + 8),
- Hotkey<AIDebugWindow>((uint16)0, "company_10", WID_AID_COMPANY_BUTTON_START + 9),
- Hotkey<AIDebugWindow>((uint16)0, "company_11", WID_AID_COMPANY_BUTTON_START + 10),
- Hotkey<AIDebugWindow>((uint16)0, "company_12", WID_AID_COMPANY_BUTTON_START + 11),
- Hotkey<AIDebugWindow>((uint16)0, "company_13", WID_AID_COMPANY_BUTTON_START + 12),
- Hotkey<AIDebugWindow>((uint16)0, "company_14", WID_AID_COMPANY_BUTTON_START + 13),
- Hotkey<AIDebugWindow>((uint16)0, "company_15", WID_AID_COMPANY_BUTTON_START + 14),
- Hotkey<AIDebugWindow>('S', "settings", WID_AID_SETTINGS),
- Hotkey<AIDebugWindow>('0', "game_script", WID_AID_SCRIPT_GAME),
- Hotkey<AIDebugWindow>((uint16)0, "reload", WID_AID_RELOAD_TOGGLE),
- Hotkey<AIDebugWindow>('B', "break_toggle", WID_AID_BREAK_STR_ON_OFF_BTN),
- Hotkey<AIDebugWindow>('F', "break_string", WID_AID_BREAK_STR_EDIT_BOX),
- Hotkey<AIDebugWindow>('C', "match_case", WID_AID_MATCH_CASE_BTN),
- Hotkey<AIDebugWindow>(WKC_RETURN, "continue", WID_AID_CONTINUE_BTN),
- HOTKEY_LIST_END(AIDebugWindow)
+Hotkey AIDebugWindow::aidebug_hotkeys[] = {
+ Hotkey('1', "company_1", WID_AID_COMPANY_BUTTON_START),
+ Hotkey('2', "company_2", WID_AID_COMPANY_BUTTON_START + 1),
+ Hotkey('3', "company_3", WID_AID_COMPANY_BUTTON_START + 2),
+ Hotkey('4', "company_4", WID_AID_COMPANY_BUTTON_START + 3),
+ Hotkey('5', "company_5", WID_AID_COMPANY_BUTTON_START + 4),
+ Hotkey('6', "company_6", WID_AID_COMPANY_BUTTON_START + 5),
+ Hotkey('7', "company_7", WID_AID_COMPANY_BUTTON_START + 6),
+ Hotkey('8', "company_8", WID_AID_COMPANY_BUTTON_START + 7),
+ Hotkey('9', "company_9", WID_AID_COMPANY_BUTTON_START + 8),
+ Hotkey((uint16)0, "company_10", WID_AID_COMPANY_BUTTON_START + 9),
+ Hotkey((uint16)0, "company_11", WID_AID_COMPANY_BUTTON_START + 10),
+ Hotkey((uint16)0, "company_12", WID_AID_COMPANY_BUTTON_START + 11),
+ Hotkey((uint16)0, "company_13", WID_AID_COMPANY_BUTTON_START + 12),
+ Hotkey((uint16)0, "company_14", WID_AID_COMPANY_BUTTON_START + 13),
+ Hotkey((uint16)0, "company_15", WID_AID_COMPANY_BUTTON_START + 14),
+ Hotkey('S', "settings", WID_AID_SETTINGS),
+ Hotkey('0', "game_script", WID_AID_SCRIPT_GAME),
+ Hotkey((uint16)0, "reload", WID_AID_RELOAD_TOGGLE),
+ Hotkey('B', "break_toggle", WID_AID_BREAK_STR_ON_OFF_BTN),
+ Hotkey('F', "break_string", WID_AID_BREAK_STR_EDIT_BOX),
+ Hotkey('C', "match_case", WID_AID_MATCH_CASE_BTN),
+ Hotkey(WKC_RETURN, "continue", WID_AID_CONTINUE_BTN),
+ HOTKEY_LIST_END
};
-Hotkey<AIDebugWindow> *_aidebug_hotkeys = AIDebugWindow::aidebug_hotkeys;
+Hotkey *_aidebug_hotkeys = AIDebugWindow::aidebug_hotkeys;
/** Widgets for the AI debug window. */
static const NWidgetPart _nested_ai_debug_widgets[] = {
@@ -1520,7 +1520,7 @@ Window *ShowAIDebugWindow(CompanyID show_company)
*/
EventState AIDebugGlobalHotkeys(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch<AIDebugWindow>(_aidebug_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_aidebug_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowAIDebugWindow(INVALID_COMPANY);
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index dc862fe26..564941d24 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -102,7 +102,7 @@ struct BuildAirToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(airtoolbar_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(airtoolbar_hotkeys, keycode);
if (num == -1) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
return ES_HANDLED;
@@ -143,15 +143,15 @@ struct BuildAirToolbarWindow : Window {
DeleteWindowById(WC_SELECT_STATION, 0);
}
- static Hotkey<BuildAirToolbarWindow> airtoolbar_hotkeys[];
+ static Hotkey airtoolbar_hotkeys[];
};
-Hotkey<BuildAirToolbarWindow> BuildAirToolbarWindow::airtoolbar_hotkeys[] = {
- Hotkey<BuildAirToolbarWindow>('1', "airport", WID_AT_AIRPORT),
- Hotkey<BuildAirToolbarWindow>('2', "demolish", WID_AT_DEMOLISH),
- HOTKEY_LIST_END(BuildAirToolbarWindow)
+Hotkey BuildAirToolbarWindow::airtoolbar_hotkeys[] = {
+ Hotkey('1', "airport", WID_AT_AIRPORT),
+ Hotkey('2', "demolish", WID_AT_DEMOLISH),
+ HOTKEY_LIST_END
};
-Hotkey<BuildAirToolbarWindow> *_airtoolbar_hotkeys = BuildAirToolbarWindow::airtoolbar_hotkeys;
+Hotkey *_airtoolbar_hotkeys = BuildAirToolbarWindow::airtoolbar_hotkeys;
static const NWidgetPart _nested_air_toolbar_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -191,7 +191,7 @@ Window *ShowBuildAirToolbar()
EventState AirportToolbarGlobalHotkeys(uint16 key, uint16 keycode)
{
if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
- int num = CheckHotkeyMatch<BuildAirToolbarWindow>(_airtoolbar_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_airtoolbar_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildAirToolbar();
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 31a259b8f..56f426a41 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -166,7 +166,7 @@ struct BuildDocksToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(dockstoolbar_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(dockstoolbar_hotkeys, keycode);
if (num == -1) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
return ES_HANDLED;
@@ -274,23 +274,23 @@ struct BuildDocksToolbarWindow : Window {
VpSetPresizeRange(tile_from, tile_to);
}
- static Hotkey<BuildDocksToolbarWindow> dockstoolbar_hotkeys[];
+ static Hotkey dockstoolbar_hotkeys[];
};
const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
-Hotkey<BuildDocksToolbarWindow> BuildDocksToolbarWindow::dockstoolbar_hotkeys[] = {
- Hotkey<BuildDocksToolbarWindow>('1', "canal", WID_DT_CANAL),
- Hotkey<BuildDocksToolbarWindow>('2', "lock", WID_DT_LOCK),
- Hotkey<BuildDocksToolbarWindow>('3', "demolish", WID_DT_DEMOLISH),
- Hotkey<BuildDocksToolbarWindow>('4', "depot", WID_DT_DEPOT),
- Hotkey<BuildDocksToolbarWindow>('5', "dock", WID_DT_STATION),
- Hotkey<BuildDocksToolbarWindow>('6', "buoy", WID_DT_BUOY),
- Hotkey<BuildDocksToolbarWindow>('7', "river", WID_DT_RIVER),
- Hotkey<BuildDocksToolbarWindow>(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
- HOTKEY_LIST_END(BuildDocksToolbarWindow)
+Hotkey BuildDocksToolbarWindow::dockstoolbar_hotkeys[] = {
+ Hotkey('1', "canal", WID_DT_CANAL),
+ Hotkey('2', "lock", WID_DT_LOCK),
+ Hotkey('3', "demolish", WID_DT_DEMOLISH),
+ Hotkey('4', "depot", WID_DT_DEPOT),
+ Hotkey('5', "dock", WID_DT_STATION),
+ Hotkey('6', "buoy", WID_DT_BUOY),
+ Hotkey('7', "river", WID_DT_RIVER),
+ Hotkey(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
+ HOTKEY_LIST_END
};
-Hotkey<BuildDocksToolbarWindow> *_dockstoolbar_hotkeys = BuildDocksToolbarWindow::dockstoolbar_hotkeys;
+Hotkey *_dockstoolbar_hotkeys = BuildDocksToolbarWindow::dockstoolbar_hotkeys;
/**
* Nested widget parts of docks toolbar, game version.
@@ -338,7 +338,7 @@ Window *ShowBuildDocksToolbar()
EventState DockToolbarGlobalHotkeys(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch<BuildDocksToolbarWindow>(_dockstoolbar_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_dockstoolbar_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildDocksToolbar();
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp
index a41ede7e4..38fa662ca 100644
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -116,8 +116,7 @@ static uint16 ParseKeycode(const char *start, const char *end)
* @param hotkey The hotkey object to add the keycodes to
* @param value The string to parse
*/
-template<class T>
-static void ParseHotkeys(Hotkey<T> *hotkey, const char *value)
+static void ParseHotkeys(Hotkey *hotkey, const char *value)
{
const char *start = value;
while (*start != '\0') {
@@ -192,8 +191,7 @@ static const char *KeycodeToString(uint16 keycode)
* @note The return value is a static buffer, strdup the result before calling
* this function again.
*/
-template<class T>
-const char *SaveKeycodes(const Hotkey<T> *hotkey)
+const char *SaveKeycodes(const Hotkey *hotkey)
{
static char buf[128];
buf[0] = '\0';
@@ -205,11 +203,50 @@ const char *SaveKeycodes(const Hotkey<T> *hotkey)
return buf;
}
-template<class T>
-void LoadHotkeyGroup(IniGroup *group, T *hotkey_list)
+/**
+ * Create a new Hotkey object with a single default keycode.
+ * @param default_keycode The default keycode for this hotkey.
+ * @param name The name of this hotkey.
+ * @param num Number of this hotkey, should be unique within the hotkey list.
+ */
+Hotkey::Hotkey(uint16 default_keycode, const char *name, int num) :
+ name(name),
+ num(num)
+{
+ if (default_keycode != 0) this->AddKeycode(default_keycode);
+}
+
+/**
+ * Create a new Hotkey object with multiple default keycodes.
+ * @param default_keycodes An array of default keycodes terminated with 0.
+ * @param name The name of this hotkey.
+ * @param num Number of this hotkey, should be unique within the hotkey list.
+ */
+Hotkey::Hotkey(const uint16 *default_keycodes, const char *name, int num) :
+ name(name),
+ num(num)
+{
+ const uint16 *keycode = default_keycodes;
+ while (*keycode != 0) {
+ this->AddKeycode(*keycode);
+ keycode++;
+ }
+}
+
+/**
+ * Add a keycode to this hotkey, from now that keycode will be matched
+ * in addition to any previously added keycodes.
+ * @param keycode The keycode to add.
+ */
+void Hotkey::AddKeycode(uint16 keycode)
+{
+ this->keycodes.Include(keycode);
+}
+
+void LoadHotkeyGroup(IniGroup *group, Hotkey *hotkey_list)
{
for (uint i = 0; hotkey_list[i].num != -1; i++) {
- T *hotkey = &hotkey_list[i];
+ Hotkey *hotkey = &hotkey_list[i];
IniItem *item = group->GetItem(hotkey->name, false);
if (item != NULL) {
hotkey->keycodes.Clear();
@@ -218,18 +255,16 @@ void LoadHotkeyGroup(IniGroup *group, T *hotkey_list)
}
}
-template<class T>
-void SaveHotkeyGroup(IniGroup *group, T *hotkey_list)
+void SaveHotkeyGroup(IniGroup *group, const Hotkey *hotkey_list)
{
for (uint i = 0; hotkey_list[i].num != -1; i++) {
- T *hotkey = &hotkey_list[i];
+ const Hotkey *hotkey = &hotkey_list[i];
IniItem *item = group->GetItem(hotkey->name, true);
item->SetValue(SaveKeycodes(hotkey));
}
}
-template<class T>
-void SaveLoadHotkeyGroup(IniGroup *group, T *hotkey_list, bool save)
+void SaveLoadHotkeyGroup(IniGroup *group, Hotkey *hotkey_list, bool save)
{
if (save) {
SaveHotkeyGroup(group, hotkey_list);
@@ -238,18 +273,24 @@ void SaveLoadHotkeyGroup(IniGroup *group, T *hotkey_list, bool save)
}
}
-struct MainWindow;
-struct MainToolbarWindow;
-struct ScenarioEditorToolbarWindow;
-struct TerraformToolbarWindow;
-struct ScenarioEditorLandscapeGenerationWindow;
-struct OrdersWindow;
-struct BuildAirToolbarWindow;
-struct BuildDocksToolbarWindow;
-struct BuildRailToolbarWindow;
-struct BuildRoadToolbarWindow;
-struct SignListWindow;
-struct AIDebugWindow;
+/**
+ * Check if a keycode is bound to something.
+ * @param list The list with hotkeys to check
+ * @param keycode The keycode that was pressed
+ * @param global_only Limit the search to hotkeys defined as 'global'.
+ * @return The number of the matching hotkey or -1.
+ */
+int CheckHotkeyMatch(Hotkey *list, uint16 keycode, bool global_only)
+{
+ while (list->num != -1) {
+ if (list->keycodes.Contains(keycode | WKC_GLOBAL_HOTKEY) || (!global_only && list->keycodes.Contains(keycode))) {
+ return list->num;
+ }
+ list++;
+ }
+ return -1;
+}
+
static void SaveLoadHotkeys(bool save)
{
@@ -258,23 +299,23 @@ static void SaveLoadHotkeys(bool save)
IniGroup *group;
-#define SL_HOTKEYS(name, window_name) \
- extern Hotkey<window_name> *_##name##_hotkeys;\
+#define SL_HOTKEYS(name) \
+ extern Hotkey *_##name##_hotkeys;\
group = ini->GetGroup(#name);\
SaveLoadHotkeyGroup(group, _##name##_hotkeys, save);
- SL_HOTKEYS(global, MainWindow);
- SL_HOTKEYS(maintoolbar, MainToolbarWindow);
- SL_HOTKEYS(scenedit_maintoolbar, ScenarioEditorToolbarWindow);
- SL_HOTKEYS(terraform, TerraformToolbarWindow);
- SL_HOTKEYS(terraform_editor, ScenarioEditorLandscapeGenerationWindow);
- SL_HOTKEYS(order, OrdersWindow);
- SL_HOTKEYS(airtoolbar, BuildAirToolbarWindow);
- SL_HOTKEYS(dockstoolbar, BuildDocksToolbarWindow);
- SL_HOTKEYS(railtoolbar, BuildRailToolbarWindow);
- SL_HOTKEYS(roadtoolbar, BuildRoadToolbarWindow);
- SL_HOTKEYS(signlist, SignListWindow);
- SL_HOTKEYS(aidebug, AIDebugWindow);
+ SL_HOTKEYS(global);
+ SL_HOTKEYS(maintoolbar);
+ SL_HOTKEYS(scenedit_maintoolbar);
+ SL_HOTKEYS(terraform);
+ SL_HOTKEYS(terraform_editor);
+ SL_HOTKEYS(order);
+ SL_HOTKEYS(airtoolbar);
+ SL_HOTKEYS(dockstoolbar);
+ SL_HOTKEYS(railtoolbar);
+ SL_HOTKEYS(roadtoolbar);
+ SL_HOTKEYS(signlist);
+ SL_HOTKEYS(aidebug);
#undef SL_HOTKEYS
diff --git a/src/hotkeys.h b/src/hotkeys.h
index b87787e1b..87fafe2a1 100644
--- a/src/hotkeys.h
+++ b/src/hotkeys.h
@@ -19,110 +19,20 @@
* All data for a single hotkey. The name (for saving/loading a configfile),
* a list of keycodes and a number to help identifying this hotkey.
*/
-template<class T>
struct Hotkey {
- typedef void (T::*hotkey_callback)(int);
+ Hotkey(uint16 default_keycode, const char *name, int num);
+ Hotkey(const uint16 *default_keycodes, const char *name, int num);
- /**
- * A wrapper around the callback function. This wrapper is needed because
- * the size of a pointer to a member function depends on the class
- * definition. The possible solutions are to either wrap the callback
- * pointer in a class and dynamically allocate memory for it like we do
- * now or making all class definitions available in hotkeys.cpp.
- */
- struct CallbackWrapper {
- CallbackWrapper(hotkey_callback callback) :
- callback(callback)
- {}
- hotkey_callback callback;
- };
-
- /**
- * Create a new Hotkey object with a single default keycode.
- * @param default_keycode The default keycode for this hotkey.
- * @param name The name of this hotkey.
- * @param num Number of this hotkey, should be unique within the hotkey list.
- * @param callback The function to call if the hotkey is pressed.
- */
- Hotkey(uint16 default_keycode, const char *name, int num, hotkey_callback callback = NULL) :
- name(name),
- num(num)
- {
- if (callback == NULL) {
- this->callback = NULL;
- } else {
- this->callback = new CallbackWrapper(callback);
- }
- if (default_keycode != 0) this->AddKeycode(default_keycode);
- }
-
- /**
- * Create a new Hotkey object with multiple default keycodes.
- * @param default_keycodes An array of default keycodes terminated with 0.
- * @param name The name of this hotkey.
- * @param num Number of this hotkey, should be unique within the hotkey list.
- * @param callback The function to call if the hotkey is pressed.
- */
- Hotkey(const uint16 *default_keycodes, const char *name, int num, hotkey_callback callback = NULL) :
- name(name),
- num(num)
- {
- if (callback == NULL) {
- this->callback = NULL;
- } else {
- this->callback = new CallbackWrapper(callback);
- }
-
- const uint16 *keycode = default_keycodes;
- while (*keycode != 0) {
- this->AddKeycode(*keycode);
- keycode++;
- }
- }
-
- ~Hotkey()
- {
- delete this->callback;
- }
-
- /**
- * Add a keycode to this hotkey, from now that keycode will be matched
- * in addition to any previously added keycodes.
- * @param keycode The keycode to add.
- */
- void AddKeycode(uint16 keycode)
- {
- this->keycodes.Include(keycode);
- }
+ void AddKeycode(uint16 keycode);
const char *name;
int num;
SmallVector<uint16, 1> keycodes;
- CallbackWrapper *callback;
};
-#define HOTKEY_LIST_END(window_class) Hotkey<window_class>((uint16)0, NULL, -1)
+#define HOTKEY_LIST_END Hotkey((uint16)0, NULL, -1)
-/**
- * Check if a keycode is bound to something.
- * @param list The list with hotkeys to check
- * @param keycode The keycode that was pressed
- * @param w The window-pointer to give to the callback function (if any).
- * @param global_only Limit the search to hotkeys defined as 'global'.
- * @return The number of the matching hotkey or -1.
- */
-template<class T>
-int CheckHotkeyMatch(Hotkey<T> *list, uint16 keycode, T *w, bool global_only = false)
-{
- while (list->num != -1) {
- if (list->keycodes.Contains(keycode | WKC_GLOBAL_HOTKEY) || (!global_only && list->keycodes.Contains(keycode))) {
- if (!global_only && list->callback != NULL) (w->*(list->callback->callback))(-1);
- return list->num;
- }
- list++;
- }
- return -1;
-}
+int CheckHotkeyMatch(Hotkey *list, uint16 keycode, bool global_only = false);
bool IsQuitKey(uint16 keycode);
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 99857bff7..ae1b3c1b7 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -289,7 +289,7 @@ struct MainWindow : Window
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(global_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(global_hotkeys, keycode);
if (num == GHK_QUIT) {
HandleExitGameRequest();
return ES_HANDLED;
@@ -465,7 +465,7 @@ struct MainWindow : Window
InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
}
- static Hotkey<MainWindow> global_hotkeys[];
+ static Hotkey global_hotkeys[];
};
const uint16 _ghk_quit_keys[] = {'Q' | WKC_CTRL, 'Q' | WKC_META, 0};
@@ -475,51 +475,51 @@ const uint16 _ghk_chat_all_keys[] = {WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T', 0}
const uint16 _ghk_chat_company_keys[] = {WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T', 0};
const uint16 _ghk_chat_server_keys[] = {WKC_CTRL | WKC_SHIFT | WKC_RETURN, WKC_CTRL | WKC_SHIFT | 'T', 0};
-Hotkey<MainWindow> MainWindow::global_hotkeys[] = {
- Hotkey<MainWindow>(_ghk_quit_keys, "quit", GHK_QUIT),
- Hotkey<MainWindow>(_ghk_abandon_keys, "abandon", GHK_ABANDON),
- Hotkey<MainWindow>(WKC_BACKQUOTE, "console", GHK_CONSOLE),
- Hotkey<MainWindow>('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
- Hotkey<MainWindow>('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
- Hotkey<MainWindow>('C', "center", GHK_CENTER),
- Hotkey<MainWindow>('Z', "center_zoom", GHK_CENTER_ZOOM),
- Hotkey<MainWindow>(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
- Hotkey<MainWindow>(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
- Hotkey<MainWindow>(WKC_DELETE | WKC_SHIFT, "delete_all_windows", GHK_DELETE_NONVITAL_WINDOWS),
- Hotkey<MainWindow>('R' | WKC_CTRL, "refresh_screen", GHK_REFRESH_SCREEN),
+Hotkey MainWindow::global_hotkeys[] = {
+ Hotkey(_ghk_quit_keys, "quit", GHK_QUIT),
+ Hotkey(_ghk_abandon_keys, "abandon", GHK_ABANDON),
+ Hotkey(WKC_BACKQUOTE, "console", GHK_CONSOLE),
+ Hotkey('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
+ Hotkey('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
+ Hotkey('C', "center", GHK_CENTER),
+ Hotkey('Z', "center_zoom", GHK_CENTER_ZOOM),
+ Hotkey(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
+ Hotkey(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
+ Hotkey(WKC_DELETE | WKC_SHIFT, "delete_all_windows", GHK_DELETE_NONVITAL_WINDOWS),
+ Hotkey('R' | WKC_CTRL, "refresh_screen", GHK_REFRESH_SCREEN),
#if defined(_DEBUG)
- Hotkey<MainWindow>('0' | WKC_ALT, "crash_game", GHK_CRASH),
- Hotkey<MainWindow>('1' | WKC_ALT, "money", GHK_MONEY),
- Hotkey<MainWindow>('2' | WKC_ALT, "update_coordinates", GHK_UPDATE_COORDS),
+ Hotkey('0' | WKC_ALT, "crash_game", GHK_CRASH),
+ Hotkey('1' | WKC_ALT, "money", GHK_MONEY),
+ Hotkey('2' | WKC_ALT, "update_coordinates", GHK_UPDATE_COORDS),
#endif
- Hotkey<MainWindow>('1' | WKC_CTRL, "transparency_signs", GHK_TOGGLE_TRANSPARENCY),
- Hotkey<MainWindow>('2' | WKC_CTRL, "transparency_trees", GHK_TOGGLE_TRANSPARENCY + 1),
- Hotkey<MainWindow>('3' | WKC_CTRL, "transparency_houses", GHK_TOGGLE_TRANSPARENCY + 2),
- Hotkey<MainWindow>('4' | WKC_CTRL, "transparency_industries", GHK_TOGGLE_TRANSPARENCY + 3),
- Hotkey<MainWindow>('5' | WKC_CTRL, "transparency_buildings", GHK_TOGGLE_TRANSPARENCY + 4),
- Hotkey<MainWindow>('6' | WKC_CTRL, "transparency_bridges", GHK_TOGGLE_TRANSPARENCY + 5),
- Hotkey<MainWindow>('7' | WKC_CTRL, "transparency_structures", GHK_TOGGLE_TRANSPARENCY + 6),
- Hotkey<MainWindow>('8' | WKC_CTRL, "transparency_catenary", GHK_TOGGLE_TRANSPARENCY + 7),
- Hotkey<MainWindow>('9' | WKC_CTRL, "transparency_loading", GHK_TOGGLE_TRANSPARENCY + 8),
- Hotkey<MainWindow>('1' | WKC_CTRL | WKC_SHIFT, "invisibility_signs", GHK_TOGGLE_INVISIBILITY),
- Hotkey<MainWindow>('2' | WKC_CTRL | WKC_SHIFT, "invisibility_trees", GHK_TOGGLE_INVISIBILITY + 1),
- Hotkey<MainWindow>('3' | WKC_CTRL | WKC_SHIFT, "invisibility_houses", GHK_TOGGLE_INVISIBILITY + 2),
- Hotkey<MainWindow>('4' | WKC_CTRL | WKC_SHIFT, "invisibility_industries", GHK_TOGGLE_INVISIBILITY + 3),
- Hotkey<MainWindow>('5' | WKC_CTRL | WKC_SHIFT, "invisibility_buildings", GHK_TOGGLE_INVISIBILITY + 4),
- Hotkey<MainWindow>('6' | WKC_CTRL | WKC_SHIFT, "invisibility_bridges", GHK_TOGGLE_INVISIBILITY + 5),
- Hotkey<MainWindow>('7' | WKC_CTRL | WKC_SHIFT, "invisibility_structures", GHK_TOGGLE_INVISIBILITY + 6),
- Hotkey<MainWindow>('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7),
- Hotkey<MainWindow>('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR),
- Hotkey<MainWindow>('X', "toggle_transparency", GHK_TRANSPARANCY),
+ Hotkey('1' | WKC_CTRL, "transparency_signs", GHK_TOGGLE_TRANSPARENCY),
+ Hotkey('2' | WKC_CTRL, "transparency_trees", GHK_TOGGLE_TRANSPARENCY + 1),
+ Hotkey('3' | WKC_CTRL, "transparency_houses", GHK_TOGGLE_TRANSPARENCY + 2),
+ Hotkey('4' | WKC_CTRL, "transparency_industries", GHK_TOGGLE_TRANSPARENCY + 3),
+ Hotkey('5' | WKC_CTRL, "transparency_buildings", GHK_TOGGLE_TRANSPARENCY + 4),
+ Hotkey('6' | WKC_CTRL, "transparency_bridges", GHK_TOGGLE_TRANSPARENCY + 5),
+ Hotkey('7' | WKC_CTRL, "transparency_structures", GHK_TOGGLE_TRANSPARENCY + 6),
+ Hotkey('8' | WKC_CTRL, "transparency_catenary", GHK_TOGGLE_TRANSPARENCY + 7),
+ Hotkey('9' | WKC_CTRL, "transparency_loading", GHK_TOGGLE_TRANSPARENCY + 8),
+ Hotkey('1' | WKC_CTRL | WKC_SHIFT, "invisibility_signs", GHK_TOGGLE_INVISIBILITY),
+ Hotkey('2' | WKC_CTRL | WKC_SHIFT, "invisibility_trees", GHK_TOGGLE_INVISIBILITY + 1),
+ Hotkey('3' | WKC_CTRL | WKC_SHIFT, "invisibility_houses", GHK_TOGGLE_INVISIBILITY + 2),
+ Hotkey('4' | WKC_CTRL | WKC_SHIFT, "invisibility_industries", GHK_TOGGLE_INVISIBILITY + 3),
+ Hotkey('5' | WKC_CTRL | WKC_SHIFT, "invisibility_buildings", GHK_TOGGLE_INVISIBILITY + 4),
+ Hotkey('6' | WKC_CTRL | WKC_SHIFT, "invisibility_bridges", GHK_TOGGLE_INVISIBILITY + 5),
+ Hotkey('7' | WKC_CTRL | WKC_SHIFT, "invisibility_structures", GHK_TOGGLE_INVISIBILITY + 6),
+ Hotkey('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7),
+ Hotkey('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR),
+ Hotkey('X', "toggle_transparency", GHK_TRANSPARANCY),
#ifdef ENABLE_NETWORK
- Hotkey<MainWindow>(_ghk_chat_keys, "chat", GHK_CHAT),
- Hotkey<MainWindow>(_ghk_chat_all_keys, "chat_all", GHK_CHAT_ALL),
- Hotkey<MainWindow>(_ghk_chat_company_keys, "chat_company", GHK_CHAT_COMPANY),
- Hotkey<MainWindow>(_ghk_chat_server_keys, "chat_server", GHK_CHAT_SERVER),
+ Hotkey(_ghk_chat_keys, "chat", GHK_CHAT),
+ Hotkey(_ghk_chat_all_keys, "chat_all", GHK_CHAT_ALL),
+ Hotkey(_ghk_chat_company_keys, "chat_company", GHK_CHAT_COMPANY),
+ Hotkey(_ghk_chat_server_keys, "chat_server", GHK_CHAT_SERVER),
#endif
- HOTKEY_LIST_END(MainWindow)
+ HOTKEY_LIST_END
};
-Hotkey<MainWindow> *_global_hotkeys = MainWindow::global_hotkeys;
+Hotkey *_global_hotkeys = MainWindow::global_hotkeys;
/**
* Does the given keycode match one of the keycodes bound to 'quit game'?
@@ -528,7 +528,7 @@ Hotkey<MainWindow> *_global_hotkeys = MainWindow::global_hotkeys;
*/
bool IsQuitKey(uint16 keycode)
{
- int num = CheckHotkeyMatch<MainWindow>(_global_hotkeys, keycode, NULL);
+ int num = CheckHotkeyMatch(_global_hotkeys, keycode);
return num == GHK_QUIT;
}
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 05cb017b1..daa3462dd 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1440,7 +1440,7 @@ public:
{
if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED;
- switch (CheckHotkeyMatch<OrdersWindow>(order_hotkeys, keycode, this)) {
+ switch (CheckHotkeyMatch(order_hotkeys, keycode)) {
case OHK_SKIP: this->OrderClick_Skip(); break;
case OHK_DELETE: this->OrderClick_Delete(); break;
case OHK_GOTO: this->OrderClick_Goto(); break;
@@ -1526,24 +1526,24 @@ public:
this->vscroll->SetCapacityFromWidget(this, WID_O_ORDER_LIST);
}
- static Hotkey<OrdersWindow> order_hotkeys[];
+ static Hotkey order_hotkeys[];
};
-Hotkey<OrdersWindow> OrdersWindow::order_hotkeys[] = {
- Hotkey<OrdersWindow>('D', "skip", OHK_SKIP),
- Hotkey<OrdersWindow>('F', "delete", OHK_DELETE),
- Hotkey<OrdersWindow>('G', "goto", OHK_GOTO),
- Hotkey<OrdersWindow>('H', "nonstop", OHK_NONSTOP),
- Hotkey<OrdersWindow>('J', "fullload", OHK_FULLLOAD),
- Hotkey<OrdersWindow>('K', "unload", OHK_UNLOAD),
- Hotkey<OrdersWindow>((uint16)0, "nearest_depot", OHK_NEAREST_DEPOT),
- Hotkey<OrdersWindow>((uint16)0, "always_service", OHK_ALWAYS_SERVICE),
- Hotkey<OrdersWindow>((uint16)0, "transfer", OHK_TRANSFER),
- Hotkey<OrdersWindow>((uint16)0, "no_unload", OHK_NO_UNLOAD),
- Hotkey<OrdersWindow>((uint16)0, "no_load", OHK_NO_LOAD),
- HOTKEY_LIST_END(OrdersWindow)
+Hotkey OrdersWindow::order_hotkeys[] = {
+ Hotkey('D', "skip", OHK_SKIP),
+ Hotkey('F', "delete", OHK_DELETE),
+ Hotkey('G', "goto", OHK_GOTO),
+ Hotkey('H', "nonstop", OHK_NONSTOP),
+ Hotkey('J', "fullload", OHK_FULLLOAD),
+ Hotkey('K', "unload", OHK_UNLOAD),
+ Hotkey((uint16)0, "nearest_depot", OHK_NEAREST_DEPOT),
+ Hotkey((uint16)0, "always_service", OHK_ALWAYS_SERVICE),
+ Hotkey((uint16)0, "transfer", OHK_TRANSFER),
+ Hotkey((uint16)0, "no_unload", OHK_NO_UNLOAD),
+ Hotkey((uint16)0, "no_load", OHK_NO_LOAD),
+ HOTKEY_LIST_END
};
-Hotkey<OrdersWindow> *_order_hotkeys = OrdersWindow::order_hotkeys;
+Hotkey *_order_hotkeys = OrdersWindow::order_hotkeys;
/** Nested widget definition for "your" train orders. */
static const NWidgetPart _nested_orders_train_widgets[] = {
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 4fde260a6..eee4e26bf 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -599,7 +599,7 @@ struct BuildRailToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(railtoolbar_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(railtoolbar_hotkeys, keycode);
if (num == -1) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
MarkTileDirtyByTile(TileVirtXY(_thd.pos.x, _thd.pos.y)); // redraw tile selection
@@ -755,29 +755,29 @@ struct BuildRailToolbarWindow : Window {
return ES_NOT_HANDLED;
}
- static Hotkey<BuildRailToolbarWindow> railtoolbar_hotkeys[];
+ static Hotkey railtoolbar_hotkeys[];
};
const uint16 _railtoolbar_autorail_keys[] = {'5', 'A' | WKC_GLOBAL_HOTKEY, 0};
-Hotkey<BuildRailToolbarWindow> BuildRailToolbarWindow::railtoolbar_hotkeys[] = {
- Hotkey<BuildRailToolbarWindow>('1', "build_ns", WID_RAT_BUILD_NS),
- Hotkey<BuildRailToolbarWindow>('2', "build_x", WID_RAT_BUILD_X),
- Hotkey<BuildRailToolbarWindow>('3', "build_ew", WID_RAT_BUILD_EW),
- Hotkey<BuildRailToolbarWindow>('4', "build_y", WID_RAT_BUILD_Y),
- Hotkey<BuildRailToolbarWindow>(_railtoolbar_autorail_keys, "autorail", WID_RAT_AUTORAIL),
- Hotkey<BuildRailToolbarWindow>('6', "demolish", WID_RAT_DEMOLISH),
- Hotkey<BuildRailToolbarWindow>('7', "depot", WID_RAT_BUILD_DEPOT),
- Hotkey<BuildRailToolbarWindow>('8', "waypoint", WID_RAT_BUILD_WAYPOINT),
- Hotkey<BuildRailToolbarWindow>('9', "station", WID_RAT_BUILD_STATION),
- Hotkey<BuildRailToolbarWindow>('S', "signal", WID_RAT_BUILD_SIGNALS),
- Hotkey<BuildRailToolbarWindow>('B', "bridge", WID_RAT_BUILD_BRIDGE),
- Hotkey<BuildRailToolbarWindow>('T', "tunnel", WID_RAT_BUILD_TUNNEL),
- Hotkey<BuildRailToolbarWindow>('R', "remove", WID_RAT_REMOVE),
- Hotkey<BuildRailToolbarWindow>('C', "convert", WID_RAT_CONVERT_RAIL),
- HOTKEY_LIST_END(BuildRailToolbarWindow)
+Hotkey BuildRailToolbarWindow::railtoolbar_hotkeys[] = {
+ Hotkey('1', "build_ns", WID_RAT_BUILD_NS),
+ Hotkey('2', "build_x", WID_RAT_BUILD_X),
+ Hotkey('3', "build_ew", WID_RAT_BUILD_EW),
+ Hotkey('4', "build_y", WID_RAT_BUILD_Y),
+ Hotkey(_railtoolbar_autorail_keys, "autorail", WID_RAT_AUTORAIL),
+ Hotkey('6', "demolish", WID_RAT_DEMOLISH),
+ Hotkey('7', "depot", WID_RAT_BUILD_DEPOT),
+ Hotkey('8', "waypoint", WID_RAT_BUILD_WAYPOINT),
+ Hotkey('9', "station", WID_RAT_BUILD_STATION),
+ Hotkey('S', "signal", WID_RAT_BUILD_SIGNALS),
+ Hotkey('B', "bridge", WID_RAT_BUILD_BRIDGE),
+ Hotkey('T', "tunnel", WID_RAT_BUILD_TUNNEL),
+ Hotkey('R', "remove", WID_RAT_REMOVE),
+ Hotkey('C', "convert", WID_RAT_CONVERT_RAIL),
+ HOTKEY_LIST_END
};
-Hotkey<BuildRailToolbarWindow> *_railtoolbar_hotkeys = BuildRailToolbarWindow::railtoolbar_hotkeys;
+Hotkey *_railtoolbar_hotkeys = BuildRailToolbarWindow::railtoolbar_hotkeys;
static const NWidgetPart _nested_build_rail_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -851,7 +851,7 @@ EventState RailToolbarGlobalHotkeys(uint16 key, uint16 keycode)
{
if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED;
extern RailType _last_built_railtype;
- int num = CheckHotkeyMatch<BuildRailToolbarWindow>(_railtoolbar_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_railtoolbar_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildRailToolbar(_last_built_railtype);
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 03267323b..d98df7f9e 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -475,7 +475,7 @@ struct BuildRoadToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(roadtoolbar_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(roadtoolbar_hotkeys, keycode);
if (num == -1 || this->GetWidget<NWidgetBase>(num) == NULL) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
MarkTileDirtyByTile(TileVirtXY(_thd.pos.x, _thd.pos.y)); // redraw tile selection
@@ -660,24 +660,24 @@ struct BuildRoadToolbarWindow : Window {
return ES_NOT_HANDLED;
}
- static Hotkey<BuildRoadToolbarWindow> roadtoolbar_hotkeys[];
+ static Hotkey roadtoolbar_hotkeys[];
};
-Hotkey<BuildRoadToolbarWindow> BuildRoadToolbarWindow::roadtoolbar_hotkeys[] = {
- Hotkey<BuildRoadToolbarWindow>('1', "build_x", WID_ROT_ROAD_X),
- Hotkey<BuildRoadToolbarWindow>('2', "build_y", WID_ROT_ROAD_Y),
- Hotkey<BuildRoadToolbarWindow>('3', "autoroad", WID_ROT_AUTOROAD),
- Hotkey<BuildRoadToolbarWindow>('4', "demolish", WID_ROT_DEMOLISH),
- Hotkey<BuildRoadToolbarWindow>('5', "depot", WID_ROT_DEPOT),
- Hotkey<BuildRoadToolbarWindow>('6', "bus_station", WID_ROT_BUS_STATION),
- Hotkey<BuildRoadToolbarWindow>('7', "truck_station", WID_ROT_TRUCK_STATION),
- Hotkey<BuildRoadToolbarWindow>('8', "oneway", WID_ROT_ONE_WAY),
- Hotkey<BuildRoadToolbarWindow>('B', "bridge", WID_ROT_BUILD_BRIDGE),
- Hotkey<BuildRoadToolbarWindow>('T', "tunnel", WID_ROT_BUILD_TUNNEL),
- Hotkey<BuildRoadToolbarWindow>('R', "remove", WID_ROT_REMOVE),
- HOTKEY_LIST_END(BuildRoadToolbarWindow)
+Hotkey BuildRoadToolbarWindow::roadtoolbar_hotkeys[] = {
+ Hotkey('1', "build_x", WID_ROT_ROAD_X),
+ Hotkey('2', "build_y", WID_ROT_ROAD_Y),
+ Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
+ Hotkey('4', "demolish", WID_ROT_DEMOLISH),
+ Hotkey('5', "depot", WID_ROT_DEPOT),
+ Hotkey('6', "bus_station", WID_ROT_BUS_STATION),
+ Hotkey('7', "truck_station", WID_ROT_TRUCK_STATION),
+ Hotkey('8', "oneway", WID_ROT_ONE_WAY),
+ Hotkey('B', "bridge", WID_ROT_BUILD_BRIDGE),
+ Hotkey('T', "tunnel", WID_ROT_BUILD_TUNNEL),
+ Hotkey('R', "remove", WID_ROT_REMOVE),
+ HOTKEY_LIST_END
};
-Hotkey<BuildRoadToolbarWindow> *_roadtoolbar_hotkeys = BuildRoadToolbarWindow::roadtoolbar_hotkeys;
+Hotkey *_roadtoolbar_hotkeys = BuildRoadToolbarWindow::roadtoolbar_hotkeys;
static const NWidgetPart _nested_build_road_widgets[] = {
@@ -778,7 +778,7 @@ Window *ShowBuildRoadToolbar(RoadType roadtype)
EventState RoadToolbarGlobalHotkeys(uint16 key, uint16 keycode)
{
extern RoadType _last_built_roadtype;
- int num = CheckHotkeyMatch<BuildRoadToolbarWindow>(_roadtoolbar_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_roadtoolbar_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildRoadToolbar(_last_built_roadtype);
if (w == NULL) return ES_NOT_HANDLED;
@@ -831,7 +831,7 @@ Window *ShowBuildRoadScenToolbar()
EventState RoadToolbarEditorGlobalHotkeys(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch<BuildRoadToolbarWindow>(_roadtoolbar_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_roadtoolbar_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildRoadScenToolbar();
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 4975bc4aa..433165f3d 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -284,7 +284,7 @@ struct SignListWindow : Window, SignList {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
- if (CheckHotkeyMatch(signlist_hotkeys, keycode, this) == SLHK_FOCUS_FILTER_BOX) {
+ if (CheckHotkeyMatch(signlist_hotkeys, keycode) == SLHK_FOCUS_FILTER_BOX) {
this->SetFocusedWidget(WID_SIL_FILTER_TEXT);
SetFocusedWindow(this); // The user has asked to give focus to the text box, so make sure this window is focused.
state = ES_HANDLED;
@@ -332,14 +332,14 @@ struct SignListWindow : Window, SignList {
}
}
- static Hotkey<SignListWindow> signlist_hotkeys[];
+ static Hotkey signlist_hotkeys[];
};
-Hotkey<SignListWindow> SignListWindow::signlist_hotkeys[] = {
- Hotkey<SignListWindow>('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
- HOTKEY_LIST_END(SignListWindow)
+Hotkey SignListWindow::signlist_hotkeys[] = {
+ Hotkey('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
+ HOTKEY_LIST_END
};
-Hotkey<SignListWindow> *_signlist_hotkeys = SignListWindow::signlist_hotkeys;
+Hotkey *_signlist_hotkeys = SignListWindow::signlist_hotkeys;
static const NWidgetPart _nested_sign_list_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -389,7 +389,7 @@ Window *ShowSignList()
EventState SignListGlobalHotkeys(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch<SignListWindow>(_signlist_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_signlist_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowSignList();
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 3a3f964ec..932d6b989 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -221,7 +221,7 @@ struct TerraformToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(terraform_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(terraform_hotkeys, keycode);
if (num == -1) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
return ES_HANDLED;
@@ -295,21 +295,21 @@ struct TerraformToolbarWindow : Window {
this->RaiseButtons();
}
- static Hotkey<TerraformToolbarWindow> terraform_hotkeys[];
+ static Hotkey terraform_hotkeys[];
};
-Hotkey<TerraformToolbarWindow> TerraformToolbarWindow::terraform_hotkeys[] = {
- Hotkey<TerraformToolbarWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND),
- Hotkey<TerraformToolbarWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND),
- Hotkey<TerraformToolbarWindow>('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND),
- Hotkey<TerraformToolbarWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH),
- Hotkey<TerraformToolbarWindow>('U', "buyland", WID_TT_BUY_LAND),
- Hotkey<TerraformToolbarWindow>('I', "trees", WID_TT_PLANT_TREES),
- Hotkey<TerraformToolbarWindow>('O', "placesign", WID_TT_PLACE_SIGN),
- Hotkey<TerraformToolbarWindow>('P', "placeobject", WID_TT_PLACE_OBJECT),
- HOTKEY_LIST_END(TerraformToolbarWindow)
+Hotkey TerraformToolbarWindow::terraform_hotkeys[] = {
+ Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND),
+ Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND),
+ Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND),
+ Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH),
+ Hotkey('U', "buyland", WID_TT_BUY_LAND),
+ Hotkey('I', "trees", WID_TT_PLANT_TREES),
+ Hotkey('O', "placesign", WID_TT_PLACE_SIGN),
+ Hotkey('P', "placeobject", WID_TT_PLACE_OBJECT),
+ HOTKEY_LIST_END
};
-Hotkey<TerraformToolbarWindow> *_terraform_hotkeys = TerraformToolbarWindow::terraform_hotkeys;
+Hotkey *_terraform_hotkeys = TerraformToolbarWindow::terraform_hotkeys;
static const NWidgetPart _nested_terraform_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -380,7 +380,7 @@ Window *ShowTerraformToolbar(Window *link)
EventState TerraformToolbarGlobalHotkeys(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch<TerraformToolbarWindow>(_terraform_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_terraform_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowTerraformToolbar(NULL);
if (w == NULL) return ES_NOT_HANDLED;
@@ -574,7 +574,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch(terraform_editor_hotkeys, keycode, this);
+ int num = CheckHotkeyMatch(terraform_editor_hotkeys, keycode);
if (num == -1) return ES_NOT_HANDLED;
this->OnClick(Point(), num, 1);
return ES_HANDLED;
@@ -724,21 +724,21 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
DeleteWindowById(WC_BUILD_OBJECT, 0);
}
- static Hotkey<ScenarioEditorLandscapeGenerationWindow> terraform_editor_hotkeys[];
+ static Hotkey terraform_editor_hotkeys[];
};
-Hotkey<ScenarioEditorLandscapeGenerationWindow> ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys[] = {
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH),
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_ETT_LOWER_LAND),
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", WID_ETT_RAISE_LAND),
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('E' | WKC_GLOBAL_HOTKEY, "level", WID_ETT_LEVEL_LAND),
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('R', "rocky", WID_ETT_PLACE_ROCKS),
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('T', "desert", WID_ETT_PLACE_DESERT),
- Hotkey<ScenarioEditorLandscapeGenerationWindow>('O', "object", WID_ETT_PLACE_OBJECT),
- HOTKEY_LIST_END(ScenarioEditorLandscapeGenerationWindow)
+Hotkey ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys[] = {
+ Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH),
+ Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_ETT_LOWER_LAND),
+ Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_ETT_RAISE_LAND),
+ Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_ETT_LEVEL_LAND),
+ Hotkey('R', "rocky", WID_ETT_PLACE_ROCKS),
+ Hotkey('T', "desert", WID_ETT_PLACE_DESERT),
+ Hotkey('O', "object", WID_ETT_PLACE_OBJECT),
+ HOTKEY_LIST_END
};
-Hotkey<ScenarioEditorLandscapeGenerationWindow> *_terraform_editor_hotkeys = ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys;
+Hotkey *_terraform_editor_hotkeys = ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys;
static WindowDesc _scen_edit_land_gen_desc(
WDP_AUTO, "toolbar_landscape_scen", 0, 0,
@@ -758,7 +758,7 @@ Window *ShowEditorTerraformToolbar()
EventState TerraformToolbarEditorGlobalHotkeys(uint16 key, uint16 keycode)
{
- int num = CheckHotkeyMatch<ScenarioEditorLandscapeGenerationWindow>(_terraform_editor_hotkeys, keycode, NULL, true);
+ int num = CheckHotkeyMatch(_terraform_editor_hotkeys, keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowEditorTerraformToolbar();
if (w == NULL) return ES_NOT_HANDLED;
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 420079c53..9c5d72b2d 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -1662,7 +1662,7 @@ struct MainToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
- switch (CheckHotkeyMatch(maintoolbar_hotkeys, keycode, this)) {
+ switch (CheckHotkeyMatch(maintoolbar_hotkeys, keycode)) {
case MTHK_PAUSE: ToolbarPauseClick(this); break;
case MTHK_FASTFORWARD: ToolbarFastForwardClick(this); break;
case MTHK_SETTINGS: ShowGameOptions(); break;
@@ -1759,7 +1759,7 @@ struct MainToolbarWindow : Window {
if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT);
}
- static Hotkey<MainToolbarWindow> maintoolbar_hotkeys[];
+ static Hotkey maintoolbar_hotkeys[];
};
const uint16 _maintoolbar_pause_keys[] = {WKC_F1, WKC_PAUSE, 0};
@@ -1767,50 +1767,50 @@ const uint16 _maintoolbar_zoomin_keys[] = {WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT |
const uint16 _maintoolbar_zoomout_keys[] = {WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6, 0};
const uint16 _maintoolbar_smallmap_keys[] = {WKC_F4, 'M', 0};
-Hotkey<MainToolbarWindow> MainToolbarWindow::maintoolbar_hotkeys[] = {
- Hotkey<MainToolbarWindow>(_maintoolbar_pause_keys, "pause", MTHK_PAUSE),
- Hotkey<MainToolbarWindow>((uint16)0, "fastforward", MTHK_FASTFORWARD),
- Hotkey<MainToolbarWindow>(WKC_F2, "settings", MTHK_SETTINGS),
- Hotkey<MainToolbarWindow>(WKC_F3, "saveload", MTHK_SAVEGAME),
- Hotkey<MainToolbarWindow>((uint16)0, "load_game", MTHK_LOADGAME),
- Hotkey<MainToolbarWindow>(_maintoolbar_smallmap_keys, "smallmap", MTHK_SMALLMAP),
- Hotkey<MainToolbarWindow>(WKC_F5, "town_list", MTHK_TOWNDIRECTORY),
- Hotkey<MainToolbarWindow>(WKC_F6, "subsidies", MTHK_SUBSIDIES),
- Hotkey<MainToolbarWindow>(WKC_F7, "station_list", MTHK_STATIONS),
- Hotkey<MainToolbarWindow>(WKC_F8, "finances", MTHK_FINANCES),
- Hotkey<MainToolbarWindow>(WKC_F9, "companies", MTHK_COMPANIES),
- Hotkey<MainToolbarWindow>((uint16)0, "story_book", MTHK_STORY),
- Hotkey<MainToolbarWindow>((uint16)0, "goal_list", MTHK_GOAL),
- Hotkey<MainToolbarWindow>(WKC_F10, "graphs", MTHK_GRAPHS),
- Hotkey<MainToolbarWindow>(WKC_F11, "league", MTHK_LEAGUE),
- Hotkey<MainToolbarWindow>(WKC_F12, "industry_list", MTHK_INDUSTRIES),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F1, "train_list", MTHK_TRAIN_LIST),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F2, "roadveh_list", MTHK_ROADVEH_LIST),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F3, "ship_list", MTHK_SHIP_LIST),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F4, "aircraft_list", MTHK_AIRCRAFT_LIST),
- Hotkey<MainToolbarWindow>(_maintoolbar_zoomin_keys, "zoomin", MTHK_ZOOM_IN),
- Hotkey<MainToolbarWindow>(_maintoolbar_zoomout_keys, "zoomout", MTHK_ZOOM_OUT),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F7, "build_rail", MTHK_BUILD_RAIL),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F8, "build_road", MTHK_BUILD_ROAD),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F9, "build_docks", MTHK_BUILD_DOCKS),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F10, "build_airport", MTHK_BUILD_AIRPORT),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F11, "build_trees", MTHK_BUILD_TREES),
- Hotkey<MainToolbarWindow>(WKC_SHIFT | WKC_F12, "music", MTHK_MUSIC),
- Hotkey<MainToolbarWindow>((uint16)0, "ai_debug", MTHK_AI_DEBUG),
- Hotkey<MainToolbarWindow>(WKC_CTRL | 'S', "small_screenshot", MTHK_SMALL_SCREENSHOT),
- Hotkey<MainToolbarWindow>(WKC_CTRL | 'P', "zoomedin_screenshot", MTHK_ZOOMEDIN_SCREENSHOT),
- Hotkey<MainToolbarWindow>(WKC_CTRL | 'D', "defaultzoom_screenshot", MTHK_DEFAULTZOOM_SCREENSHOT),
- Hotkey<MainToolbarWindow>((uint16)0, "giant_screenshot", MTHK_GIANT_SCREENSHOT),
- Hotkey<MainToolbarWindow>(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS),
- Hotkey<MainToolbarWindow>('L', "terraform", MTHK_TERRAFORM),
- Hotkey<MainToolbarWindow>('V', "extra_viewport", MTHK_EXTRA_VIEWPORT),
+Hotkey MainToolbarWindow::maintoolbar_hotkeys[] = {
+ Hotkey(_maintoolbar_pause_keys, "pause", MTHK_PAUSE),
+ Hotkey((uint16)0, "fastforward", MTHK_FASTFORWARD),
+ Hotkey(WKC_F2, "settings", MTHK_SETTINGS),
+ Hotkey(WKC_F3, "saveload", MTHK_SAVEGAME),
+ Hotkey((uint16)0, "load_game", MTHK_LOADGAME),
+ Hotkey(_maintoolbar_smallmap_keys, "smallmap", MTHK_SMALLMAP),
+ Hotkey(WKC_F5, "town_list", MTHK_TOWNDIRECTORY),
+ Hotkey(WKC_F6, "subsidies", MTHK_SUBSIDIES),
+ Hotkey(WKC_F7, "station_list", MTHK_STATIONS),
+ Hotkey(WKC_F8, "finances", MTHK_FINANCES),
+ Hotkey(WKC_F9, "companies", MTHK_COMPANIES),
+ Hotkey((uint16)0, "story_book", MTHK_STORY),
+ Hotkey((uint16)0, "goal_list", MTHK_GOAL),
+ Hotkey(WKC_F10, "graphs", MTHK_GRAPHS),
+ Hotkey(WKC_F11, "league", MTHK_LEAGUE),
+ Hotkey(WKC_F12, "industry_list", MTHK_INDUSTRIES),
+ Hotkey(WKC_SHIFT | WKC_F1, "train_list", MTHK_TRAIN_LIST),
+ Hotkey(WKC_SHIFT | WKC_F2, "roadveh_list", MTHK_ROADVEH_LIST),
+ Hotkey(WKC_SHIFT | WKC_F3, "ship_list", MTHK_SHIP_LIST),
+ Hotkey(WKC_SHIFT | WKC_F4, "aircraft_list", MTHK_AIRCRAFT_LIST),
+ Hotkey(_maintoolbar_zoomin_keys, "zoomin", MTHK_ZOOM_IN),
+ Hotkey(_maintoolbar_zoomout_keys, "zoomout", MTHK_ZOOM_OUT),
+ Hotkey(WKC_SHIFT | WKC_F7, "build_rail", MTHK_BUILD_RAIL),
+ Hotkey(WKC_SHIFT | WKC_F8, "build_road", MTHK_BUILD_ROAD),
+ Hotkey(WKC_SHIFT | WKC_F9, "build_docks", MTHK_BUILD_DOCKS),
+ Hotkey(WKC_SHIFT | WKC_F10, "build_airport", MTHK_BUILD_AIRPORT),
+ Hotkey(WKC_SHIFT | WKC_F11, "build_trees", MTHK_BUILD_TREES),
+ Hotkey(WKC_SHIFT | WKC_F12, "music", MTHK_MUSIC),
+ Hotkey((uint16)0, "ai_debug", MTHK_AI_DEBUG),
+ Hotkey(WKC_CTRL | 'S', "small_screenshot", MTHK_SMALL_SCREENSHOT),
+ Hotkey(WKC_CTRL | 'P', "zoomedin_screenshot", MTHK_ZOOMEDIN_SCREENSHOT),
+ Hotkey(WKC_CTRL | 'D', "defaultzoom_screenshot", MTHK_DEFAULTZOOM_SCREENSHOT),
+ Hotkey((uint16)0, "giant_screenshot", MTHK_GIANT_SCREENSHOT),
+ Hotkey(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS),
+ Hotkey('L', "terraform", MTHK_TERRAFORM),
+ Hotkey('V', "extra_viewport", MTHK_EXTRA_VIEWPORT),
#ifdef ENABLE_NETWORK
- Hotkey<MainToolbarWindow>((uint16)0, "client_list", MTHK_CLIENT_LIST),
+ Hotkey((uint16)0, "client_list", MTHK_CLIENT_LIST),
#endif
- Hotkey<MainToolbarWindow>((uint16)0, "sign_list", MTHK_SIGN_LIST),
- HOTKEY_LIST_END(MainToolbarWindow)
+ Hotkey((uint16)0, "sign_list", MTHK_SIGN_LIST),
+ HOTKEY_LIST_END
};
-Hotkey<MainToolbarWindow> *_maintoolbar_hotkeys = MainToolbarWindow::maintoolbar_hotkeys;
+Hotkey *_maintoolbar_hotkeys = MainToolbarWindow::maintoolbar_hotkeys;
static NWidgetBase *MakeMainToolbar(int *biggest_index)
{
@@ -2009,7 +2009,7 @@ struct ScenarioEditorToolbarWindow : Window {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
CallBackFunction cbf = CBF_NONE;
- switch (CheckHotkeyMatch(scenedit_maintoolbar_hotkeys, keycode, this)) {
+ switch (CheckHotkeyMatch(scenedit_maintoolbar_hotkeys, keycode)) {
case MTEHK_PAUSE: ToolbarPauseClick(this); break;
case MTEHK_FASTFORWARD: ToolbarFastForwardClick(this); break;
case MTEHK_SETTINGS: ShowGameOptions(); break;
@@ -2102,35 +2102,35 @@ struct ScenarioEditorToolbarWindow : Window {
this->SetDirty();
}
- static Hotkey<ScenarioEditorToolbarWindow> scenedit_maintoolbar_hotkeys[];
+ static Hotkey scenedit_maintoolbar_hotkeys[];
};
-Hotkey<ScenarioEditorToolbarWindow> ScenarioEditorToolbarWindow::scenedit_maintoolbar_hotkeys[] = {
- Hotkey<ScenarioEditorToolbarWindow>(_maintoolbar_pause_keys, "pause", MTEHK_PAUSE),
- Hotkey<ScenarioEditorToolbarWindow>((uint16)0, "fastforward", MTEHK_FASTFORWARD),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F2, "settings", MTEHK_SETTINGS),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F3, "saveload", MTEHK_SAVEGAME),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F4, "gen_land", MTEHK_GENLAND),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F5, "gen_town", MTEHK_GENTOWN),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F6, "gen_industry", MTEHK_GENINDUSTRY),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F7, "build_road", MTEHK_BUILD_ROAD),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F8, "build_docks", MTEHK_BUILD_DOCKS),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F9, "build_trees", MTEHK_BUILD_TREES),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F10, "build_sign", MTEHK_SIGN),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F11, "music", MTEHK_MUSIC),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_F12, "land_info", MTEHK_LANDINFO),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_CTRL | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_CTRL | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT),
- Hotkey<ScenarioEditorToolbarWindow>(WKC_CTRL | 'D', "defaultzoom_screenshot", MTEHK_DEFAULTZOOM_SCREENSHOT),
- Hotkey<ScenarioEditorToolbarWindow>((uint16)0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT),
- Hotkey<ScenarioEditorToolbarWindow>(_maintoolbar_zoomin_keys, "zoomin", MTEHK_ZOOM_IN),
- Hotkey<ScenarioEditorToolbarWindow>(_maintoolbar_zoomout_keys, "zoomout", MTEHK_ZOOM_OUT),
- Hotkey<ScenarioEditorToolbarWindow>('L', "terraform", MTEHK_TERRAFORM),
- Hotkey<ScenarioEditorToolbarWindow>('M', "smallmap", MTEHK_SMALLMAP),
- Hotkey<ScenarioEditorToolbarWindow>('V', "extra_viewport", MTEHK_EXTRA_VIEWPORT),
- HOTKEY_LIST_END(ScenarioEditorToolbarWindow)
+Hotkey ScenarioEditorToolbarWindow::scenedit_maintoolbar_hotkeys[] = {
+ Hotkey(_maintoolbar_pause_keys, "pause", MTEHK_PAUSE),
+ Hotkey((uint16)0, "fastforward", MTEHK_FASTFORWARD),
+ Hotkey(WKC_F2, "settings", MTEHK_SETTINGS),
+ Hotkey(WKC_F3, "saveload", MTEHK_SAVEGAME),
+ Hotkey(WKC_F4, "gen_land", MTEHK_GENLAND),
+ Hotkey(WKC_F5, "gen_town", MTEHK_GENTOWN),
+ Hotkey(WKC_F6, "gen_industry", MTEHK_GENINDUSTRY),
+ Hotkey(WKC_F7, "build_road", MTEHK_BUILD_ROAD),
+ Hotkey(WKC_F8, "build_docks", MTEHK_BUILD_DOCKS),
+ Hotkey(WKC_F9, "build_trees", MTEHK_BUILD_TREES),
+ Hotkey(WKC_F10, "build_sign", MTEHK_SIGN),
+ Hotkey(WKC_F11, "music", MTEHK_MUSIC),
+ Hotkey(WKC_F12, "land_info", MTEHK_LANDINFO),
+ Hotkey(WKC_CTRL | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT),
+ Hotkey(WKC_CTRL | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT),
+ Hotkey(WKC_CTRL | 'D', "defaultzoom_screenshot", MTEHK_DEFAULTZOOM_SCREENSHOT),
+ Hotkey((uint16)0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT),
+ Hotkey(_maintoolbar_zoomin_keys, "zoomin", MTEHK_ZOOM_IN),
+ Hotkey(_maintoolbar_zoomout_keys, "zoomout", MTEHK_ZOOM_OUT),
+ Hotkey('L', "terraform", MTEHK_TERRAFORM),
+ Hotkey('M', "smallmap", MTEHK_SMALLMAP),
+ Hotkey('V', "extra_viewport", MTEHK_EXTRA_VIEWPORT),
+ HOTKEY_LIST_END
};
-Hotkey<ScenarioEditorToolbarWindow> *_scenedit_maintoolbar_hotkeys = ScenarioEditorToolbarWindow::scenedit_maintoolbar_hotkeys;
+Hotkey *_scenedit_maintoolbar_hotkeys = ScenarioEditorToolbarWindow::scenedit_maintoolbar_hotkeys;
static const NWidgetPart _nested_toolb_scen_inner_widgets[] = {
NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_PAUSE), SetDataTip(SPR_IMG_PAUSE, STR_TOOLBAR_TOOLTIP_PAUSE_GAME),