summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-04 10:22:27 +0000
committerrubidium <rubidium@openttd.org>2011-11-04 10:22:27 +0000
commit2ed0f93bfbd27ba4b4dc3e590556ffae6d9b9338 (patch)
tree9086d7e7b83871e60d43d838fd5f005ef50c5063 /src
parenta36551dbb4a6aa8a10e99df8331ac4ecb8586270 (diff)
downloadopenttd-2ed0f93bfbd27ba4b4dc3e590556ffae6d9b9338.tar.xz
(svn r23093) -Codechange: add a default NULL for the Z of GetTileSlope and use it
Diffstat (limited to 'src')
-rw-r--r--src/ai/api/ai_tile.cpp2
-rw-r--r--src/dock_gui.cpp4
-rw-r--r--src/elrail.cpp4
-rw-r--r--src/industry_cmd.cpp6
-rw-r--r--src/landscape.cpp6
-rw-r--r--src/newgrf_industrytiles.cpp2
-rw-r--r--src/newgrf_object.cpp2
-rw-r--r--src/newgrf_station.cpp6
-rw-r--r--src/object_cmd.cpp6
-rw-r--r--src/pathfinder/yapf/yapf_costbase.hpp4
-rw-r--r--src/rail_cmd.cpp10
-rw-r--r--src/road_cmd.cpp8
-rw-r--r--src/saveload/afterload.cpp8
-rw-r--r--src/station_cmd.cpp8
-rw-r--r--src/town_cmd.cpp18
-rw-r--r--src/tree_cmd.cpp4
-rw-r--r--src/water_cmd.cpp30
-rw-r--r--src/waypoint_cmd.cpp4
18 files changed, 66 insertions, 66 deletions
diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp
index 2c098e5ba..bda19775b 100644
--- 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)
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index dc0d9619d..31ee24338 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -212,7 +212,7 @@ struct BuildDocksToolbarWindow : Window {
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 @@ struct BuildDocksToolbarWindow : Window {
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));
diff --git a/src/elrail.cpp b/src/elrail.cpp
index b85cfcadb..eda206356 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -317,9 +317,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
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;
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index d60e3d6cb..d9e28eb7e 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1359,7 +1359,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
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 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
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 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, u
* - 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);
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 0f1e30a42..f70cbeda8 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -964,7 +964,7 @@ static bool FindSpring(TileIndex tile, void *user_data)
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 @@ static bool FlowRiver(bool *marks, TileIndex spring, TileIndex begin)
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 @@ static bool FlowRiver(bool *marks, TileIndex spring, TileIndex begin)
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. */
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 2a8577937..7ee7f9f89 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -295,7 +295,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind
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) {
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index a4807ea3e..436df1d85 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -289,7 +289,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt
}
/* 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;
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 13f996cc4..ed1a7b267 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -293,7 +293,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
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 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
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 @@ uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, con
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);
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index bd36e48c9..93d53898d 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -236,7 +236,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
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 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
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 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, uin
* - 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);
diff --git a/src/pathfinder/yapf/yapf_costbase.hpp b/src/pathfinder/yapf/yapf_costbase.hpp
index 6f6fed007..6e249e336 100644
--- a/src/pathfinder/yapf/yapf_costbase.hpp
+++ b/src/pathfinder/yapf/yapf_costbase.hpp
@@ -27,13 +27,13 @@ struct CYapfCostBase {
/* 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
}
}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 7ef04122e..185a83556 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -381,7 +381,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
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 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
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 FloodHalftile(TileIndex t)
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 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
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 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
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));
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 3cc2bb874..d1cb5fae1 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -254,7 +254,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
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 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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 @@ do_clear:;
/* 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 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
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)
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index c8cc0dd81..3d660db37 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -77,7 +77,7 @@ void SetWaterClassDependingOnSurroundings(TileIndex t, bool include_invalid_wate
{
/* 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 @@ bool AfterLoadGame()
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 @@ bool AfterLoadGame()
* 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 @@ bool AfterLoadGame()
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);
}
}
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index fb7607156..6a5e557e2 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2347,7 +2347,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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 @@ static void TileLoop_Station(TileIndex tile)
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:
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index e1c0f2cdc..4c7a6d348 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -787,7 +787,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
}
}
- 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 @@ static void LevelTownLand(TileIndex tile)
/* 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 @@ static RoadBits GetTownRoadGridElement(Town *t, TileIndex tile, DiagDirection di
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 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi
{
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 @@ static bool GrowTown(Town *t)
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 @@ static CommandCost TownCanBePlacedHere(TileIndex tile)
}
/* 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 @@ static bool FindFurthestFromWater(TileIndex tile, void *user_data)
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 void MakeTownHouse(TileIndex t, Town *town, byte counter, byte stage, Hou
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 CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags)
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;
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 4240c1eed..238f551c9 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -70,7 +70,7 @@ static bool CanPlantTreesOnTile(TileIndex tile, bool allow_desert)
{
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 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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;
}
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 4ee42554b..5cf793c1c 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -106,7 +106,7 @@ CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
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 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
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 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
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 @@ static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)
*/
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 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
}
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 @@ static bool IsWateredTile(TileIndex tile, Direction from)
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 @@ static bool IsWateredTile(TileIndex tile, Direction from)
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 @@ static bool IsWateredTile(TileIndex tile, Direction from)
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 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
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 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
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 @@ void DoFloodTile(TileIndex target)
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 @@ void ConvertGroundTilesIntoWaterTiles()
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 @@ static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode,
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;
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 51d192802..62b733bd0 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -124,7 +124,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID *
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 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
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);