summaryrefslogtreecommitdiff
path: root/src/rail_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-15 15:28:09 +0000
committerfrosch <frosch@openttd.org>2013-06-15 15:28:09 +0000
commit1b8b1f3f6cbd65b73399b1d39aacb7fb674a091c (patch)
tree555791c9e1370b2caba036286b98f64efe970bd3 /src/rail_gui.cpp
parent40c2864e4dd478693ef6c108cc95cd2e6b5e70d0 (diff)
downloadopenttd-1b8b1f3f6cbd65b73399b1d39aacb7fb674a091c.tar.xz
(svn r25410) -Codechange: Put all hotkeys of a window into a static HotkeyList member.
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r--src/rail_gui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index eee4e26bf..e1b94b6bc 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);
+ int num = this->hotkeys.CheckMatch(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,12 +755,12 @@ struct BuildRailToolbarWindow : Window {
return ES_NOT_HANDLED;
}
- static Hotkey railtoolbar_hotkeys[];
+ static HotkeyList hotkeys;
};
const uint16 _railtoolbar_autorail_keys[] = {'5', 'A' | WKC_GLOBAL_HOTKEY, 0};
-Hotkey BuildRailToolbarWindow::railtoolbar_hotkeys[] = {
+static Hotkey 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),
@@ -777,7 +777,7 @@ Hotkey BuildRailToolbarWindow::railtoolbar_hotkeys[] = {
Hotkey('C', "convert", WID_RAT_CONVERT_RAIL),
HOTKEY_LIST_END
};
-Hotkey *_railtoolbar_hotkeys = BuildRailToolbarWindow::railtoolbar_hotkeys;
+HotkeyList BuildRailToolbarWindow::hotkeys("railtoolbar", 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(_railtoolbar_hotkeys, keycode, true);
+ int num = BuildRailToolbarWindow::hotkeys.CheckMatch(keycode, true);
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowBuildRailToolbar(_last_built_railtype);
if (w == NULL) return ES_NOT_HANDLED;