Mercurial > hg > openttd
changeset 16810:191ea99ef287 draft
(svn r21543) -Codechange: Remove _build_docks_button_proc array.
author | alberth <alberth@openttd.org> |
---|---|
date | Mon, 20 Dec 2010 13:16:22 +0000 |
parents | 35b1b7b9757d |
children | d15b430b04df |
files | src/dock_gui.cpp |
diffstat | 1 files changed, 35 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -225,19 +225,6 @@ 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 @@ 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)