(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
authorrubidium
Thu, 15 Nov 2007 18:28:00 +0000
changeset 7889 e74ce8853ba7
parent 7888 a28f4cfff934
child 7890 4209769a14d8
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
src/airport_gui.cpp
src/depot_gui.cpp
src/dock_gui.cpp
src/functions.h
src/genworld.cpp
src/group_gui.cpp
src/industry_gui.cpp
src/main_gui.cpp
src/misc.cpp
src/misc_gui.cpp
src/order_gui.cpp
src/player_gui.cpp
src/rail_gui.cpp
src/terraform_gui.cpp
src/viewport.cpp
src/viewport.h
--- a/src/airport_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/airport_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -51,12 +51,12 @@
 
 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);
 }
 
 
--- a/src/depot_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/depot_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -436,7 +436,7 @@
 
 				WP(w, depot_d).sel = v->index;
 				SetWindowDirty(w);
-				SetObjectToPlaceWnd(image, GetVehiclePalette(v), 4, w);
+				SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w);
 			}
 			}
 			break;
--- a/src/dock_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/dock_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -79,35 +79,35 @@
 
 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);
 }
 
 
--- a/src/functions.h	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/functions.h	Thu Nov 15 18:28:00 2007 +0000
@@ -6,6 +6,7 @@
 #define FUNCTIONS_H
 
 #include "gfx.h"
+#include "viewport.h"
 
 void UpdateTownMaxPass(Town *t);
 
@@ -123,8 +124,8 @@
 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();
 
--- a/src/genworld.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/genworld.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -20,6 +20,7 @@
 #include "settings.h"
 #include "heightmap.h"
 #include "date.h"
+#include "viewport.h"
 
 void GenerateClearTile();
 void GenerateIndustries();
@@ -85,7 +86,7 @@
 	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. */
--- a/src/group_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/group_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -554,7 +554,7 @@
 					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);
--- a/src/industry_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/industry_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -270,7 +270,7 @@
 						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;
 			}
--- a/src/main_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/main_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -119,7 +119,7 @@
  * @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 @@
 	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 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 @@
 	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;
--- a/src/misc.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/misc.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -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 @@
 
 	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;
--- a/src/misc_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/misc_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -199,7 +199,7 @@
 		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 @@
 		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 @@
 	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);
 
--- a/src/order_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/order_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -401,7 +401,7 @@
 	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 @@
 
 					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);
 					}
 				}
 			}
--- a/src/player_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/player_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -1159,7 +1159,7 @@
 					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 @@
 				}
 
 				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);
--- a/src/rail_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/rail_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -258,22 +258,22 @@
 
 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_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_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_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_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_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);
 }
 
 
--- a/src/terraform_gui.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/terraform_gui.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -167,27 +167,27 @@
 
 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_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[] = {
--- a/src/viewport.cpp	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/viewport.cpp	Thu Nov 15 18:28:00 2007 +0000
@@ -2799,14 +2799,14 @@
 	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 @@
 
 	_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;
--- a/src/viewport.h	Thu Nov 15 18:21:59 2007 +0000
+++ b/src/viewport.h	Thu Nov 15 18:28:00 2007 +0000
@@ -87,7 +87,7 @@
 };
 
 /* 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 @@
 
 
 /* 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;