Changeset - r16882:6785a5e2d30b
[Not reviewed]
master
0 11 0
alberth - 13 years ago 2010-12-24 15:08:19
alberth@openttd.org
(svn r21627) -Codechange: Remove _place_proc global variable.
11 files changed with 52 insertions and 57 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -86,20 +86,20 @@ struct BuildAirToolbarWindow : Window {
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case ATW_AIRPORT:
 
				if (HandlePlacePushButton(this, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
 
					ShowBuildAirportPicker(this);
 
					this->last_user_action = widget;
 
				}
 
				break;
 

	
 
			case ATW_DEMOLISH:
 
				HandlePlacePushButton(this, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			default: break;
 
		}
 
	}
src/dock_gui.cpp
Show inline comments
 
@@ -131,45 +131,45 @@ struct BuildDocksToolbarWindow : Window 
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->last_clicked_widget = (DockToolbarWidgets)widget;
 
		switch (widget) {
 
			case DTW_CANAL: // Build canal button
 
				HandlePlacePushButton(this, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT, NULL);
 
				HandlePlacePushButton(this, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT);
 
				break;
 

	
 
			case DTW_LOCK: // Build lock button
 
				HandlePlacePushButton(this, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL, NULL);
 
				HandlePlacePushButton(this, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
 
				break;
 

	
 
			case DTW_DEMOLISH: // Demolish aka dynamite button
 
				HandlePlacePushButton(this, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				break;
 

	
 
			case DTW_DEPOT: // Build depot button
 
				if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
 
				if (HandlePlacePushButton(this, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT, NULL)) ShowBuildDocksDepotPicker(this);
 
				if (HandlePlacePushButton(this, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
 
				break;
 

	
 
			case DTW_STATION: // Build station button
 
				if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
 
				if (HandlePlacePushButton(this, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL, NULL)) ShowBuildDockStationPicker(this);
 
				if (HandlePlacePushButton(this, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
 
				break;
 

	
 
			case DTW_BUOY: // Build buoy button
 
				if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
 
				HandlePlacePushButton(this, DTW_BUOY, SPR_CURSOR_BOUY, HT_RECT, NULL);
 
				HandlePlacePushButton(this, DTW_BUOY, SPR_CURSOR_BOUY, HT_RECT);
 
				break;
 

	
 
			case DTW_RIVER: // Build river button (in scenario editor)
 
				if (_game_mode != GM_EDITOR) return;
 
				HandlePlacePushButton(this, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT, NULL);
 
				HandlePlacePushButton(this, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT);
 
				break;
 

	
 
			case DTW_BUILD_AQUEDUCT: // Build aqueduct button
 
				HandlePlacePushButton(this, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL, NULL);
 
				HandlePlacePushButton(this, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
 
				break;
 

	
 
			default: break;
 
		}
 
	}
 

	
src/industry_gui.cpp
Show inline comments
 
@@ -514,13 +514,13 @@ public:
 
						_generating_world = false;
 
					}
 
				} else if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
 
					DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
 
					this->HandleButtonClick(DPIW_FUND_WIDGET);
 
				} else {
 
					HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT, NULL);
 
					HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT);
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
src/main_gui.cpp
Show inline comments
 
@@ -90,16 +90,15 @@ void HandleOnEditText(const char *str)
 
 * Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters
 
 *
 
 * @param w Window which called the function
 
 * @param widget ID of the widget (=button) that called this function
 
 * @param cursor How should the cursor image change? E.g. cursor with depot image in it
 
 * @param mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
 
 * @param placeproc Procedure which will be called when someone clicks on the map
 
 * @return true if the button is clicked, false if it's unclicked
 
 */
 
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc)
 
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
 
{
 
	if (w->IsWidgetDisabled(widget)) return false;
 

	
 
	SndPlayFx(SND_15_BEEP);
 
	w->SetDirty();
 

	
 
@@ -107,13 +106,12 @@ bool HandlePlacePushButton(Window *w, in
 
		ResetObjectToPlace();
 
		return false;
 
	}
 

	
 
	SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number);
 
	w->LowerWidget(widget);
 
	_place_proc = placeproc;
 
	return true;
 
}
 

	
 

	
 
void CcPlaySound10(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
src/rail_gui.cpp
Show inline comments
 
@@ -512,88 +512,88 @@ struct BuildRailToolbarWindow : Window {
 
	{
 
		if (widget < RTW_BUILD_NS) return;
 

	
 
		_remove_button_clicked = false;
 
		switch (widget) {
 
			case RTW_BUILD_NS:
 
				HandlePlacePushButton(this, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_LINE | HT_DIR_VL, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_LINE | HT_DIR_VL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_BUILD_X:
 
				HandlePlacePushButton(this, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_LINE | HT_DIR_X, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_LINE | HT_DIR_X);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_BUILD_EW:
 
				HandlePlacePushButton(this, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_LINE | HT_DIR_HL, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_LINE | HT_DIR_HL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_BUILD_Y:
 
				HandlePlacePushButton(this, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_LINE | HT_DIR_Y, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_LINE | HT_DIR_Y);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_AUTORAIL:
 
				HandlePlacePushButton(this, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL, NULL);
 
				HandlePlacePushButton(this, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_DEMOLISH:
 
				HandlePlacePushButton(this, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_BUILD_DEPOT:
 
				if (HandlePlacePushButton(this, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT)) {
 
					ShowBuildTrainDepotPicker(this);
 
					this->last_user_action = widget;
 
				}
 
				break;
 

	
 
			case RTW_BUILD_WAYPOINT:
 
				this->last_user_action = widget;
 
				_waypoint_count = StationClass::GetCount(STAT_CLASS_WAYP);
 
				if (HandlePlacePushButton(this, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT, NULL) && _waypoint_count > 1) {
 
				if (HandlePlacePushButton(this, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT) && _waypoint_count > 1) {
 
					ShowBuildWaypointPicker(this);
 
				}
 
				break;
 

	
 
			case RTW_BUILD_STATION:
 
				if (HandlePlacePushButton(this, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT)) {
 
					ShowStationBuilder(this);
 
					this->last_user_action = widget;
 
				}
 
				break;
 

	
 
			case RTW_BUILD_SIGNALS: {
 
				this->last_user_action = widget;
 
				bool started = HandlePlacePushButton(this, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT, NULL);
 
				bool started = HandlePlacePushButton(this, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT);
 
				if (started && _settings_client.gui.enable_signal_gui != _ctrl_pressed) {
 
					ShowSignalBuilder(this);
 
				}
 
				break;
 
			}
 

	
 
			case RTW_BUILD_BRIDGE:
 
				HandlePlacePushButton(this, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_BUILD_TUNNEL:
 
				HandlePlacePushButton(this, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case RTW_REMOVE:
 
				BuildRailClick_Remove(this);
 
				break;
 

	
 
			case RTW_CONVERT_RAIL:
 
				HandlePlacePushButton(this, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT, NULL);
 
				HandlePlacePushButton(this, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			default: NOT_REACHED();
 
		}
 
		this->UpdateRemoveWidgetStatus(widget);
src/road_gui.cpp
Show inline comments
 
@@ -383,50 +383,50 @@ struct BuildRoadToolbarWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		_remove_button_clicked = false;
 
		_one_way_button_clicked = false;
 
		switch (widget) {
 
			case RTW_ROAD_X:
 
				HandlePlacePushButton(this, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT, NULL);
 
				HandlePlacePushButton(this, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT);
 
				this->last_started_action = widget;
 
				break;
 

	
 
			case RTW_ROAD_Y:
 
				HandlePlacePushButton(this, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT, NULL);
 
				HandlePlacePushButton(this, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT);
 
				this->last_started_action = widget;
 
				break;
 

	
 
			case RTW_AUTOROAD:
 
				HandlePlacePushButton(this, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT, NULL);
 
				HandlePlacePushButton(this, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT);
 
				this->last_started_action = widget;
 
				break;
 

	
 
			case RTW_DEMOLISH:
 
				HandlePlacePushButton(this, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				this->last_started_action = widget;
 
				break;
 

	
 
			case RTW_DEPOT:
 
				if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
 
				if (HandlePlacePushButton(this, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT)) {
 
					ShowRoadDepotPicker(this);
 
					this->last_started_action = widget;
 
				}
 
				break;
 

	
 
			case RTW_BUS_STATION:
 
				if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
 
				if (HandlePlacePushButton(this, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) {
 
					ShowRVStationPicker(this, ROADSTOP_BUS);
 
					this->last_started_action = widget;
 
				}
 
				break;
 

	
 
			case RTW_TRUCK_STATION:
 
				if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
 
				if (HandlePlacePushButton(this, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) {
 
					ShowRVStationPicker(this, ROADSTOP_TRUCK);
 
					this->last_started_action = widget;
 
				}
 
				break;
 

	
 
			case RTW_ONE_WAY:
 
@@ -434,18 +434,18 @@ struct BuildRoadToolbarWindow : Window {
 
				this->SetDirty();
 
				this->ToggleWidgetLoweredState(RTW_ONE_WAY);
 
				SetSelectionRed(false);
 
				break;
 

	
 
			case RTW_BUILD_BRIDGE:
 
				HandlePlacePushButton(this, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT);
 
				this->last_started_action = widget;
 
				break;
 

	
 
			case RTW_BUILD_TUNNEL:
 
				HandlePlacePushButton(this, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL, NULL);
 
				HandlePlacePushButton(this, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL);
 
				this->last_started_action = widget;
 
				break;
 

	
 
			case RTW_REMOVE:
 
				if (this->IsWidgetDisabled(RTW_REMOVE)) return;
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -180,51 +180,51 @@ struct TerraformToolbarWindow : Window {
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget < TTW_BUTTONS_START) return;
 

	
 
		switch (widget) {
 
			case TTW_LOWER_LAND: // Lower land button
 
				HandlePlacePushButton(this, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case TTW_RAISE_LAND: // Raise land button
 
				HandlePlacePushButton(this, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case TTW_LEVEL_LAND: // Level land button
 
				HandlePlacePushButton(this, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case TTW_DEMOLISH: // Demolish aka dynamite button
 
				HandlePlacePushButton(this, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case TTW_BUY_LAND: // Buy land button
 
				HandlePlacePushButton(this, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT, NULL);
 
				HandlePlacePushButton(this, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case TTW_PLANT_TREES: // Plant trees button
 
				/* This button is NOT a place-push-button, so don't treat it as such */
 
				this->HandleButtonClick(TTW_PLANT_TREES);
 
				ShowBuildTreesToolbar();
 
				break;
 

	
 
			case TTW_PLACE_SIGN: // Place sign button
 
				HandlePlacePushButton(this, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT, NULL);
 
				HandlePlacePushButton(this, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case TTW_PLACE_OBJECT: // Place object button
 
				/* Don't show the place object button when there are no objects to place. */
 
				if (ObjectClass::GetCount() == 0) return;
 
				if (HandlePlacePushButton(this, TTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, TTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) {
 
					ShowBuildObjectPicker(this);
 
					this->last_user_action = widget;
 
				}
 
				break;
 

	
 
			default: NOT_REACHED();
 
@@ -613,43 +613,43 @@ struct ScenarioEditorLandscapeGeneration
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget < ETTW_BUTTONS_START) return;
 

	
 
		switch (widget) {
 
			case ETTW_DEMOLISH: // Demolish aka dynamite button
 
				HandlePlacePushButton(this, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case ETTW_LOWER_LAND: // Lower land button
 
				HandlePlacePushButton(this, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT, NULL);
 
				HandlePlacePushButton(this, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case ETTW_RAISE_LAND: // Raise land button
 
				HandlePlacePushButton(this, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT, NULL);
 
				HandlePlacePushButton(this, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case ETTW_LEVEL_LAND: // Level land button
 
				HandlePlacePushButton(this, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL, NULL);
 
				HandlePlacePushButton(this, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case ETTW_PLACE_ROCKS: // Place rocks button
 
				HandlePlacePushButton(this, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT, NULL);
 
				HandlePlacePushButton(this, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case ETTW_PLACE_DESERT: // Place desert button (in tropical climate)
 
				HandlePlacePushButton(this, ETTW_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT, NULL);
 
				HandlePlacePushButton(this, ETTW_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT);
 
				this->last_user_action = widget;
 
				break;
 

	
 
			case ETTW_PLACE_OBJECT: // Place transmitter button
 
				if (HandlePlacePushButton(this, ETTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, ETTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) {
 
					ShowBuildObjectPicker(this);
 
					this->last_user_action = widget;
 
				}
 
				break;
 

	
 
			case ETTW_INCREASE_SIZE:
src/tilehighlight_func.h
Show inline comments
 
@@ -12,26 +12,24 @@
 
#ifndef TILEHIGHLIGHT_FUNC_H
 
#define TILEHIGHLIGHT_FUNC_H
 

	
 
#include "gfx_type.h"
 
#include "tilehighlight_type.h"
 

	
 
typedef void PlaceProc(TileIndex tile);
 
void PlaceProc_DemolishArea(TileIndex tile);
 
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
 

	
 
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc);
 
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode);
 
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w);
 
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num);
 
void ResetObjectToPlace();
 

	
 
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
 
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process);
 
void VpSetPresizeRange(TileIndex from, TileIndex to);
 
void VpSetPlaceSizingLimit(int limit);
 

	
 
void UpdateTileSelection();
 

	
 
extern PlaceProc *_place_proc;
 
extern TileHighlightData _thd;
 

	
 
#endif /* TILEHIGHLIGHT_FUNC_H */
src/town_gui.cpp
Show inline comments
 
@@ -1081,13 +1081,13 @@ public:
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TSEW_NEWTOWN:
 
				HandlePlacePushButton(this, TSEW_NEWTOWN, SPR_CURSOR_TOWN, HT_RECT, NULL);
 
				HandlePlacePushButton(this, TSEW_NEWTOWN, SPR_CURSOR_TOWN, HT_RECT);
 
				break;
 

	
 
			case TSEW_RANDOMTOWN:
 
				this->HandleButtonClick(TSEW_RANDOMTOWN);
 
				this->ExecuteFoundTownCommand(0, true, STR_ERROR_CAN_T_GENERATE_TOWN, CcFoundRandomTown);
 
				break;
src/tree_gui.cpp
Show inline comments
 
@@ -102,19 +102,19 @@ public:
 
		switch (widget) {
 
			case BTW_TYPE_11: case BTW_TYPE_12: case BTW_TYPE_13: case BTW_TYPE_14:
 
			case BTW_TYPE_21: case BTW_TYPE_22: case BTW_TYPE_23: case BTW_TYPE_24:
 
			case BTW_TYPE_31: case BTW_TYPE_32: case BTW_TYPE_33: case BTW_TYPE_34:
 
				if (widget - BTW_TYPE_11 >= this->count) break;
 

	
 
				if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT)) {
 
					this->tree_to_plant = (TreeType)(this->base + widget - BTW_TYPE_11);
 
				}
 
				break;
 

	
 
			case BTW_TYPE_RANDOM: // tree of random type.
 
				if (HandlePlacePushButton(this, BTW_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT, NULL)) {
 
				if (HandlePlacePushButton(this, BTW_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT)) {
 
					this->tree_to_plant = TREE_INVALID;
 
				}
 
				break;
 

	
 
			case BTW_MANY_RANDOM: // place trees randomly over the landscape
 
				this->LowerWidget(BTW_MANY_RANDOM);
src/viewport.cpp
Show inline comments
 
@@ -46,13 +46,12 @@
 
#include "tilehighlight_func.h"
 
#include "window_gui.h"
 
#include "terraform_gui.h"
 

	
 
#include "table/strings.h"
 

	
 
PlaceProc *_place_proc;
 
Point _tile_fract_coords;
 

	
 
struct StringSpriteToDraw {
 
	StringID string;
 
	Colours colour;
 
	int32 x;
0 comments (0 inline, 0 general)