diff options
author | rubidium <rubidium@openttd.org> | 2009-04-19 10:31:30 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-19 10:31:30 +0000 |
commit | 329cabab4fe4b963c1b928740e0d9f38f7e63b01 (patch) | |
tree | a601e141ae386f6a3a400c146dc605dcb03c20d3 | |
parent | 2a2b40461d478406aef9d12093e07ed8ae5b987f (diff) | |
download | openttd-329cabab4fe4b963c1b928740e0d9f38f7e63b01.tar.xz |
(svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
-rw-r--r-- | src/airport_gui.cpp | 4 | ||||
-rw-r--r-- | src/company_gui.cpp | 4 | ||||
-rw-r--r-- | src/depot_gui.cpp | 6 | ||||
-rw-r--r-- | src/dock_gui.cpp | 16 | ||||
-rw-r--r-- | src/genworld.cpp | 2 | ||||
-rw-r--r-- | src/group_gui.cpp | 2 | ||||
-rw-r--r-- | src/industry_gui.cpp | 2 | ||||
-rw-r--r-- | src/main_gui.cpp | 2 | ||||
-rw-r--r-- | src/misc.cpp | 2 | ||||
-rw-r--r-- | src/misc_gui.cpp | 4 | ||||
-rw-r--r-- | src/order_gui.cpp | 6 | ||||
-rw-r--r-- | src/rail_gui.cpp | 28 | ||||
-rw-r--r-- | src/road_gui.cpp | 18 | ||||
-rw-r--r-- | src/terraform_gui.cpp | 26 | ||||
-rw-r--r-- | src/tilehighlight_func.h | 6 | ||||
-rw-r--r-- | src/tilehighlight_type.h | 28 | ||||
-rw-r--r-- | src/toolbar_gui.cpp | 2 | ||||
-rw-r--r-- | src/town_gui.cpp | 2 | ||||
-rw-r--r-- | src/tree_gui.cpp | 4 | ||||
-rw-r--r-- | src/viewport.cpp | 46 | ||||
-rw-r--r-- | src/window.cpp | 6 |
21 files changed, 103 insertions, 113 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 651b79f06..b62682d49 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -52,12 +52,12 @@ enum { 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) { - HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); + HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT, PlaceProc_DemolishArea); } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 1464927e8..31850c055 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1616,7 +1616,7 @@ struct CompanyWindow : Window TileIndex tile = GetCompany((CompanyID)this->window_number)->location_of_HQ; if (tile == INVALID_TILE) { 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); this->LowerWidget(CW_WIDGET_BUILD_VIEW_HQ); this->InvalidateWidget(CW_WIDGET_BUILD_VIEW_HQ); @@ -1631,7 +1631,7 @@ struct CompanyWindow : Window } 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); this->LowerWidget(CW_WIDGET_RELOCATE_HQ); this->InvalidateWidget(CW_WIDGET_RELOCATE_HQ); diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index af62b9b5a..b094aa524 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -487,7 +487,7 @@ struct DepotWindow : Window { DepotGUIAction mode = this->GetVehicleFromDepotWndPt(x, y, &v, &gdvp); /* 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); return; } @@ -509,7 +509,7 @@ struct DepotWindow : Window { this->sel = v->index; this->SetDirty(); - SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, this); + SetObjectToPlaceWnd(image, GetVehiclePalette(v), HT_DRAG, this); switch (v->type) { case VEH_TRAIN: @@ -783,7 +783,7 @@ struct DepotWindow : Window { }; _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 { ResetObjectToPlace(); } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 1377f1b7d..b0b78de6f 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -107,46 +107,46 @@ enum DockToolbarWidgets { 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) { - 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) { - 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) { 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) { 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) { 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) { 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) { - HandlePlacePushButton(w, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, VHM_RECT, PlaceDocks_Aqueduct); + HandlePlacePushButton(w, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_RECT, PlaceDocks_Aqueduct); } diff --git a/src/genworld.cpp b/src/genworld.cpp index dfae4822e..d520292b7 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -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(); _random.SetSeed(_settings_game.game_creation.generation_seed); 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); /* Must start economy early because of the costs. */ diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 4c8d1dc04..84a98b8d4 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -546,7 +546,7 @@ public: this->vehicle_sel = v->index; 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; } diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 5baecc098..3e19b7a60 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -346,7 +346,7 @@ public: DoCommandP(0, this->selected_type, InteractiveRandom(), CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)); this->HandleButtonClick(DPIW_FUND_WIDGET); } else { - HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL); + HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, HT_RECT, NULL); } } break; } diff --git a/src/main_gui.cpp b/src/main_gui.cpp index f7b2ee3d8..0b1c1cc73 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -87,7 +87,7 @@ void HandleOnEditText(const char *str) * @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, ViewportHighlightMode mode, PlaceProc *placeproc) +bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc) { if (w->IsWidgetDisabled(widget)) return false; diff --git a/src/misc.cpp b/src/misc.cpp index ce527cb4b..d647f2e7e 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -59,7 +59,7 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date) 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; _fast_forward = 0; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index d9cb4d6f2..dad23dcaf 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -284,7 +284,7 @@ void PlaceLandBlockInfo() ResetObjectToPlace(); } else { _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_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 * by current file mode */ diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 4b7b75f58..a80f644cb 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -454,7 +454,7 @@ private: w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { _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; } else { ResetObjectToPlace(); @@ -522,7 +522,7 @@ private: { w->InvalidateWidget(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; } @@ -884,7 +884,7 @@ public: if (this->vehicle->owner == _local_company) { /* Activate drag and drop */ - SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, this); + SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this); } } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 770f6f955..b0ab53f2d 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -332,7 +332,7 @@ static bool RailToolbar_CtrlChanged(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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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); } } @@ -406,7 +406,7 @@ static void BuildRailClick_Depot(Window *w) static void BuildRailClick_Waypoint(Window *w) { _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) { ShowBuildWaypointPicker(w); } @@ -419,7 +419,7 @@ static void BuildRailClick_Waypoint(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) { 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 { - 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) { - 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) { - 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) { - 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); } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 4189af940..13b69f9cb 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -293,7 +293,7 @@ static bool RoadToolbar_CtrlChanged(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) { - 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) { - 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) { - 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) { 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) { 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) { 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) { - 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) { - 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) diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index ac6231967..67e9d8e7e 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -202,27 +202,27 @@ enum TerraformToolbarWidgets { 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) { - 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) { - 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) { - 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) { - 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) @@ -233,7 +233,7 @@ static void TerraformClick_Trees(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[] = { @@ -562,37 +562,37 @@ static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = { */ 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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[] = { diff --git a/src/tilehighlight_func.h b/src/tilehighlight_func.h index af57bcb29..6c7767860 100644 --- a/src/tilehighlight_func.h +++ b/src/tilehighlight_func.h @@ -14,9 +14,9 @@ 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, ViewportHighlightMode mode, PlaceProc *placeproc); -void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w); -void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num); +bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc); +void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, HighLightStyle mode, Window *w); +void SetObjectToPlace(CursorID icon, SpriteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num); void ResetObjectToPlace(); void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method); diff --git a/src/tilehighlight_type.h b/src/tilehighlight_type.h index 934aaa13a..a3ddad5f2 100644 --- a/src/tilehighlight_type.h +++ b/src/tilehighlight_type.h @@ -10,26 +10,16 @@ #include "window_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 */ enum HighLightStyle { - HT_NONE = 0x00, - HT_RECT = 0x80, - HT_POINT = 0x40, - HT_LINE = 0x20, ///< used for autorail highlighting (longer streches) - ///< (uses lower bits to indicate direction) - HT_RAIL = 0x10, ///< autorail (one piece) - ///< (uses lower bits to indicate direction) - HT_DRAG_MASK = 0xF0, ///< masks the drag-type + HT_NONE = 0x00, ///< default + HT_RECT = 0x10, ///< rectangle (stations, depots, ...) + HT_POINT = 0x20, ///< point (lower land, raise land, level land, ...) + HT_SPECIAL = 0x30, ///< special mode used for highlighting while dragging (and for tunnels/docks) + HT_DRAG = 0x40, ///< dragging items in the depot windows + HT_LINE = 0x08, ///< used for autorail highlighting (longer streches), lower bits: direction + HT_RAIL = 0x80, ///< autorail (one piece), lower bits: direction + HT_DRAG_MASK = 0xF8, ///< masks the drag-type /* lower bits (used with HT_LINE and HT_RAIL): * (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 next_drawstyle; // queued, but not yet drawn style - ViewportHighlightMode place_mode; + HighLightStyle place_mode; bool make_square_red; WindowClass window_class; WindowNumber window_number; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 43c0b4a9e..83dc15522 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -238,7 +238,7 @@ static void SelectSignTool() if (_cursor.sprite == SPR_CURSOR_SIGN) { ResetObjectToPlace(); } 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; } } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 5d2f1f4ec..89c98d72e 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -884,7 +884,7 @@ public: { switch (widget) { 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; case TSEW_RANDOMTOWN: { diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index 971961049..b317cecd9 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -102,13 +102,13 @@ public: 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, VHM_RECT, NULL)) { + if (HandlePlacePushButton(this, widget, SPR_CURSOR_TREE, HT_RECT, NULL)) { this->tree_to_plant = this->base + widget - BTW_TYPE_11; } break; 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; } break; diff --git a/src/viewport.cpp b/src/viewport.cpp index 87a417c1d..0feca0c8d 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2060,7 +2060,7 @@ void PlaceObject() pt = GetTileBelowCursor(); if (pt.x == -1) return; - if (_thd.place_mode == VHM_POINT) { + if (_thd.place_mode == HT_POINT) { pt.x += 8; pt.y += 8; } @@ -2149,7 +2149,7 @@ void UpdateTileSelection() _thd.new_drawstyle = HT_NONE; - if (_thd.place_mode == VHM_SPECIAL) { + if (_thd.place_mode == HT_SPECIAL) { x1 = _thd.selend.x; y1 = _thd.selend.y; if (x1 != -1) { @@ -2166,21 +2166,21 @@ void UpdateTileSelection() _thd.new_size.y = y2 - y1 + TILE_SIZE; _thd.new_drawstyle = _thd.next_drawstyle; } - } else if (_thd.place_mode != VHM_NONE) { + } else if (_thd.place_mode != HT_NONE) { Point pt = GetTileBelowCursor(); x1 = pt.x; y1 = pt.y; if (x1 != -1) { switch (_thd.place_mode) { - case VHM_RECT: + case HT_RECT: _thd.new_drawstyle = HT_RECT; break; - case VHM_POINT: + case HT_POINT: _thd.new_drawstyle = HT_POINT; x1 += TILE_SIZE / 2; y1 += TILE_SIZE / 2; break; - case VHM_RAIL: + case HT_RAIL: _thd.new_drawstyle = GetAutorailHT(pt.x, pt.y); // draw one highlighted tile break; default: @@ -2243,14 +2243,14 @@ void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDrag _thd.selstart.y += TILE_SIZE / 2; } - if (_thd.place_mode == VHM_RECT) { - _thd.place_mode = VHM_SPECIAL; + if (_thd.place_mode == HT_RECT) { + _thd.place_mode = HT_SPECIAL; _thd.next_drawstyle = HT_RECT; - } else if (_thd.place_mode == VHM_RAIL) { // autorail one piece - _thd.place_mode = VHM_SPECIAL; + } else if (_thd.place_mode == HT_RAIL) { // autorail one piece + _thd.place_mode = HT_SPECIAL; _thd.next_drawstyle = _thd.drawstyle; } else { - _thd.place_mode = VHM_SPECIAL; + _thd.place_mode = HT_SPECIAL; _thd.next_drawstyle = HT_POINT; } _special_mouse_mode = WSM_SIZING; @@ -2709,15 +2709,15 @@ bool VpHandlePlaceSizingDrag() * keep the selected tool, but reset it to the original mode. */ _special_mouse_mode = WSM_NONE; 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 - _thd.place_mode = VHM_RECT; + _thd.place_mode = HT_RECT; } else if (_thd.next_drawstyle & HT_LINE) { - _thd.place_mode = VHM_RAIL; + _thd.place_mode = HT_RAIL; } else if (_thd.next_drawstyle & HT_RAIL) { - _thd.place_mode = VHM_RAIL; + _thd.place_mode = HT_RAIL; } else { - _thd.place_mode = VHM_POINT; + _thd.place_mode = HT_POINT; } SetTileSelectSize(1, 1); @@ -2726,17 +2726,17 @@ bool VpHandlePlaceSizingDrag() 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); } #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 */ - 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); if (w != NULL) { /* 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; - if (mode == VHM_DRAG) { // VHM_DRAG is for dragdropping trains in the depot window - mode = VHM_NONE; + if (mode == HT_DRAG) { // HT_DRAG is for dragdropping trains in the depot window + mode = HT_NONE; _special_mouse_mode = WSM_DRAGDROP; } else { _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_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(); if ((int)icon < 0) { @@ -2777,5 +2777,5 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, W 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); } diff --git a/src/window.cpp b/src/window.cpp index a35eb28f4..22cae5e84 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -577,7 +577,7 @@ void Window::DeleteChildWindows() const */ Window::~Window() { - if (_thd.place_mode != VHM_NONE && + if (_thd.place_mode != HT_NONE && _thd.window_class == this->window_class && _thd.window_number == this->window_number) { ResetObjectToPlace(); @@ -1994,7 +1994,7 @@ void MouseLoop(MouseClick click, int mousewheel) case MC_DOUBLE_LEFT: case MC_LEFT: 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 */ _cursor.sprite != SPR_CURSOR_QUERY && _cursor.sprite != SPR_CURSOR_SIGN && @@ -2003,7 +2003,7 @@ void MouseLoop(MouseClick click, int mousewheel) return; } - if (_thd.place_mode == VHM_NONE) { + if (_thd.place_mode == HT_NONE) { if (!HandleViewportClicked(vp, x, y) && !(w->flags4 & WF_DISABLE_VP_SCROLL) && _settings_client.gui.left_mouse_btn_scrolling) { |