changeset 18257:b6026cba5dae draft

(svn r23093) -Codechange: add a default NULL for the Z of GetTileSlope and use it
author rubidium <rubidium@openttd.org>
date Fri, 04 Nov 2011 10:22:27 +0000
parents 43d8a1ace139
children c27aabdb6433
files src/ai/api/ai_tile.cpp src/dock_gui.cpp src/elrail.cpp src/industry_cmd.cpp src/landscape.cpp src/newgrf_industrytiles.cpp src/newgrf_object.cpp src/newgrf_station.cpp src/object_cmd.cpp src/pathfinder/yapf/yapf_costbase.hpp src/rail_cmd.cpp src/road_cmd.cpp src/saveload/afterload.cpp src/station_cmd.cpp src/town_cmd.cpp src/tree_cmd.cpp src/water_cmd.cpp src/waypoint_cmd.cpp
diffstat 18 files changed, 66 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/api/ai_tile.cpp
+++ b/src/ai/api/ai_tile.cpp
@@ -142,7 +142,7 @@
 {
 	if (!::IsValidTile(tile)) return SLOPE_INVALID;
 
-	return (Slope)::GetTilePixelSlope(tile, NULL);
+	return (Slope)::GetTileSlope(tile);
 }
 
 /* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -212,7 +212,7 @@
 				CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" };
 
 				/* Determine the watery part of the dock. */
-				DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile, NULL));
+				DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
 				TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
 
 				ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to));
@@ -276,7 +276,7 @@
 		if (this->last_clicked_widget == DTW_BUILD_AQUEDUCT) {
 			GetOtherAqueductEnd(tile_from, &tile_to);
 		} else {
-			DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile_from, NULL));
+			DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from));
 			if (IsValidDiagDirection(dir)) {
 				/* Locks and docks always select the tile "down" the slope. */
 				tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -317,9 +317,9 @@
 		TileIndex neighbour = ti->tile + TileOffsByDiagDir(i);
 		byte elevation = GetPCPElevation(ti->tile, i);
 
-		/* Here's one of the main headaches. GetTilePixelSlope does not correct for possibly
+		/* Here's one of the main headaches. GetTileSlope does not correct for possibly
 		 * existing foundataions, so we do have to do that manually later on.*/
-		tileh[TS_NEIGHBOUR] = GetTilePixelSlope(neighbour, NULL);
+		tileh[TS_NEIGHBOUR] = GetTileSlope(neighbour);
 		trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, NULL);
 		wireconfig[TS_NEIGHBOUR] = MaskWireBits(neighbour, trackconfig[TS_NEIGHBOUR]);
 		if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1359,7 +1359,7 @@
 
 		if (gfx == GFX_WATERTILE_SPECIALCHECK) {
 			if (!IsTileType(cur_tile, MP_WATER) ||
-					GetTilePixelSlope(cur_tile, NULL) != SLOPE_FLAT) {
+					GetTileSlope(cur_tile) != SLOPE_FLAT) {
 				return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 			}
 		} else {
@@ -1379,7 +1379,7 @@
 				CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits, founder, creation_type);
 				if (ret.Failed()) return ret;
 			} else {
-				Slope tileh = GetTilePixelSlope(cur_tile, NULL);
+				Slope tileh = GetTileSlope(cur_tile);
 				refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
 			}
 
@@ -2724,7 +2724,7 @@
 		 *  - Allow autoslope by default.
 		 *  - Disallow autoslope if callback succeeds and returns non-zero.
 		 */
-		Slope tileh_old = GetTilePixelSlope(tile, NULL);
+		Slope tileh_old = GetTileSlope(tile);
 		/* TileMaxZ must not be changed. Slopes must not be steep. */
 		if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) {
 			const IndustryGfx gfx = GetIndustryGfx(tile);
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -964,7 +964,7 @@
 static bool MakeLake(TileIndex tile, void *user_data)
 {
 	uint height = *(uint*)user_data;
-	if (!IsValidTile(tile) || TileHeight(tile) != height || GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) return false;
+	if (!IsValidTile(tile) || TileHeight(tile) != height || GetTileSlope(tile) != SLOPE_FLAT) return false;
 	if (_settings_game.game_creation.landscape == LT_TROPIC && GetTropicZone(tile) == TROPICZONE_DESERT) return false;
 
 	for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) {
@@ -1113,7 +1113,7 @@
 		queue.pop_front();
 
 		uint height2 = TileHeight(end);
-		if (GetTilePixelSlope(end, NULL) == SLOPE_FLAT && (height2 < height || (height2 == height && IsWaterTile(end)))) {
+		if (GetTileSlope(end) == SLOPE_FLAT && (height2 < height || (height2 == height && IsWaterTile(end)))) {
 			found = true;
 			break;
 		}
@@ -1140,7 +1140,7 @@
 
 		if (IsValidTile(lakeCenter) &&
 				/* A river, or lake, can only be built on flat slopes. */
-				GetTilePixelSlope(lakeCenter, NULL) == SLOPE_FLAT &&
+				GetTileSlope(lakeCenter) == SLOPE_FLAT &&
 				/* We want the lake to be built at the height of the river. */
 				TileHeight(begin) == TileHeight(lakeCenter) &&
 				/* We don't want the lake at the entry of the valley. */
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -295,7 +295,7 @@
 
 	uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | itspec_index, gfx, &ind, ind_tile);
 	if (callback_res == CALLBACK_FAILED) {
-		if (!IsSlopeRefused(GetTilePixelSlope(ind_tile, NULL), its->slopes_refused)) return CommandCost();
+		if (!IsSlopeRefused(GetTileSlope(ind_tile), its->slopes_refused)) return CommandCost();
 		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	}
 	if (its->grf_prop.grffile->grf_version < 7) {
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -289,7 +289,7 @@
 		}
 
 		/* Tile information. */
-		case 0x41: return GetTilePixelSlope(tile, NULL) << 8 | GetTerrainType(tile);
+		case 0x41: return GetTileSlope(tile) << 8 | GetTerrainType(tile);
 
 		/* Construction date */
 		case 0x42: return o->build_date;
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -293,7 +293,7 @@
 				if (object->u.station.axis != INVALID_AXIS && tile != INVALID_TILE) {
 					if (parameter != 0) tile = GetNearbyTile(parameter, tile, true, object->u.station.axis); // only perform if it is required
 
-					Slope tileh = GetTilePixelSlope(tile, NULL);
+					Slope tileh = GetTileSlope(tile);
 					bool swap = (object->u.station.axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E));
 
 					return GetNearbyTileInformation(tile) ^ (swap ? SLOPE_EW : 0);
@@ -350,7 +350,7 @@
 
 			if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
 
-			Slope tileh = GetTilePixelSlope(tile, NULL);
+			Slope tileh = GetTileSlope(tile);
 			bool swap = (axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E));
 
 			return GetNearbyTileInformation(tile) ^ (swap ? SLOPE_EW : 0);
@@ -678,7 +678,7 @@
 CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks)
 {
 	TileIndexDiff diff = cur_tile - north_tile;
-	Slope slope = GetTilePixelSlope(cur_tile, NULL);
+	Slope slope = GetTileSlope(cur_tile);
 
 	ResolverObject object;
 	NewStationResolver(&object, statspec, NULL, cur_tile);
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -236,7 +236,7 @@
 			uint16 callback = CALLBACK_FAILED;
 			if (HasBit(spec->callback_mask, CBM_OBJ_SLOPE_CHECK)) {
 				TileIndex diff = t - tile;
-				callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTilePixelSlope(t, NULL), TileY(diff) << 4 | TileX(diff), spec, NULL, t, view);
+				callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTileSlope(t), TileY(diff) << 4 | TileX(diff), spec, NULL, t, view);
 			}
 
 			if (callback == CALLBACK_FAILED) {
@@ -276,7 +276,7 @@
 	switch (type) {
 		case OBJECT_TRANSMITTER:
 		case OBJECT_LIGHTHOUSE:
-			if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
+			if (GetTileSlope(tile) != SLOPE_FLAT) return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
 			break;
 
 		case OBJECT_OWNED_LAND:
@@ -731,7 +731,7 @@
 		 *  - Allow autoslope by default.
 		 *  - Disallow autoslope if callback succeeds and returns non-zero.
 		 */
-		Slope tileh_old = GetTilePixelSlope(tile, NULL);
+		Slope tileh_old = GetTileSlope(tile);
 		/* TileMaxZ must not be changed. Slopes must not be steep. */
 		if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) {
 			const ObjectSpec *spec = ObjectSpec::Get(type);
--- a/src/pathfinder/yapf/yapf_costbase.hpp
+++ b/src/pathfinder/yapf/yapf_costbase.hpp
@@ -27,13 +27,13 @@
 				/* it is bridge ramp, check if we are entering the bridge */
 				if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are leaving it, no penalty
 				/* we are entering the bridge */
-				Slope tile_slope = GetTilePixelSlope(tile, NULL);
+				Slope tile_slope = GetTileSlope(tile);
 				Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
 				return !HasBridgeFlatRamp(tile_slope, axis);
 			} else {
 				/* not bridge ramp */
 				if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope
-				Slope tile_slope = GetTilePixelSlope(tile, NULL);
+				Slope tile_slope = GetTileSlope(tile);
 				return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty
 			}
 		}
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -381,7 +381,7 @@
 
 	if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
 
-	Slope tileh = GetTilePixelSlope(tile, NULL);
+	Slope tileh = GetTileSlope(tile);
 	TrackBits trackbit = TrackToTrackBits(track);
 
 	switch (GetTileType(tile)) {
@@ -590,7 +590,7 @@
 				owner = GetTileOwner(tile);
 				present ^= trackbit;
 				if (present == 0) {
-					Slope tileh = GetTilePixelSlope(tile, NULL);
+					Slope tileh = GetTileSlope(tile);
 					/* If there is flat water on the lower halftile, convert the tile to shore so the water remains */
 					if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh)) {
 						MakeShore(tile);
@@ -649,7 +649,7 @@
 	bool flooded = false;
 	if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded;
 
-	Slope tileh = GetTilePixelSlope(t, NULL);
+	Slope tileh = GetTileSlope(t);
 	TrackBits rail_bits = GetTrackBits(t);
 
 	if (IsSlopeWithOneCornerRaised(tileh)) {
@@ -861,7 +861,7 @@
 	RailType railtype = Extract<RailType, 0, 4>(p1);
 	if (!ValParamRailtype(railtype)) return CMD_ERROR;
 
-	Slope tileh = GetTilePixelSlope(tile, NULL);
+	Slope tileh = GetTileSlope(tile);
 
 	DiagDirection dir = Extract<DiagDirection, 0, 2>(p2);
 
@@ -1637,7 +1637,7 @@
 	switch (GetRailTileType(tile)) {
 		case RAIL_TILE_SIGNALS:
 		case RAIL_TILE_NORMAL: {
-			Slope tileh = GetTilePixelSlope(tile, NULL);
+			Slope tileh = GetTileSlope(tile);
 			/* Is there flat water on the lower halftile that gets cleared expensively? */
 			bool water_ground = (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh));
 
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -254,7 +254,7 @@
 
 	switch (GetRoadTileType(tile)) {
 		case ROAD_TILE_NORMAL: {
-			Slope tileh = GetTilePixelSlope(tile, NULL);
+			Slope tileh = GetTileSlope(tile);
 
 			/* Steep slopes behave the same as slopes with one corner raised. */
 			if (IsSteepSlope(tileh)) {
@@ -467,7 +467,7 @@
 
 	DisallowedRoadDirections toggle_drd = Extract<DisallowedRoadDirections, 6, 2>(p1);
 
-	Slope tileh = GetTilePixelSlope(tile, NULL);
+	Slope tileh = GetTileSlope(tile);
 
 	bool need_to_clear = false;
 	switch (GetTileType(tile)) {
@@ -636,7 +636,7 @@
 
 			/* Check if new road bits will have the same foundation as other existing road types */
 			if (IsNormalRoad(tile)) {
-				Slope slope = GetTilePixelSlope(tile, NULL);
+				Slope slope = GetTileSlope(tile);
 				Foundation found_new = GetRoadFoundation(slope, pieces | existing);
 
 				/* Test if all other roadtypes can be built at that foundation */
@@ -909,7 +909,7 @@
 
 	if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
 
-	Slope tileh = GetTilePixelSlope(tile, NULL);
+	Slope tileh = GetTileSlope(tile);
 	if (tileh != SLOPE_FLAT && (
 				!_settings_game.construction.build_on_slopes ||
 				!CanBuildDepotByTileh(dir, tileh)
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -77,7 +77,7 @@
 {
 	/* If the slope is not flat, we always assume 'land' (if allowed). Also for one-corner-raised-shores.
 	 * Note: Wrt. autosloping under industry tiles this is the most fool-proof behaviour. */
-	if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) {
+	if (GetTileSlope(t) != SLOPE_FLAT) {
 		if (include_invalid_water_class) {
 			SetWaterClass(t, WATER_CLASS_INVALID);
 			return;
@@ -1060,7 +1060,7 @@
 						if (GB(_m[t].m5, 3, 2) == 0) {
 							MakeClear(t, CLEAR_GRASS, 3);
 						} else {
-							if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) {
+							if (GetTileSlope(t) != SLOPE_FLAT) {
 								MakeShore(t);
 							} else {
 								if (GetTileOwner(t) == OWNER_WATER) {
@@ -1670,7 +1670,7 @@
 		 * on its neighbouring tiles. Done after river and canal updates to
 		 * ensure neighbours are correct. */
 		for (TileIndex t = 0; t < map_size; t++) {
-			if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) continue;
+			if (GetTileSlope(t) != SLOPE_FLAT) continue;
 
 			if (IsTileType(t, MP_WATER) && IsLock(t)) SetWaterClassDependingOnSurroundings(t, false);
 			if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t, false);
@@ -2355,7 +2355,7 @@
 	if (IsSavegameVersionBefore(149)) {
 		for (TileIndex t = 0; t < map_size; t++) {
 			if (!IsTileType(t, MP_STATION)) continue;
-			if (!IsBuoy(t) && !IsOilRig(t) && !(IsDock(t) && GetTilePixelSlope(t, NULL) == SLOPE_FLAT)) {
+			if (!IsBuoy(t) && !IsOilRig(t) && !(IsDock(t) && GetTileSlope(t) == SLOPE_FLAT)) {
 				SetWaterClass(t, WATER_CLASS_INVALID);
 			}
 		}
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2347,7 +2347,7 @@
 
 	if (distant_join && (!_settings_game.station.distant_join_stations || !Station::IsValidID(station_to_join))) return CMD_ERROR;
 
-	DiagDirection direction = GetInclinedSlopeDirection(GetTilePixelSlope(tile, NULL));
+	DiagDirection direction = GetInclinedSlopeDirection(GetTileSlope(tile));
 	if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	direction = ReverseDiagDir(direction);
 
@@ -2364,7 +2364,7 @@
 
 	TileIndex tile_cur = tile + TileOffsByDiagDir(direction);
 
-	if (!IsTileType(tile_cur, MP_WATER) || GetTilePixelSlope(tile_cur, NULL) != SLOPE_FLAT) {
+	if (!IsTileType(tile_cur, MP_WATER) || GetTileSlope(tile_cur) != SLOPE_FLAT) {
 		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	}
 
@@ -2377,7 +2377,7 @@
 	if (ret.Failed()) return ret;
 
 	tile_cur += TileOffsByDiagDir(direction);
-	if (!IsTileType(tile_cur, MP_WATER) || GetTilePixelSlope(tile_cur, NULL) != SLOPE_FLAT) {
+	if (!IsTileType(tile_cur, MP_WATER) || GetTileSlope(tile_cur) != SLOPE_FLAT) {
 		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	}
 
@@ -2898,7 +2898,7 @@
 			break;
 
 		case STATION_DOCK:
-			if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) break; // only handle water part
+			if (GetTileSlope(tile) != SLOPE_FLAT) break; // only handle water part
 			/* FALL THROUGH */
 		case STATION_OILRIG: //(station part)
 		case STATION_BUOY:
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -787,7 +787,7 @@
 		}
 	}
 
-	Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationPixelSlope(tile, NULL) : GetTilePixelSlope(tile, NULL);
+	Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationPixelSlope(tile, NULL) : GetTileSlope(tile);
 	bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
 	if (cur_slope == SLOPE_FLAT) return ret;
 
@@ -828,7 +828,7 @@
 
 	/* Don't terraform if land is plain or if there's a house there. */
 	if (IsTileType(tile, MP_HOUSE)) return;
-	Slope tileh = GetTilePixelSlope(tile, NULL);
+	Slope tileh = GetTileSlope(tile);
 	if (tileh == SLOPE_FLAT) return;
 
 	/* First try up, then down */
@@ -871,7 +871,7 @@
 
 	RoadBits rb_template;
 
-	switch (GetTilePixelSlope(tile, NULL)) {
+	switch (GetTileSlope(tile)) {
 		default:       rb_template = ROAD_ALL; break;
 		case SLOPE_W:  rb_template = ROAD_NW | ROAD_SW; break;
 		case SLOPE_SW: rb_template = ROAD_Y  | ROAD_SW; break;
@@ -970,7 +970,7 @@
 {
 	assert(bridge_dir < DIAGDIR_END);
 
-	const Slope slope = GetTilePixelSlope(tile, NULL);
+	const Slope slope = GetTileSlope(tile);
 
 	/* Make sure the direction is compatible with the slope.
 	 * Well we check if the slope has an up bit set in the
@@ -1337,7 +1337,7 @@
 		tile = t->xy;
 		for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
 			/* Only work with plain land that not already has a house */
-			if (!IsTileType(tile, MP_HOUSE) && GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) {
+			if (!IsTileType(tile, MP_HOUSE) && GetTileSlope(tile) == SLOPE_FLAT) {
 				if (DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR).Succeeded()) {
 					DoCommand(tile, GenRandomRoadBits(), t->index, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD);
 					cur_company.Restore();
@@ -1500,7 +1500,7 @@
 	}
 
 	/* Can only build on clear flat areas, possibly with trees. */
-	if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) {
+	if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || GetTileSlope(tile) != SLOPE_FLAT) {
 		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	}
 
@@ -1697,7 +1697,7 @@
 	uint dist = GetClosestWaterDistance(tile, true);
 
 	if (IsTileType(tile, MP_CLEAR) &&
-			GetTilePixelSlope(tile, NULL) == SLOPE_FLAT &&
+			GetTileSlope(tile) == SLOPE_FLAT &&
 			IsTileAlignedToGrid(tile, sp->layout) &&
 			dist > sp->max_dist) {
 		sp->tile = tile;
@@ -1907,7 +1907,7 @@
 static inline bool CanBuildHouseHere(TileIndex tile, TownID town, bool noslope)
 {
 	/* cannot build on these slopes... */
-	Slope slope = GetTilePixelSlope(tile, NULL);
+	Slope slope = GetTileSlope(tile);
 	if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false;
 
 	/* building under a bridge? */
@@ -2525,7 +2525,7 @@
 static bool SearchTileForStatue(TileIndex tile, void *user_data)
 {
 	/* Statues can be build on slopes, just like houses. Only the steep slopes is a no go. */
-	if (IsSteepSlope(GetTilePixelSlope(tile, NULL))) return false;
+	if (IsSteepSlope(GetTileSlope(tile))) return false;
 	/* Don't build statues under bridges. */
 	if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false;
 
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -70,7 +70,7 @@
 {
 	switch (GetTileType(tile)) {
 		case MP_WATER:
-			return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL));
+			return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTileSlope(tile));
 
 		case MP_CLEAR:
 			return !IsBridgeAbove(tile) && !IsClearGround(tile, CLEAR_FIELDS) && GetRawClearGround(tile) != CLEAR_ROCKS &&
@@ -363,7 +363,7 @@
 				break;
 
 			case MP_WATER:
-				if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL))) {
+				if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTileSlope(tile))) {
 					msg = STR_ERROR_CAN_T_BUILD_ON_WATER;
 					continue;
 				}
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -106,7 +106,7 @@
 	if ((MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) ||
 		(MayHaveBridgeAbove(tile2) && IsBridgeAbove(tile2))) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 
-	if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT || GetTilePixelSlope(tile2, NULL) != SLOPE_FLAT) {
+	if (GetTileSlope(tile) != SLOPE_FLAT || GetTileSlope(tile2) != SLOPE_FLAT) {
 		/* Prevent depots on rapids */
 		return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	}
@@ -220,7 +220,7 @@
 		cost.AddCost(ret);
 		cost.AddCost(_price[PR_BUILD_CANAL]);
 	}
-	if (GetTilePixelSlope(tile - delta, NULL) != SLOPE_FLAT) {
+	if (GetTileSlope(tile - delta) != SLOPE_FLAT) {
 		return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 	}
 
@@ -233,7 +233,7 @@
 		cost.AddCost(ret);
 		cost.AddCost(_price[PR_BUILD_CANAL]);
 	}
-	if (GetTilePixelSlope(tile + delta, NULL) != SLOPE_FLAT) {
+	if (GetTileSlope(tile + delta) != SLOPE_FLAT) {
 		return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 	}
 
@@ -299,7 +299,7 @@
  */
 CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 {
-	DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile, NULL));
+	DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
 	if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 
 	/* Disallow building of locks on river rapids */
@@ -341,7 +341,7 @@
 	TILE_AREA_LOOP(tile, ta) {
 		CommandCost ret;
 
-		Slope slope = GetTilePixelSlope(tile, NULL);
+		Slope slope = GetTileSlope(tile);
 		if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) {
 			return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
 		}
@@ -419,7 +419,7 @@
 		}
 
 		case WATER_TILE_COAST: {
-			Slope slope = GetTilePixelSlope(tile, NULL);
+			Slope slope = GetTileSlope(tile);
 
 			/* Make sure no vehicle is on the tile */
 			CommandCost ret = EnsureNoVehicleOnGround(tile);
@@ -477,7 +477,7 @@
 				case WATER_TILE_LOCK: return DiagDirToAxis(GetLockDirection(tile)) == DiagDirToAxis(DirToDiagDir(from));
 
 				case WATER_TILE_COAST:
-					switch (GetTilePixelSlope(tile, NULL)) {
+					switch (GetTileSlope(tile)) {
 						case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE);
 						case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
 						case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW);
@@ -489,7 +489,7 @@
 		case MP_RAILWAY:
 			if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
 				assert(IsPlainRail(tile));
-				switch (GetTilePixelSlope(tile, NULL)) {
+				switch (GetTileSlope(tile)) {
 					case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE);
 					case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
 					case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW);
@@ -509,7 +509,7 @@
 
 				return IsTileOnWater(tile);
 			}
-			return (IsDock(tile) && GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) || IsBuoy(tile);
+			return (IsDock(tile) && GetTileSlope(tile) == SLOPE_FLAT) || IsBuoy(tile);
 
 		case MP_INDUSTRY: {
 			/* Do not draw waterborders inside of industries.
@@ -931,7 +931,7 @@
 	switch (GetTileType(tile)) {
 		case MP_WATER:
 			if (IsCoast(tile)) {
-				Slope tileh = GetTilePixelSlope(tile, NULL);
+				Slope tileh = GetTileSlope(tile);
 				return (IsSlopeWithOneCornerRaised(tileh) ? FLOOD_ACTIVE : FLOOD_DRYUP);
 			}
 			/* FALL THROUGH */
@@ -942,7 +942,7 @@
 
 		case MP_RAILWAY:
 			if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
-				return (IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL)) ? FLOOD_ACTIVE : FLOOD_DRYUP);
+				return (IsSlopeWithOneCornerRaised(GetTileSlope(tile)) ? FLOOD_ACTIVE : FLOOD_DRYUP);
 			}
 			return FLOOD_NONE;
 
@@ -965,7 +965,7 @@
 
 	Backup<CompanyByte> cur_company(_current_company, OWNER_WATER, FILE_LINE);
 
-	Slope tileh = GetTilePixelSlope(target, NULL);
+	Slope tileh = GetTileSlope(target);
 	if (tileh != SLOPE_FLAT) {
 		/* make coast.. */
 		switch (GetTileType(target)) {
@@ -1133,7 +1133,7 @@
 					uint dir;
 					FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope & ~SLOPE_STEEP]) {
 						TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir));
-						Slope slope_dest = GetTilePixelSlope(dest, NULL) & ~SLOPE_STEEP;
+						Slope slope_dest = GetTileSlope(dest) & ~SLOPE_STEEP;
 						if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) {
 							MakeShore(tile);
 							break;
@@ -1154,8 +1154,8 @@
 	if (mode != TRANSPORT_WATER) return 0;
 
 	switch (GetWaterTileType(tile)) {
-		case WATER_TILE_CLEAR: ts = (GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break;
-		case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTilePixelSlope(tile, NULL) & 0xF]; break;
+		case WATER_TILE_CLEAR: ts = (GetTileSlope(tile) == SLOPE_FLAT) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break;
+		case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTileSlope(tile) & 0xF]; break;
 		case WATER_TILE_LOCK:  ts = DiagDirToDiagTrackBits(GetLockDirection(tile)); break;
 		case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break;
 		default: return 0;
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -124,7 +124,7 @@
 	if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile);
 	if (ret.Failed()) return ret;
 
-	Slope tileh = GetTilePixelSlope(tile, NULL);
+	Slope tileh = GetTileSlope(tile);
 	if (tileh != SLOPE_FLAT &&
 			(!_settings_game.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) {
 		return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
@@ -285,7 +285,7 @@
 	if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 	if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
 
-	if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
+	if (GetTileSlope(tile) != SLOPE_FLAT) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
 
 	/* Check if there is an already existing, deleted, waypoint close to us that we can reuse. */
 	Waypoint *wp = FindDeletedWaypointCloseTo(tile, STR_SV_STNAME_BUOY, OWNER_NONE);