Changeset - r16800:5daa52e43961
[Not reviewed]
master
0 1 0
alberth - 14 years ago 2010-12-20 13:16:22
alberth@openttd.org
(svn r21543) -Codechange: Remove _build_docks_button_proc array.
1 file changed with 35 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/dock_gui.cpp
Show inline comments
 
@@ -222,25 +222,12 @@ static void BuildDocksClick_River(Window
 
  */
 
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.
 

	
 
	BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
 
	{
 
		this->last_clicked_widget = DTW_END;
 
@@ -263,13 +250,47 @@ struct BuildDocksToolbarWindow : Window 
 
			WIDGET_LIST_END);
 
	}
 

	
 
	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)
 
	{
 
		int num = CheckHotkeyMatch(dockstoolbar_hotkeys, keycode, this);
 
		if (num == -1) return ES_NOT_HANDLED;
0 comments (0 inline, 0 general)