(svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing

This commit is contained in:
rubidium 2009-04-19 10:31:30 +00:00
parent 2a2b40461d
commit 329cabab4f
21 changed files with 103 additions and 113 deletions

View File

@ -52,12 +52,12 @@ enum {
static void BuildAirClick_Airport(Window *w) static void BuildAirClick_Airport(Window *w)
{ {
if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, VHM_RECT, PlaceAirport)) ShowBuildAirportPicker(w); if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT, PlaceAirport)) ShowBuildAirportPicker(w);
} }
static void BuildAirClick_Demolish(Window *w) static void BuildAirClick_Demolish(Window *w)
{ {
HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea);
} }

View File

@ -1616,7 +1616,7 @@ struct CompanyWindow : Window
TileIndex tile = GetCompany((CompanyID)this->window_number)->location_of_HQ; TileIndex tile = GetCompany((CompanyID)this->window_number)->location_of_HQ;
if (tile == INVALID_TILE) { if (tile == INVALID_TILE) {
if ((byte)this->window_number != _local_company) return; if ((byte)this->window_number != _local_company) return;
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, this); SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
SetTileSelectSize(2, 2); SetTileSelectSize(2, 2);
this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ); this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ);
this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ); this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ);
@ -1631,7 +1631,7 @@ struct CompanyWindow : Window
} }
case CW_WIDGET_RELOCATE_HQ: case CW_WIDGET_RELOCATE_HQ:
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, this); SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this);
SetTileSelectSize(2, 2); SetTileSelectSize(2, 2);
this->LowerWidget(CW_WIDGET_RELOCATE_HQ); this->LowerWidget(CW_WIDGET_RELOCATE_HQ);
this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ); this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ);

View File

@ -487,7 +487,7 @@ struct DepotWindow : Window {
DepotGUIAction mode = this->GetVehicleFromDepotWndPt(x, y, &v, &gdvp); DepotGUIAction mode = this->GetVehicleFromDepotWndPt(x, y, &v, &gdvp);
/* share / copy orders */ /* share / copy orders */
if (_thd.place_mode != VHM_NONE && mode != MODE_ERROR) { if (_thd.place_mode != HT_NONE && mode != MODE_ERROR) {
_place_clicked_vehicle = (this->type == VEH_TRAIN ? gdvp.head : v); _place_clicked_vehicle = (this->type == VEH_TRAIN ? gdvp.head : v);
return; return;
} }
@ -509,7 +509,7 @@ struct DepotWindow : Window {
this->sel = v->index; this->sel = v->index;
this->SetDirty(); this->SetDirty();
SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, this); SetObjectToPlaceWnd(image, GetVehiclePalette(v), HT_DRAG, this);
switch (v->type) { switch (v->type) {
case VEH_TRAIN: case VEH_TRAIN:
@ -783,7 +783,7 @@ struct DepotWindow : Window {
}; };
_place_clicked_vehicle = NULL; _place_clicked_vehicle = NULL;
SetObjectToPlaceWnd(clone_icons[this->type], PAL_NONE, VHM_RECT, this); SetObjectToPlaceWnd(clone_icons[this->type], PAL_NONE, HT_RECT, this);
} else { } else {
ResetObjectToPlace(); ResetObjectToPlace();
} }

View File

@ -107,46 +107,46 @@ enum DockToolbarWidgets {
static void BuildDocksClick_Canal(Window *w) static void BuildDocksClick_Canal(Window *w)
{ {
HandlePlacePushButton(w, DTW_CANAL, SPR_CURSOR_CANAL, VHM_RECT, PlaceDocks_BuildCanal); HandlePlacePushButton(w, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT, PlaceDocks_BuildCanal);
} }
static void BuildDocksClick_Lock(Window *w) static void BuildDocksClick_Lock(Window *w)
{ {
HandlePlacePushButton(w, DTW_LOCK, SPR_CURSOR_LOCK, VHM_RECT, PlaceDocks_BuildLock); HandlePlacePushButton(w, DTW_LOCK, SPR_CURSOR_LOCK, HT_RECT, PlaceDocks_BuildLock);
} }
static void BuildDocksClick_Demolish(Window *w) static void BuildDocksClick_Demolish(Window *w)
{ {
HandlePlacePushButton(w, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); HandlePlacePushButton(w, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea);
} }
static void BuildDocksClick_Depot(Window *w) static void BuildDocksClick_Depot(Window *w)
{ {
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
if (HandlePlacePushButton(w, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, VHM_RECT, PlaceDocks_Depot)) ShowBuildDocksDepotPicker(w); if (HandlePlacePushButton(w, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT, PlaceDocks_Depot)) ShowBuildDocksDepotPicker(w);
} }
static void BuildDocksClick_Dock(Window *w) static void BuildDocksClick_Dock(Window *w)
{ {
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
if (HandlePlacePushButton(w, DTW_STATION, SPR_CURSOR_DOCK, VHM_SPECIAL, PlaceDocks_Dock)) ShowBuildDockStationPicker(w); if (HandlePlacePushButton(w, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL, PlaceDocks_Dock)) ShowBuildDockStationPicker(w);
} }
static void BuildDocksClick_Buoy(Window *w) static void BuildDocksClick_Buoy(Window *w)
{ {
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
HandlePlacePushButton(w, DTW_BUOY, SPR_CURSOR_BOUY, VHM_RECT, PlaceDocks_Buoy); HandlePlacePushButton(w, DTW_BUOY, SPR_CURSOR_BOUY, HT_RECT, PlaceDocks_Buoy);
} }
static void BuildDocksClick_River(Window *w) static void BuildDocksClick_River(Window *w)
{ {
if (_game_mode != GM_EDITOR) return; if (_game_mode != GM_EDITOR) return;
HandlePlacePushButton(w, DTW_RIVER, SPR_CURSOR_RIVER, VHM_RECT, PlaceDocks_BuildRiver); HandlePlacePushButton(w, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT, PlaceDocks_BuildRiver);
} }
static void BuildDocksClick_Aqueduct(Window *w) static void BuildDocksClick_Aqueduct(Window *w)
{ {
HandlePlacePushButton(w, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, VHM_RECT, PlaceDocks_Aqueduct); HandlePlacePushButton(w, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_RECT, PlaceDocks_Aqueduct);
} }

View File

@ -114,7 +114,7 @@ static void _GenerateWorld(void *arg)
if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom(); if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
_random.SetSeed(_settings_game.game_creation.generation_seed); _random.SetSeed(_settings_game.game_creation.generation_seed);
SetGeneratingWorldProgress(GWP_MAP_INIT, 2); SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
IncreaseGeneratingWorldProgress(GWP_MAP_INIT); IncreaseGeneratingWorldProgress(GWP_MAP_INIT);
/* Must start economy early because of the costs. */ /* Must start economy early because of the costs. */

View File

@ -546,7 +546,7 @@ public:
this->vehicle_sel = v->index; this->vehicle_sel = v->index;
if (v->IsValid()) { if (v->IsValid()) {
SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), VHM_DRAG, this); SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), HT_DRAG, this);
_cursor.vehchain = true; _cursor.vehchain = true;
} }

View File

@ -346,7 +346,7 @@ public:
DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
this->HandleButtonClick(DPIW_FUND_WIDGET); this->HandleButtonClick(DPIW_FUND_WIDGET);
} else { } else {
HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL); HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT, NULL);
} }
} break; } break;
} }

View File

@ -87,7 +87,7 @@ void HandleOnEditText(const char *str)
* @param placeproc Procedure which will be called when someone clicks on the map * @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 * @return true if the button is clicked, false if it's unclicked
*/ */
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc) bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc)
{ {
if (w->IsWidgetDisabled(widget)) return false; if (w->IsWidgetDisabled(widget)) return false;

View File

@ -59,7 +59,7 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date)
AllocateMap(size_x, size_y); AllocateMap(size_x, size_y);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
_pause_game = 0; _pause_game = 0;
_fast_forward = 0; _fast_forward = 0;

View File

@ -284,7 +284,7 @@ void PlaceLandBlockInfo()
ResetObjectToPlace(); ResetObjectToPlace();
} else { } else {
_place_proc = Place_LandInfo; _place_proc = Place_LandInfo;
SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0); SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
} }
} }
@ -1546,7 +1546,7 @@ public:
this->resize.step_width = 2; this->resize.step_width = 2;
this->resize.step_height = 10; this->resize.step_height = 10;
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
/* Use an array to define what will be the current file type being handled /* Use an array to define what will be the current file type being handled
* by current file mode */ * by current file mode */

View File

@ -454,7 +454,7 @@ private:
w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
_place_clicked_vehicle = NULL; _place_clicked_vehicle = NULL;
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w); SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, w);
w->goto_type = OPOS_GOTO; w->goto_type = OPOS_GOTO;
} else { } else {
ResetObjectToPlace(); ResetObjectToPlace();
@ -522,7 +522,7 @@ private:
{ {
w->InvalidateWidget(ORDER_WIDGET_GOTO); w->InvalidateWidget(ORDER_WIDGET_GOTO);
w->LowerWidget(ORDER_WIDGET_GOTO); w->LowerWidget(ORDER_WIDGET_GOTO);
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w); SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, w);
w->goto_type = OPOS_CONDITIONAL; w->goto_type = OPOS_CONDITIONAL;
} }
@ -884,7 +884,7 @@ public:
if (this->vehicle->owner == _local_company) { if (this->vehicle->owner == _local_company) {
/* Activate drag and drop */ /* Activate drag and drop */
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, this); SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
} }
} }

View File

@ -332,7 +332,7 @@ static bool RailToolbar_CtrlChanged(Window *w)
*/ */
static void BuildRailClick_N(Window *w) static void BuildRailClick_N(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, VHM_RECT, PlaceRail_N); HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_RECT, PlaceRail_N);
} }
/** /**
@ -342,7 +342,7 @@ static void BuildRailClick_N(Window *w)
*/ */
static void BuildRailClick_NE(Window *w) static void BuildRailClick_NE(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, VHM_RECT, PlaceRail_NE); HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_RECT, PlaceRail_NE);
} }
/** /**
@ -352,7 +352,7 @@ static void BuildRailClick_NE(Window *w)
*/ */
static void BuildRailClick_E(Window *w) static void BuildRailClick_E(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, VHM_RECT, PlaceRail_E); HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_RECT, PlaceRail_E);
} }
/** /**
@ -362,7 +362,7 @@ static void BuildRailClick_E(Window *w)
*/ */
static void BuildRailClick_NW(Window *w) static void BuildRailClick_NW(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, VHM_RECT, PlaceRail_NW); HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_RECT, PlaceRail_NW);
} }
/** /**
@ -372,7 +372,7 @@ static void BuildRailClick_NW(Window *w)
*/ */
static void BuildRailClick_AutoRail(Window *w) static void BuildRailClick_AutoRail(Window *w)
{ {
HandlePlacePushButton(w, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, VHM_RAIL, PlaceRail_AutoRail); HandlePlacePushButton(w, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL, PlaceRail_AutoRail);
} }
/** /**
@ -382,7 +382,7 @@ static void BuildRailClick_AutoRail(Window *w)
*/ */
static void BuildRailClick_Demolish(Window *w) static void BuildRailClick_Demolish(Window *w)
{ {
HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea);
} }
/** /**
@ -392,7 +392,7 @@ static void BuildRailClick_Demolish(Window *w)
*/ */
static void BuildRailClick_Depot(Window *w) static void BuildRailClick_Depot(Window *w)
{ {
if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, VHM_RECT, PlaceRail_Depot)) { if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT, PlaceRail_Depot)) {
ShowBuildTrainDepotPicker(w); ShowBuildTrainDepotPicker(w);
} }
} }
@ -406,7 +406,7 @@ static void BuildRailClick_Depot(Window *w)
static void BuildRailClick_Waypoint(Window *w) static void BuildRailClick_Waypoint(Window *w)
{ {
_waypoint_count = GetNumCustomStations(STAT_CLASS_WAYP); _waypoint_count = GetNumCustomStations(STAT_CLASS_WAYP);
if (HandlePlacePushButton(w, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, VHM_RECT, PlaceRail_Waypoint) && if (HandlePlacePushButton(w, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT, PlaceRail_Waypoint) &&
_waypoint_count > 1) { _waypoint_count > 1) {
ShowBuildWaypointPicker(w); ShowBuildWaypointPicker(w);
} }
@ -419,7 +419,7 @@ static void BuildRailClick_Waypoint(Window *w)
*/ */
static void BuildRailClick_Station(Window *w) static void BuildRailClick_Station(Window *w)
{ {
if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, VHM_RECT, PlaceRail_Station)) ShowStationBuilder(w); if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT, PlaceRail_Station)) ShowStationBuilder(w);
} }
/** /**
@ -431,9 +431,9 @@ static void BuildRailClick_Station(Window *w)
static void BuildRailClick_AutoSignals(Window *w) static void BuildRailClick_AutoSignals(Window *w)
{ {
if (_settings_client.gui.enable_signal_gui != _ctrl_pressed) { if (_settings_client.gui.enable_signal_gui != _ctrl_pressed) {
if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w); if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w);
} else { } else {
HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT, PlaceRail_AutoSignals);
} }
} }
@ -444,7 +444,7 @@ static void BuildRailClick_AutoSignals(Window *w)
*/ */
static void BuildRailClick_Bridge(Window *w) static void BuildRailClick_Bridge(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRail_Bridge); HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT, PlaceRail_Bridge);
} }
/** /**
@ -454,7 +454,7 @@ static void BuildRailClick_Bridge(Window *w)
*/ */
static void BuildRailClick_Tunnel(Window *w) static void BuildRailClick_Tunnel(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, VHM_SPECIAL, PlaceRail_Tunnel); HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL, PlaceRail_Tunnel);
} }
/** /**
@ -499,7 +499,7 @@ static void BuildRailClick_Remove(Window *w)
*/ */
static void BuildRailClick_Convert(Window *w) static void BuildRailClick_Convert(Window *w)
{ {
HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, VHM_RECT, PlaceRail_ConvertRail); HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT, PlaceRail_ConvertRail);
} }

View File

@ -293,7 +293,7 @@ static bool RoadToolbar_CtrlChanged(Window *w)
*/ */
static void BuildRoadClick_X_Dir(Window *w) static void BuildRoadClick_X_Dir(Window *w)
{ {
HandlePlacePushButton(w, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, VHM_RECT, PlaceRoad_X_Dir); HandlePlacePushButton(w, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT, PlaceRoad_X_Dir);
} }
/** /**
@ -304,7 +304,7 @@ static void BuildRoadClick_X_Dir(Window *w)
*/ */
static void BuildRoadClick_Y_Dir(Window *w) static void BuildRoadClick_Y_Dir(Window *w)
{ {
HandlePlacePushButton(w, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, VHM_RECT, PlaceRoad_Y_Dir); HandlePlacePushButton(w, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT, PlaceRoad_Y_Dir);
} }
/** /**
@ -315,30 +315,30 @@ static void BuildRoadClick_Y_Dir(Window *w)
*/ */
static void BuildRoadClick_AutoRoad(Window *w) static void BuildRoadClick_AutoRoad(Window *w)
{ {
HandlePlacePushButton(w, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, VHM_RECT, PlaceRoad_AutoRoad); HandlePlacePushButton(w, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT, PlaceRoad_AutoRoad);
} }
static void BuildRoadClick_Demolish(Window *w) static void BuildRoadClick_Demolish(Window *w)
{ {
HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea);
} }
static void BuildRoadClick_Depot(Window *w) static void BuildRoadClick_Depot(Window *w)
{ {
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(w, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, VHM_RECT, PlaceRoad_Depot)) ShowRoadDepotPicker(w); if (HandlePlacePushButton(w, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT, PlaceRoad_Depot)) ShowRoadDepotPicker(w);
} }
static void BuildRoadClick_BusStation(Window *w) static void BuildRoadClick_BusStation(Window *w)
{ {
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, VHM_RECT, PlaceRoad_BusStation)) ShowRVStationPicker(w, ROADSTOP_BUS); if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT, PlaceRoad_BusStation)) ShowRVStationPicker(w, ROADSTOP_BUS);
} }
static void BuildRoadClick_TruckStation(Window *w) static void BuildRoadClick_TruckStation(Window *w)
{ {
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, VHM_RECT, PlaceRoad_TruckStation)) ShowRVStationPicker(w, ROADSTOP_TRUCK); if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT, PlaceRoad_TruckStation)) ShowRVStationPicker(w, ROADSTOP_TRUCK);
} }
/** /**
@ -357,12 +357,12 @@ static void BuildRoadClick_OneWay(Window *w)
static void BuildRoadClick_Bridge(Window *w) static void BuildRoadClick_Bridge(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRoad_Bridge); HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT, PlaceRoad_Bridge);
} }
static void BuildRoadClick_Tunnel(Window *w) static void BuildRoadClick_Tunnel(Window *w)
{ {
HandlePlacePushButton(w, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, VHM_SPECIAL, PlaceRoad_Tunnel); HandlePlacePushButton(w, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL, PlaceRoad_Tunnel);
} }
static void BuildRoadClick_Remove(Window *w) static void BuildRoadClick_Remove(Window *w)

View File

@ -202,27 +202,27 @@ enum TerraformToolbarWidgets {
static void TerraformClick_Lower(Window *w) static void TerraformClick_Lower(Window *w)
{ {
HandlePlacePushButton(w, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerLand); HandlePlacePushButton(w, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT, PlaceProc_LowerLand);
} }
static void TerraformClick_Raise(Window *w) static void TerraformClick_Raise(Window *w)
{ {
HandlePlacePushButton(w, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseLand); HandlePlacePushButton(w, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT, PlaceProc_RaiseLand);
} }
static void TerraformClick_Level(Window *w) static void TerraformClick_Level(Window *w)
{ {
HandlePlacePushButton(w, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand); HandlePlacePushButton(w, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT, PlaceProc_LevelLand);
} }
static void TerraformClick_Dynamite(Window *w) static void TerraformClick_Dynamite(Window *w)
{ {
HandlePlacePushButton(w, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH , VHM_RECT, PlaceProc_DemolishArea); HandlePlacePushButton(w, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH , HT_RECT, PlaceProc_DemolishArea);
} }
static void TerraformClick_BuyLand(Window *w) static void TerraformClick_BuyLand(Window *w)
{ {
HandlePlacePushButton(w, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, VHM_RECT, PlaceProc_BuyLand); HandlePlacePushButton(w, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT, PlaceProc_BuyLand);
} }
static void TerraformClick_Trees(Window *w) static void TerraformClick_Trees(Window *w)
@ -233,7 +233,7 @@ static void TerraformClick_Trees(Window *w)
static void TerraformClick_PlaceSign(Window *w) static void TerraformClick_PlaceSign(Window *w)
{ {
HandlePlacePushButton(w, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, VHM_RECT, PlaceProc_Sign); HandlePlacePushButton(w, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT, PlaceProc_Sign);
} }
static OnButtonClick * const _terraform_button_proc[] = { static OnButtonClick * const _terraform_button_proc[] = {
@ -562,37 +562,37 @@ static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = {
*/ */
static void EditorTerraformClick_Dynamite(Window *w) static void EditorTerraformClick_Dynamite(Window *w)
{ {
HandlePlacePushButton(w, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); HandlePlacePushButton(w, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea);
} }
static void EditorTerraformClick_LowerBigLand(Window *w) static void EditorTerraformClick_LowerBigLand(Window *w)
{ {
HandlePlacePushButton(w, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerBigLand); HandlePlacePushButton(w, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT, PlaceProc_LowerBigLand);
} }
static void EditorTerraformClick_RaiseBigLand(Window *w) static void EditorTerraformClick_RaiseBigLand(Window *w)
{ {
HandlePlacePushButton(w, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseBigLand); HandlePlacePushButton(w, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT, PlaceProc_RaiseBigLand);
} }
static void EditorTerraformClick_LevelLand(Window *w) static void EditorTerraformClick_LevelLand(Window *w)
{ {
HandlePlacePushButton(w, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand); HandlePlacePushButton(w, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT, PlaceProc_LevelLand);
} }
static void EditorTerraformClick_RockyArea(Window *w) static void EditorTerraformClick_RockyArea(Window *w)
{ {
HandlePlacePushButton(w, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, VHM_RECT, PlaceProc_RockyArea); HandlePlacePushButton(w, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT, PlaceProc_RockyArea);
} }
static void EditorTerraformClick_DesertLightHouse(Window *w) static void EditorTerraformClick_DesertLightHouse(Window *w)
{ {
HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, VHM_RECT, (_settings_game.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse); HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, HT_RECT, (_settings_game.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
} }
static void EditorTerraformClick_Transmitter(Window *w) static void EditorTerraformClick_Transmitter(Window *w)
{ {
HandlePlacePushButton(w, ETTW_PLACE_TRANSMITTER, SPR_CURSOR_TRANSMITTER, VHM_RECT, PlaceProc_Transmitter); HandlePlacePushButton(w, ETTW_PLACE_TRANSMITTER, SPR_CURSOR_TRANSMITTER, HT_RECT, PlaceProc_Transmitter);
} }
static const uint16 _editor_terraform_keycodes[] = { static const uint16 _editor_terraform_keycodes[] = {

View File

@ -14,9 +14,9 @@ typedef void PlaceProc(TileIndex tile);
void PlaceProc_DemolishArea(TileIndex tile); void PlaceProc_DemolishArea(TileIndex tile);
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile); bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc); bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc);
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w); void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, HighLightStyle mode, Window *w);
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num); void SetObjectToPlace(CursorID icon, SpriteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num);
void ResetObjectToPlace(); void ResetObjectToPlace();
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method); void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);

View File

@ -10,26 +10,16 @@
#include "window_type.h" #include "window_type.h"
#include "tile_type.h" #include "tile_type.h"
/** Viewport highlight mode (for highlighting tiles below cursor) */
enum ViewportHighlightMode {
VHM_NONE = 0, ///< default
VHM_RECT = 1, ///< rectangle (stations, depots, ...)
VHM_POINT = 2, ///< point (lower land, raise land, level land, ...)
VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
VHM_DRAG = 4, ///< dragging items in the depot windows
VHM_RAIL = 5, ///< rail pieces
};
/** Highlighting draw styles */ /** Highlighting draw styles */
enum HighLightStyle { enum HighLightStyle {
HT_NONE = 0x00, HT_NONE = 0x00, ///< default
HT_RECT = 0x80, HT_RECT = 0x10, ///< rectangle (stations, depots, ...)
HT_POINT = 0x40, HT_POINT = 0x20, ///< point (lower land, raise land, level land, ...)
HT_LINE = 0x20, ///< used for autorail highlighting (longer streches) HT_SPECIAL = 0x30, ///< special mode used for highlighting while dragging (and for tunnels/docks)
///< (uses lower bits to indicate direction) HT_DRAG = 0x40, ///< dragging items in the depot windows
HT_RAIL = 0x10, ///< autorail (one piece) HT_LINE = 0x08, ///< used for autorail highlighting (longer streches), lower bits: direction
///< (uses lower bits to indicate direction) HT_RAIL = 0x80, ///< autorail (one piece), lower bits: direction
HT_DRAG_MASK = 0xF0, ///< masks the drag-type HT_DRAG_MASK = 0xF8, ///< masks the drag-type
/* lower bits (used with HT_LINE and HT_RAIL): /* lower bits (used with HT_LINE and HT_RAIL):
* (see ASCII art in autorail.h for a visual interpretation) */ * (see ASCII art in autorail.h for a visual interpretation) */
@ -64,7 +54,7 @@ struct TileHighlightData {
HighLightStyle new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new HighLightStyle new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
HighLightStyle next_drawstyle; // queued, but not yet drawn style HighLightStyle next_drawstyle; // queued, but not yet drawn style
ViewportHighlightMode place_mode; HighLightStyle place_mode;
bool make_square_red; bool make_square_red;
WindowClass window_class; WindowClass window_class;
WindowNumber window_number; WindowNumber window_number;

View File

@ -238,7 +238,7 @@ static void SelectSignTool()
if (_cursor.sprite == SPR_CURSOR_SIGN) { if (_cursor.sprite == SPR_CURSOR_SIGN) {
ResetObjectToPlace(); ResetObjectToPlace();
} else { } else {
SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0); SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
_place_proc = PlaceProc_Sign; _place_proc = PlaceProc_Sign;
} }
} }

View File

@ -884,7 +884,7 @@ public:
{ {
switch (widget) { switch (widget) {
case TSEW_NEWTOWN: case TSEW_NEWTOWN:
HandlePlacePushButton(this, TSEW_NEWTOWN, SPR_CURSOR_TOWN, VHM_RECT, PlaceProc_Town); HandlePlacePushButton(this, TSEW_NEWTOWN, SPR_CURSOR_TOWN, HT_RECT, PlaceProc_Town);
break; break;
case TSEW_RANDOMTOWN: { case TSEW_RANDOMTOWN: {

View File

@ -102,13 +102,13 @@ public:
case BTW_TYPE_31: case BTW_TYPE_32: case BTW_TYPE_33: case BTW_TYPE_34: 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 (widget - BTW_TYPE_11 >= this->count) break;
if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, VHM_RECT, NULL)) { if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT, NULL)) {
this->tree_to_plant = this->base + widget - BTW_TYPE_11; this->tree_to_plant = this->base + widget - BTW_TYPE_11;
} }
break; break;
case BTW_TYPE_RANDOM: // tree of random type. case BTW_TYPE_RANDOM: // tree of random type.
if (HandlePlacePushButton(this, BTW_TYPE_RANDOM, SPR_CURSOR_TREE, VHM_RECT, NULL)) { if (HandlePlacePushButton(this, BTW_TYPE_RANDOM, SPR_CURSOR_TREE, HT_RECT, NULL)) {
this->tree_to_plant = UINT_MAX; this->tree_to_plant = UINT_MAX;
} }
break; break;

View File

@ -2060,7 +2060,7 @@ void PlaceObject()
pt = GetTileBelowCursor(); pt = GetTileBelowCursor();
if (pt.x == -1) return; if (pt.x == -1) return;
if (_thd.place_mode == VHM_POINT) { if (_thd.place_mode == HT_POINT) {
pt.x += 8; pt.x += 8;
pt.y += 8; pt.y += 8;
} }
@ -2149,7 +2149,7 @@ void UpdateTileSelection()
_thd.new_drawstyle = HT_NONE; _thd.new_drawstyle = HT_NONE;
if (_thd.place_mode == VHM_SPECIAL) { if (_thd.place_mode == HT_SPECIAL) {
x1 = _thd.selend.x; x1 = _thd.selend.x;
y1 = _thd.selend.y; y1 = _thd.selend.y;
if (x1 != -1) { if (x1 != -1) {
@ -2166,21 +2166,21 @@ void UpdateTileSelection()
_thd.new_size.y = y2 - y1 + TILE_SIZE; _thd.new_size.y = y2 - y1 + TILE_SIZE;
_thd.new_drawstyle = _thd.next_drawstyle; _thd.new_drawstyle = _thd.next_drawstyle;
} }
} else if (_thd.place_mode != VHM_NONE) { } else if (_thd.place_mode != HT_NONE) {
Point pt = GetTileBelowCursor(); Point pt = GetTileBelowCursor();
x1 = pt.x; x1 = pt.x;
y1 = pt.y; y1 = pt.y;
if (x1 != -1) { if (x1 != -1) {
switch (_thd.place_mode) { switch (_thd.place_mode) {
case VHM_RECT: case HT_RECT:
_thd.new_drawstyle = HT_RECT; _thd.new_drawstyle = HT_RECT;
break; break;
case VHM_POINT: case HT_POINT:
_thd.new_drawstyle = HT_POINT; _thd.new_drawstyle = HT_POINT;
x1 += TILE_SIZE / 2; x1 += TILE_SIZE / 2;
y1 += TILE_SIZE / 2; y1 += TILE_SIZE / 2;
break; break;
case VHM_RAIL: case HT_RAIL:
_thd.new_drawstyle = GetAutorailHT(pt.x, pt.y); // draw one highlighted tile _thd.new_drawstyle = GetAutorailHT(pt.x, pt.y); // draw one highlighted tile
break; break;
default: default:
@ -2243,14 +2243,14 @@ void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDrag
_thd.selstart.y += TILE_SIZE / 2; _thd.selstart.y += TILE_SIZE / 2;
} }
if (_thd.place_mode == VHM_RECT) { if (_thd.place_mode == HT_RECT) {
_thd.place_mode = VHM_SPECIAL; _thd.place_mode = HT_SPECIAL;
_thd.next_drawstyle = HT_RECT; _thd.next_drawstyle = HT_RECT;
} else if (_thd.place_mode == VHM_RAIL) { // autorail one piece } else if (_thd.place_mode == HT_RAIL) { // autorail one piece
_thd.place_mode = VHM_SPECIAL; _thd.place_mode = HT_SPECIAL;
_thd.next_drawstyle = _thd.drawstyle; _thd.next_drawstyle = _thd.drawstyle;
} else { } else {
_thd.place_mode = VHM_SPECIAL; _thd.place_mode = HT_SPECIAL;
_thd.next_drawstyle = HT_POINT; _thd.next_drawstyle = HT_POINT;
} }
_special_mouse_mode = WSM_SIZING; _special_mouse_mode = WSM_SIZING;
@ -2709,15 +2709,15 @@ bool VpHandlePlaceSizingDrag()
* keep the selected tool, but reset it to the original mode. */ * keep the selected tool, but reset it to the original mode. */
_special_mouse_mode = WSM_NONE; _special_mouse_mode = WSM_NONE;
if (_thd.next_drawstyle == HT_RECT) { if (_thd.next_drawstyle == HT_RECT) {
_thd.place_mode = VHM_RECT; _thd.place_mode = HT_RECT;
} else if (_thd.select_method == VPM_SIGNALDIRS) { // some might call this a hack... -- Dominik } else if (_thd.select_method == VPM_SIGNALDIRS) { // some might call this a hack... -- Dominik
_thd.place_mode = VHM_RECT; _thd.place_mode = HT_RECT;
} else if (_thd.next_drawstyle & HT_LINE) { } else if (_thd.next_drawstyle & HT_LINE) {
_thd.place_mode = VHM_RAIL; _thd.place_mode = HT_RAIL;
} else if (_thd.next_drawstyle & HT_RAIL) { } else if (_thd.next_drawstyle & HT_RAIL) {
_thd.place_mode = VHM_RAIL; _thd.place_mode = HT_RAIL;
} else { } else {
_thd.place_mode = VHM_POINT; _thd.place_mode = HT_POINT;
} }
SetTileSelectSize(1, 1); SetTileSelectSize(1, 1);
@ -2726,17 +2726,17 @@ bool VpHandlePlaceSizingDrag()
return false; return false;
} }
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w) void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, HighLightStyle mode, Window *w)
{ {
SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number); SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number);
} }
#include "table/animcursors.h" #include "table/animcursors.h"
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num) void SetObjectToPlace(CursorID icon, SpriteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
{ {
/* undo clicking on button and drag & drop */ /* undo clicking on button and drag & drop */
if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) { if (_thd.place_mode != HT_NONE || _special_mouse_mode == WSM_DRAGDROP) {
Window *w = FindWindowById(_thd.window_class, _thd.window_number); Window *w = FindWindowById(_thd.window_class, _thd.window_number);
if (w != NULL) { if (w != NULL) {
/* Call the abort function, but set the window class to something /* Call the abort function, but set the window class to something
@ -2753,8 +2753,8 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, W
_thd.make_square_red = false; _thd.make_square_red = false;
if (mode == VHM_DRAG) { // VHM_DRAG is for dragdropping trains in the depot window if (mode == HT_DRAG) { // HT_DRAG is for dragdropping trains in the depot window
mode = VHM_NONE; mode = HT_NONE;
_special_mouse_mode = WSM_DRAGDROP; _special_mouse_mode = WSM_DRAGDROP;
} else { } else {
_special_mouse_mode = WSM_NONE; _special_mouse_mode = WSM_NONE;
@ -2764,7 +2764,7 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, W
_thd.window_class = window_class; _thd.window_class = window_class;
_thd.window_number = window_num; _thd.window_number = window_num;
if (mode == VHM_SPECIAL) // special tools, like tunnels or docks start with presizing mode if (mode == HT_SPECIAL) // special tools, like tunnels or docks start with presizing mode
VpStartPreSizing(); VpStartPreSizing();
if ((int)icon < 0) { if ((int)icon < 0) {
@ -2777,5 +2777,5 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, W
void ResetObjectToPlace() void ResetObjectToPlace()
{ {
SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
} }

View File

@ -577,7 +577,7 @@ void Window::DeleteChildWindows() const
*/ */
Window::~Window() Window::~Window()
{ {
if (_thd.place_mode != VHM_NONE && if (_thd.place_mode != HT_NONE &&
_thd.window_class == this->window_class && _thd.window_class == this->window_class &&
_thd.window_number == this->window_number) { _thd.window_number == this->window_number) {
ResetObjectToPlace(); ResetObjectToPlace();
@ -1994,7 +1994,7 @@ void MouseLoop(MouseClick click, int mousewheel)
case MC_DOUBLE_LEFT: case MC_DOUBLE_LEFT:
case MC_LEFT: case MC_LEFT:
DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite); DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
if (_thd.place_mode != VHM_NONE && if (_thd.place_mode != HT_NONE &&
/* query button and place sign button work in pause mode */ /* query button and place sign button work in pause mode */
_cursor.sprite != SPR_CURSOR_QUERY && _cursor.sprite != SPR_CURSOR_QUERY &&
_cursor.sprite != SPR_CURSOR_SIGN && _cursor.sprite != SPR_CURSOR_SIGN &&
@ -2003,7 +2003,7 @@ void MouseLoop(MouseClick click, int mousewheel)
return; return;
} }
if (_thd.place_mode == VHM_NONE) { if (_thd.place_mode == HT_NONE) {
if (!HandleViewportClicked(vp, x, y) && if (!HandleViewportClicked(vp, x, y) &&
!(w->flags4 & WF_DISABLE_VP_SCROLL) && !(w->flags4 & WF_DISABLE_VP_SCROLL) &&
_settings_client.gui.left_mouse_btn_scrolling) { _settings_client.gui.left_mouse_btn_scrolling) {