summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-12-20 13:16:22 +0000
committeralberth <alberth@openttd.org>2010-12-20 13:16:22 +0000
commit1f9fe3999d33a4d8d1412eaccb7e0519900ca9a3 (patch)
tree19d148fc3f4d0de7895ea84c93b0634ee783435b
parent50faf52cfc68caa48969f96df81a45e13d5599e0 (diff)
downloadopenttd-1f9fe3999d33a4d8d1412eaccb7e0519900ca9a3.tar.xz
(svn r21543) -Codechange: Remove _build_docks_button_proc array.
-rw-r--r--src/dock_gui.cpp49
1 files changed, 35 insertions, 14 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 1bc769c13..ecf00918c 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -225,19 +225,6 @@ static void BuildDocksClick_Aqueduct(Window *w)
HandlePlacePushButton(w, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL, PlaceDocks_Aqueduct);
}
-
-typedef void OnButtonClick(Window *w);
-static OnButtonClick * const _build_docks_button_proc[] = {
- BuildDocksClick_Canal,
- BuildDocksClick_Lock,
- BuildDocksClick_Demolish,
- BuildDocksClick_Depot,
- BuildDocksClick_Dock,
- BuildDocksClick_Buoy,
- BuildDocksClick_River,
- BuildDocksClick_Aqueduct
-};
-
struct BuildDocksToolbarWindow : Window {
DockToolbarWidgets last_clicked_widget; ///< Contains the last widget that has been clicked on this toolbar.
@@ -266,7 +253,41 @@ struct BuildDocksToolbarWindow : Window {
virtual void OnClick(Point pt, int widget, int click_count)
{
this->last_clicked_widget = (DockToolbarWidgets)widget;
- if (widget >= DTW_BUTTONS_BEGIN) _build_docks_button_proc[widget - DTW_BUTTONS_BEGIN](this);
+ switch (widget) {
+ case DTW_CANAL: // Build canal button
+ BuildDocksClick_Canal(this);
+ break;
+
+ case DTW_LOCK: // Build lock button
+ BuildDocksClick_Lock(this);
+ break;
+
+ case DTW_DEMOLISH: // Demolish aka dynamite button
+ BuildDocksClick_Demolish(this);
+ break;
+
+ case DTW_DEPOT: // Build depot button
+ BuildDocksClick_Depot(this);
+ break;
+
+ case DTW_STATION: // Build station button
+ BuildDocksClick_Dock(this);
+ break;
+
+ case DTW_BUOY: // Build buoy button
+ BuildDocksClick_Buoy(this);
+ break;
+
+ case DTW_RIVER: // Build river button (in scenario editor)
+ BuildDocksClick_River(this);
+ break;
+
+ case DTW_BUILD_AQUEDUCT: // Build aqueduct button
+ BuildDocksClick_Aqueduct(this);
+ break;
+
+ default: break;
+ }
}
virtual EventState OnKeyPress(uint16 key, uint16 keycode)