Mercurial > hg > openttd
changeset 16892:1e94199f85d6 draft
(svn r21627) -Codechange: Remove _place_proc global variable.
author | alberth <alberth@openttd.org> |
---|---|
date | Fri, 24 Dec 2010 15:08:19 +0000 |
parents | b7771f19cf07 |
children | b4d545b3d3ae |
files | src/airport_gui.cpp src/dock_gui.cpp src/industry_gui.cpp src/main_gui.cpp src/rail_gui.cpp src/road_gui.cpp src/terraform_gui.cpp src/tilehighlight_func.h src/town_gui.cpp src/tree_gui.cpp src/viewport.cpp |
diffstat | 11 files changed, 52 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -89,14 +89,14 @@ { 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;
--- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -134,39 +134,39 @@ 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;
--- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -517,7 +517,7 @@ 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; }
--- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -93,10 +93,9 @@ * @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; @@ -110,7 +109,6 @@ SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number); w->LowerWidget(widget); - _place_proc = placeproc; return true; }
--- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -515,37 +515,37 @@ _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; } @@ -554,13 +554,13 @@ 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; } @@ -568,7 +568,7 @@ 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); } @@ -576,12 +576,12 @@ } 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; @@ -590,7 +590,7 @@ 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;
--- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -386,28 +386,28 @@ _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; } @@ -415,7 +415,7 @@ 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; } @@ -423,7 +423,7 @@ 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; } @@ -437,12 +437,12 @@ 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;
--- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -183,27 +183,27 @@ 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; @@ -214,14 +214,14 @@ 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; } @@ -616,37 +616,37 @@ 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; }
--- a/src/tilehighlight_func.h +++ b/src/tilehighlight_func.h @@ -15,11 +15,10 @@ #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(); @@ -31,7 +30,6 @@ void UpdateTileSelection(); -extern PlaceProc *_place_proc; extern TileHighlightData _thd; #endif /* TILEHIGHLIGHT_FUNC_H */
--- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1084,7 +1084,7 @@ { 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:
--- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -105,13 +105,13 @@ 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;