summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-15 18:28:00 +0000
committerrubidium <rubidium@openttd.org>2007-11-15 18:28:00 +0000
commitecdb16de42874125991b1e770616e46e9c4d24bb (patch)
tree4bd44853b9e7e9c29ae281bd657c1996f6290daa
parentc5a9fd4559bd6858f4f11820e5e994cca1afa2a5 (diff)
downloadopenttd-ecdb16de42874125991b1e770616e46e9c4d24bb.tar.xz
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
-rw-r--r--src/airport_gui.cpp4
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/dock_gui.cpp12
-rw-r--r--src/functions.h5
-rw-r--r--src/genworld.cpp3
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/main_gui.cpp22
-rw-r--r--src/misc.cpp3
-rw-r--r--src/misc_gui.cpp8
-rw-r--r--src/order_gui.cpp4
-rw-r--r--src/player_gui.cpp4
-rw-r--r--src/rail_gui.cpp22
-rw-r--r--src/terraform_gui.cpp12
-rw-r--r--src/viewport.cpp8
-rw-r--r--src/viewport.h4
16 files changed, 60 insertions, 57 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 814916c0d..9c60950d0 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -51,12 +51,12 @@ enum {
static void BuildAirClick_Airport(Window *w)
{
- if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, 1, PlaceAirport)) ShowBuildAirportPicker();
+ if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, VHM_RECT, PlaceAirport)) ShowBuildAirportPicker();
}
static void BuildAirClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, 1, PlaceAir_DemolishArea);
+ HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceAir_DemolishArea);
}
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index fb676b5b9..1598186a9 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -436,7 +436,7 @@ static void DepotClick(Window *w, int x, int y)
WP(w, depot_d).sel = v->index;
SetWindowDirty(w);
- SetObjectToPlaceWnd(image, GetVehiclePalette(v), 4, w);
+ SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w);
}
}
break;
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index b030438c8..5fbdc47b0 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -79,35 +79,35 @@ enum {
static void BuildDocksClick_Canal(Window *w)
{
- HandlePlacePushButton(w, DTW_CANAL, SPR_CURSOR_CANAL, 1, PlaceDocks_BuildCanal);
+ HandlePlacePushButton(w, DTW_CANAL, SPR_CURSOR_CANAL, VHM_RECT, PlaceDocks_BuildCanal);
}
static void BuildDocksClick_Lock(Window *w)
{
- HandlePlacePushButton(w, DTW_LOCK, SPR_CURSOR_LOCK, 1, PlaceDocks_BuildLock);
+ HandlePlacePushButton(w, DTW_LOCK, SPR_CURSOR_LOCK, VHM_RECT, PlaceDocks_BuildLock);
}
static void BuildDocksClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, 1, PlaceDocks_DemolishArea);
+ HandlePlacePushButton(w, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceDocks_DemolishArea);
}
static void BuildDocksClick_Depot(Window *w)
{
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
- if (HandlePlacePushButton(w, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
+ if (HandlePlacePushButton(w, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, VHM_RECT, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
}
static void BuildDocksClick_Dock(Window *w)
{
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
- if (HandlePlacePushButton(w, DTW_STATION, SPR_CURSOR_DOCK, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
+ if (HandlePlacePushButton(w, DTW_STATION, SPR_CURSOR_DOCK, VHM_SPECIAL, PlaceDocks_Dock)) ShowBuildDockStationPicker();
}
static void BuildDocksClick_Buoy(Window *w)
{
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
- HandlePlacePushButton(w, DTW_BUOY, SPR_CURSOR_BOUY, 1, PlaceDocks_Buoy);
+ HandlePlacePushButton(w, DTW_BUOY, SPR_CURSOR_BOUY, VHM_RECT, PlaceDocks_Buoy);
}
diff --git a/src/functions.h b/src/functions.h
index 4ba233d4d..ec680e7e8 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -6,6 +6,7 @@
#define FUNCTIONS_H
#include "gfx.h"
+#include "viewport.h"
void UpdateTownMaxPass(Town *t);
@@ -123,8 +124,8 @@ void InvalidateWindowClassesData(WindowClass cls);
void DeleteWindowById(WindowClass cls, WindowNumber number);
void DeleteWindowByClass(WindowClass cls);
-void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, byte mode, Window *w);
-void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window_class, WindowNumber window_num);
+void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
+void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
void ResetObjectToPlace();
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 9d1d92cd9..46dce7dd7 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -20,6 +20,7 @@
#include "settings.h"
#include "heightmap.h"
#include "date.h"
+#include "viewport.h"
void GenerateClearTile();
void GenerateIndustries();
@@ -85,7 +86,7 @@ static void *_GenerateWorld(void *arg)
if (_patches.generation_seed == GENERATE_NEW_SEED) _patches.generation_seed = _patches_newgame.generation_seed = InteractiveRandom();
_random_seeds[0][0] = _random_seeds[0][1] = _patches.generation_seed;
SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
- SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
+ SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_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 c0fccca01..efcb0eb63 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -554,7 +554,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
gv->vehicle_sel = v->index;
if (v->IsValid()) {
- SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), 4, w);
+ SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), VHM_DRAG, w);
}
SetWindowDirty(w);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index c2b73e815..2e2185cf6 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -270,7 +270,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
DoCommandP(0, WP(w, fnd_d).select, 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
HandleButtonClick(w, DYNA_INDU_FUND_WIDGET);
} else {
- HandlePlacePushButton(w, DYNA_INDU_FUND_WIDGET, SPR_CURSOR_INDUSTRY, 1, NULL);
+ HandlePlacePushButton(w, DYNA_INDU_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL);
}
} break;
}
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 258ee09f6..aea2f1e7a 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -119,7 +119,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, int mode, PlaceProc *placeproc)
+bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc)
{
if (IsWindowWidgetDisabled(w, widget)) return false;
@@ -352,7 +352,7 @@ static void SelectSignTool()
if (_cursor.sprite == SPR_CURSOR_SIGN) {
ResetObjectToPlace();
} else {
- SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0);
+ SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0);
_place_proc = PlaceProc_Sign;
}
}
@@ -1197,42 +1197,42 @@ static const int8 _multi_terraform_coords[][2] = {
*/
static void EditorTerraformClick_Dynamite(Window *w)
{
- HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
+ HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea);
}
static void EditorTerraformClick_LowerBigLand(Window *w)
{
- HandlePlacePushButton(w, 5, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerBigLand);
+ HandlePlacePushButton(w, 5, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerBigLand);
}
static void EditorTerraformClick_RaiseBigLand(Window *w)
{
- HandlePlacePushButton(w, 6, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseBigLand);
+ HandlePlacePushButton(w, 6, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseBigLand);
}
static void EditorTerraformClick_LevelLand(Window *w)
{
- HandlePlacePushButton(w, 7, SPR_CURSOR_LEVEL_LAND, 2, PlaceProc_LevelLand);
+ HandlePlacePushButton(w, 7, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand);
}
static void EditorTerraformClick_WaterArea(Window *w)
{
- HandlePlacePushButton(w, 8, SPR_CURSOR_CANAL, 1, PlaceProc_WaterArea);
+ HandlePlacePushButton(w, 8, SPR_CURSOR_CANAL, VHM_RECT, PlaceProc_WaterArea);
}
static void EditorTerraformClick_RockyArea(Window *w)
{
- HandlePlacePushButton(w, 9, SPR_CURSOR_ROCKY_AREA, 1, PlaceProc_RockyArea);
+ HandlePlacePushButton(w, 9, SPR_CURSOR_ROCKY_AREA, VHM_RECT, PlaceProc_RockyArea);
}
static void EditorTerraformClick_DesertLightHouse(Window *w)
{
- HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, 1, (_opt.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
+ HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, VHM_RECT, (_opt.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
}
static void EditorTerraformClick_Transmitter(Window *w)
{
- HandlePlacePushButton(w, 11, SPR_CURSOR_TRANSMITTER, 1, PlaceProc_Transmitter);
+ HandlePlacePushButton(w, 11, SPR_CURSOR_TRANSMITTER, VHM_RECT, PlaceProc_Transmitter);
}
static const uint16 _editor_terraform_keycodes[] = {
@@ -1462,7 +1462,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
case 4: // new town
- HandlePlacePushButton(w, 4, SPR_CURSOR_TOWN, 1, PlaceProc_Town);
+ HandlePlacePushButton(w, 4, SPR_CURSOR_TOWN, VHM_RECT, PlaceProc_Town);
break;
case 5: {// random town
Town *t;
diff --git a/src/misc.cpp b/src/misc.cpp
index 8a1c2975e..10fd76ecf 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -23,6 +23,7 @@
#include "date.h"
#include "cargotype.h"
#include "group.h"
+#include "viewport.h"
char _name_array[512][32];
@@ -105,7 +106,7 @@ void InitializeGame(int mode, uint size_x, uint size_y)
AddTypeToEngines(); // make sure all engines have a type
- SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
+ SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
_pause_game = 0;
_fast_forward = 0;
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 94e46d54b..4eff74cbf 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -199,7 +199,7 @@ void PlaceLandBlockInfo()
ResetObjectToPlace();
} else {
_place_proc = Place_LandInfo;
- SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0);
+ SetObjectToPlace(SPR_CURSOR_QUERY, PAL_NONE, VHM_RECT, WC_MAIN_TOOLBAR, 0);
}
}
@@ -366,12 +366,12 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e)
case 11:case 12: case 13: case 14:
if (wid - 3 >= WP(w,tree_d).count) break;
- if (HandlePlacePushButton(w, wid, SPR_CURSOR_TREE, 1, NULL))
+ if (HandlePlacePushButton(w, wid, SPR_CURSOR_TREE, VHM_RECT, NULL))
_tree_to_plant = WP(w,tree_d).base + wid - 3;
break;
case 15: // tree of random type.
- if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, 1, NULL))
+ if (HandlePlacePushButton(w, 15, SPR_CURSOR_TREE, VHM_RECT, NULL))
_tree_to_plant = -1;
break;
@@ -1675,7 +1675,7 @@ void ShowSaveLoadDialog(int mode)
const WindowDesc *sld = &_save_dialog_desc;
- SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
+ SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
DeleteWindowById(WC_QUERY_STRING, 0);
DeleteWindowById(WC_SAVELOAD, 0);
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 27ea5646e..22e90cb3c 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -401,7 +401,7 @@ static void OrderClick_Goto(Window *w, const Vehicle *v)
ToggleWidgetLoweredState(w, ORDER_WIDGET_GOTO);
if (IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) {
_place_clicked_vehicle = NULL;
- SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, 1, w);
+ SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w);
} else {
ResetObjectToPlace();
}
@@ -591,7 +591,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
if (v->owner == _local_player) {
/* Activate drag and drop */
- SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, 4, w);
+ SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, w);
}
}
}
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index e71d25b0b..a4ae1c245 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -1159,7 +1159,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
if (tile == 0) {
if ((byte)w->window_number != _local_player)
return;
- SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, 1, w);
+ SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, w);
SetTileSelectSize(2, 2);
LowerWindowWidget(w, PCW_WIDGET_BUILD_VIEW_HQ);
InvalidateWidget(w, PCW_WIDGET_BUILD_VIEW_HQ);
@@ -1170,7 +1170,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
}
case PCW_WIDGET_RELOCATE_HQ:
- SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, 1, w);
+ SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, w);
SetTileSelectSize(2, 2);
LowerWindowWidget(w, PCW_WIDGET_RELOCATE_HQ);
InvalidateWidget(w, PCW_WIDGET_RELOCATE_HQ);
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 5abf18d39..1b107bb3b 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -258,22 +258,22 @@ enum RailToolbarWidgets {
static void BuildRailClick_N(Window *w)
{
- HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, 1, PlaceRail_N);
+ HandlePlacePushButton(w, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, VHM_RECT, PlaceRail_N);
}
static void BuildRailClick_NE(Window *w)
{
- HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, 1, PlaceRail_NE);
+ HandlePlacePushButton(w, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, VHM_RECT, PlaceRail_NE);
}
static void BuildRailClick_E(Window *w)
{
- HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, 1, PlaceRail_E);
+ HandlePlacePushButton(w, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, VHM_RECT, PlaceRail_E);
}
static void BuildRailClick_NW(Window *w)
{
- HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, 1, PlaceRail_NW);
+ HandlePlacePushButton(w, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, VHM_RECT, PlaceRail_NW);
}
static void BuildRailClick_AutoRail(Window *w)
@@ -283,12 +283,12 @@ static void BuildRailClick_AutoRail(Window *w)
static void BuildRailClick_Demolish(Window *w)
{
- HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea);
+ HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea);
}
static void BuildRailClick_Depot(Window *w)
{
- if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, 1, PlaceRail_Depot)) {
+ if (HandlePlacePushButton(w, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, VHM_RECT, PlaceRail_Depot)) {
ShowBuildTrainDepotPicker();
}
}
@@ -296,7 +296,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, 1, PlaceRail_Waypoint) &&
+ if (HandlePlacePushButton(w, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, VHM_RECT, PlaceRail_Waypoint) &&
_waypoint_count > 1) {
ShowBuildWaypointPicker();
}
@@ -304,7 +304,7 @@ static void BuildRailClick_Waypoint(Window *w)
static void BuildRailClick_Station(Window *w)
{
- if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, 1, PlaceRail_Station)) ShowStationBuilder();
+ if (HandlePlacePushButton(w, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, VHM_RECT, PlaceRail_Station)) ShowStationBuilder();
}
static void BuildRailClick_AutoSignals(Window *w)
@@ -314,12 +314,12 @@ static void BuildRailClick_AutoSignals(Window *w)
static void BuildRailClick_Bridge(Window *w)
{
- HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, 1, PlaceRail_Bridge);
+ HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRail_Bridge);
}
static void BuildRailClick_Tunnel(Window *w)
{
- HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, 3, PlaceRail_Tunnel);
+ HandlePlacePushButton(w, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, VHM_SPECIAL, PlaceRail_Tunnel);
}
static void BuildRailClick_Remove(Window *w)
@@ -340,7 +340,7 @@ static void BuildRailClick_Remove(Window *w)
static void BuildRailClick_Convert(Window *w)
{
- HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, 1, PlaceRail_ConvertRail);
+ HandlePlacePushButton(w, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, VHM_RECT, PlaceRail_ConvertRail);
}
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index c2e0bb530..3b7840579 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -167,27 +167,27 @@ void PlaceProc_LevelLand(TileIndex tile)
static void TerraformClick_Lower(Window *w)
{
- HandlePlacePushButton(w, 4, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
+ HandlePlacePushButton(w, 4, ANIMCURSOR_LOWERLAND, VHM_POINT, PlaceProc_LowerLand);
}
static void TerraformClick_Raise(Window *w)
{
- HandlePlacePushButton(w, 5, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
+ HandlePlacePushButton(w, 5, ANIMCURSOR_RAISELAND, VHM_POINT, PlaceProc_RaiseLand);
}
static void TerraformClick_Level(Window *w)
{
- HandlePlacePushButton(w, 6, SPR_CURSOR_LEVEL_LAND, 2, PlaceProc_LevelLand);
+ HandlePlacePushButton(w, 6, SPR_CURSOR_LEVEL_LAND, VHM_POINT, PlaceProc_LevelLand);
}
static void TerraformClick_Dynamite(Window *w)
{
- HandlePlacePushButton(w, 7, ANIMCURSOR_DEMOLISH , 1, PlaceProc_DemolishArea);
+ HandlePlacePushButton(w, 7, ANIMCURSOR_DEMOLISH , VHM_RECT, PlaceProc_DemolishArea);
}
static void TerraformClick_BuyLand(Window *w)
{
- HandlePlacePushButton(w, 8, SPR_CURSOR_BUY_LAND, 1, PlaceProc_BuyLand);
+ HandlePlacePushButton(w, 8, SPR_CURSOR_BUY_LAND, VHM_RECT, PlaceProc_BuyLand);
}
static void TerraformClick_Trees(Window *w)
@@ -198,7 +198,7 @@ static void TerraformClick_Trees(Window *w)
static void TerraformClick_PlaceSign(Window *w)
{
- HandlePlacePushButton(w, 10, SPR_CURSOR_SIGN, 1, PlaceProc_Sign);
+ HandlePlacePushButton(w, 10, SPR_CURSOR_SIGN, VHM_RECT, PlaceProc_Sign);
}
static OnButtonClick * const _terraform_button_proc[] = {
diff --git a/src/viewport.cpp b/src/viewport.cpp
index c8247acf2..307b90598 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2799,14 +2799,14 @@ bool VpHandlePlaceSizingDrag()
return false;
}
-void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, byte mode, Window *w)
+void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w)
{
SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number);
}
#include "table/animcursors.h"
-void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window_class, WindowNumber window_num)
+void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num)
{
Window *w;
@@ -2821,8 +2821,8 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window
_thd.make_square_red = false;
- if (mode == VHM_DRAG) { // mode 4 is for dragdropping trains in the depot window
- mode = 0;
+ if (mode == VHM_DRAG) { // VHM_DRAG is for dragdropping trains in the depot window
+ mode = VHM_NONE;
_special_mouse_mode = WSM_DRAGDROP;
} else {
_special_mouse_mode = WSM_NONE;
diff --git a/src/viewport.h b/src/viewport.h
index ebc0e27d1..e436edae3 100644
--- a/src/viewport.h
+++ b/src/viewport.h
@@ -87,7 +87,7 @@ enum ViewportPlaceMethod {
};
/* viewport highlight mode (for highlighting tiles below cursor) */
-enum {
+enum ViewportHighlightMode {
VHM_NONE = 0, ///< default
VHM_RECT = 1, ///< rectangle (stations, depots, ...)
VHM_POINT = 2, ///< point (lower land, raise land, level land, ...)
@@ -156,7 +156,7 @@ struct TileHighlightData {
/* common button handler */
-bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc);
+bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
VARDEF Point _tile_fract_coords;