summaryrefslogtreecommitdiff
path: root/src/airport_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-07-04 09:27:15 +0000
committerfrosch <frosch@openttd.org>2010-07-04 09:27:15 +0000
commit397d1186d731a62ffa39a315f13cbafabee75324 (patch)
tree4b347024b2b5a3855a6f1a7cc26909c0fd06625d /src/airport_gui.cpp
parent26be68ae9823b7a078c8251f70038d98961388bc (diff)
downloadopenttd-397d1186d731a62ffa39a315f13cbafabee75324.tar.xz
(svn r20071) -Codechange: Consistently return the toolbar window for ShowBuildXxxToolbar().
Diffstat (limited to 'src/airport_gui.cpp')
-rw-r--r--src/airport_gui.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 4e2b5712b..01f421753 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -168,20 +168,27 @@ static const WindowDesc _air_toolbar_desc(
_nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets)
);
-void ShowBuildAirToolbar()
+/**
+ * Open the build airport toolbar window
+ *
+ * If the terraform toolbar is linked to the toolbar, that window is also opened.
+ *
+ * @return newly opened airport toolbar, or NULL if the toolbar could not be opened.
+ */
+Window *ShowBuildAirToolbar()
{
- if (!Company::IsValidID(_local_company)) return;
+ if (!Company::IsValidID(_local_company)) return NULL;
DeleteWindowByClass(WC_BUILD_TOOLBAR);
- AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
+ return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
}
EventState AirportToolbarGlobalHotkeys(uint16 key, uint16 keycode)
{
int num = CheckHotkeyMatch<BuildAirToolbarWindow>(_airtoolbar_hotkeys, keycode, NULL, true);
if (num == -1) return ES_NOT_HANDLED;
- ShowBuildAirToolbar();
- Window *w = FindWindowByClass(WC_BUILD_TOOLBAR);
+ Window *w = ShowBuildAirToolbar();
+ if (w == NULL) return ES_NOT_HANDLED;
return w->OnKeyPress(key, keycode);
}