(svn r23093) -Codechange: add a default NULL for the Z of GetTileSlope and use it

This commit is contained in:
rubidium 2011-11-04 10:22:27 +00:00
parent a36551dbb4
commit 2ed0f93bfb
18 changed files with 66 additions and 66 deletions

View File

@ -142,7 +142,7 @@
{ {
if (!::IsValidTile(tile)) return SLOPE_INVALID; if (!::IsValidTile(tile)) return SLOPE_INVALID;
return (Slope)::GetTilePixelSlope(tile, NULL); return (Slope)::GetTileSlope(tile);
} }
/* static */ AITile::Slope AITile::GetComplementSlope(Slope slope) /* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)

View File

@ -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, "" }; 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. */ /* 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); TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to)); ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to));
@ -276,7 +276,7 @@ struct BuildDocksToolbarWindow : Window {
if (this->last_clicked_widget == DTW_BUILD_AQUEDUCT) { if (this->last_clicked_widget == DTW_BUILD_AQUEDUCT) {
GetOtherAqueductEnd(tile_from, &tile_to); GetOtherAqueductEnd(tile_from, &tile_to);
} else { } else {
DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile_from, NULL)); DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from));
if (IsValidDiagDirection(dir)) { if (IsValidDiagDirection(dir)) {
/* Locks and docks always select the tile "down" the slope. */ /* Locks and docks always select the tile "down" the slope. */
tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir)); tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));

View File

@ -317,9 +317,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
TileIndex neighbour = ti->tile + TileOffsByDiagDir(i); TileIndex neighbour = ti->tile + TileOffsByDiagDir(i);
byte elevation = GetPCPElevation(ti->tile, 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.*/ * 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); trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, NULL);
wireconfig[TS_NEIGHBOUR] = MaskWireBits(neighbour, trackconfig[TS_NEIGHBOUR]); wireconfig[TS_NEIGHBOUR] = MaskWireBits(neighbour, trackconfig[TS_NEIGHBOUR]);
if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE; if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;

View File

@ -1359,7 +1359,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
if (gfx == GFX_WATERTILE_SPECIALCHECK) { if (gfx == GFX_WATERTILE_SPECIALCHECK) {
if (!IsTileType(cur_tile, MP_WATER) || if (!IsTileType(cur_tile, MP_WATER) ||
GetTilePixelSlope(cur_tile, NULL) != SLOPE_FLAT) { GetTileSlope(cur_tile) != SLOPE_FLAT) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE); return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
} }
} else { } 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); CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits, founder, creation_type);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
} else { } else {
Slope tileh = GetTilePixelSlope(cur_tile, NULL); Slope tileh = GetTileSlope(cur_tile);
refused_slope |= IsSlopeRefused(tileh, its->slopes_refused); refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
} }
@ -2724,7 +2724,7 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, u
* - Allow autoslope by default. * - Allow autoslope by default.
* - Disallow autoslope if callback succeeds and returns non-zero. * - 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. */ /* TileMaxZ must not be changed. Slopes must not be steep. */
if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) { if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) {
const IndustryGfx gfx = GetIndustryGfx(tile); const IndustryGfx gfx = GetIndustryGfx(tile);

View File

@ -964,7 +964,7 @@ static bool FindSpring(TileIndex tile, void *user_data)
static bool MakeLake(TileIndex tile, void *user_data) static bool MakeLake(TileIndex tile, void *user_data)
{ {
uint height = *(uint*)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; if (_settings_game.game_creation.landscape == LT_TROPIC && GetTropicZone(tile) == TROPICZONE_DESERT) return false;
for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { 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(); queue.pop_front();
uint height2 = TileHeight(end); 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; found = true;
break; break;
} }
@ -1140,7 +1140,7 @@ static bool FlowRiver(bool *marks, TileIndex spring, TileIndex begin)
if (IsValidTile(lakeCenter) && if (IsValidTile(lakeCenter) &&
/* A river, or lake, can only be built on flat slopes. */ /* 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. */ /* We want the lake to be built at the height of the river. */
TileHeight(begin) == TileHeight(lakeCenter) && TileHeight(begin) == TileHeight(lakeCenter) &&
/* We don't want the lake at the entry of the valley. */ /* We don't want the lake at the entry of the valley. */

View File

@ -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); uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | itspec_index, gfx, &ind, ind_tile);
if (callback_res == CALLBACK_FAILED) { 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); return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
} }
if (its->grf_prop.grffile->grf_version < 7) { if (its->grf_prop.grffile->grf_version < 7) {

View File

@ -289,7 +289,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt
} }
/* Tile information. */ /* Tile information. */
case 0x41: return GetTilePixelSlope(tile, NULL) << 8 | GetTerrainType(tile); case 0x41: return GetTileSlope(tile) << 8 | GetTerrainType(tile);
/* Construction date */ /* Construction date */
case 0x42: return o->build_date; case 0x42: return o->build_date;

View File

@ -293,7 +293,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
if (object->u.station.axis != INVALID_AXIS && tile != INVALID_TILE) { 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 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)); bool swap = (object->u.station.axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E));
return GetNearbyTileInformation(tile) ^ (swap ? SLOPE_EW : 0); 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 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)); bool swap = (axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E));
return GetNearbyTileInformation(tile) ^ (swap ? SLOPE_EW : 0); 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) CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks)
{ {
TileIndexDiff diff = cur_tile - north_tile; TileIndexDiff diff = cur_tile - north_tile;
Slope slope = GetTilePixelSlope(cur_tile, NULL); Slope slope = GetTileSlope(cur_tile);
ResolverObject object; ResolverObject object;
NewStationResolver(&object, statspec, NULL, cur_tile); NewStationResolver(&object, statspec, NULL, cur_tile);

View File

@ -236,7 +236,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
uint16 callback = CALLBACK_FAILED; uint16 callback = CALLBACK_FAILED;
if (HasBit(spec->callback_mask, CBM_OBJ_SLOPE_CHECK)) { if (HasBit(spec->callback_mask, CBM_OBJ_SLOPE_CHECK)) {
TileIndex diff = t - tile; 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) { if (callback == CALLBACK_FAILED) {
@ -276,7 +276,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
switch (type) { switch (type) {
case OBJECT_TRANSMITTER: case OBJECT_TRANSMITTER:
case OBJECT_LIGHTHOUSE: 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; break;
case OBJECT_OWNED_LAND: case OBJECT_OWNED_LAND:
@ -731,7 +731,7 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, uin
* - Allow autoslope by default. * - Allow autoslope by default.
* - Disallow autoslope if callback succeeds and returns non-zero. * - 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. */ /* TileMaxZ must not be changed. Slopes must not be steep. */
if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) { if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) {
const ObjectSpec *spec = ObjectSpec::Get(type); const ObjectSpec *spec = ObjectSpec::Get(type);

View File

@ -27,13 +27,13 @@ struct CYapfCostBase {
/* it is bridge ramp, check if we are entering the bridge */ /* 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 if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are leaving it, no penalty
/* we are entering the bridge */ /* we are entering the bridge */
Slope tile_slope = GetTilePixelSlope(tile, NULL); Slope tile_slope = GetTileSlope(tile);
Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile)); Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
return !HasBridgeFlatRamp(tile_slope, axis); return !HasBridgeFlatRamp(tile_slope, axis);
} else { } else {
/* not bridge ramp */ /* not bridge ramp */
if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope 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 return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty
} }
} }

View File

@ -381,7 +381,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR; if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
TrackBits trackbit = TrackToTrackBits(track); TrackBits trackbit = TrackToTrackBits(track);
switch (GetTileType(tile)) { switch (GetTileType(tile)) {
@ -590,7 +590,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
owner = GetTileOwner(tile); owner = GetTileOwner(tile);
present ^= trackbit; present ^= trackbit;
if (present == 0) { 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 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)) { if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh)) {
MakeShore(tile); MakeShore(tile);
@ -649,7 +649,7 @@ bool FloodHalftile(TileIndex t)
bool flooded = false; bool flooded = false;
if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded; if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded;
Slope tileh = GetTilePixelSlope(t, NULL); Slope tileh = GetTileSlope(t);
TrackBits rail_bits = GetTrackBits(t); TrackBits rail_bits = GetTrackBits(t);
if (IsSlopeWithOneCornerRaised(tileh)) { if (IsSlopeWithOneCornerRaised(tileh)) {
@ -861,7 +861,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
RailType railtype = Extract<RailType, 0, 4>(p1); RailType railtype = Extract<RailType, 0, 4>(p1);
if (!ValParamRailtype(railtype)) return CMD_ERROR; if (!ValParamRailtype(railtype)) return CMD_ERROR;
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
DiagDirection dir = Extract<DiagDirection, 0, 2>(p2); DiagDirection dir = Extract<DiagDirection, 0, 2>(p2);
@ -1637,7 +1637,7 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
switch (GetRailTileType(tile)) { switch (GetRailTileType(tile)) {
case RAIL_TILE_SIGNALS: case RAIL_TILE_SIGNALS:
case RAIL_TILE_NORMAL: { 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? */ /* Is there flat water on the lower halftile that gets cleared expensively? */
bool water_ground = (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh)); bool water_ground = (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh));

View File

@ -254,7 +254,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
switch (GetRoadTileType(tile)) { switch (GetRoadTileType(tile)) {
case ROAD_TILE_NORMAL: { case ROAD_TILE_NORMAL: {
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
/* Steep slopes behave the same as slopes with one corner raised. */ /* Steep slopes behave the same as slopes with one corner raised. */
if (IsSteepSlope(tileh)) { if (IsSteepSlope(tileh)) {
@ -467,7 +467,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
DisallowedRoadDirections toggle_drd = Extract<DisallowedRoadDirections, 6, 2>(p1); DisallowedRoadDirections toggle_drd = Extract<DisallowedRoadDirections, 6, 2>(p1);
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
bool need_to_clear = false; bool need_to_clear = false;
switch (GetTileType(tile)) { switch (GetTileType(tile)) {
@ -636,7 +636,7 @@ do_clear:;
/* Check if new road bits will have the same foundation as other existing road types */ /* Check if new road bits will have the same foundation as other existing road types */
if (IsNormalRoad(tile)) { if (IsNormalRoad(tile)) {
Slope slope = GetTilePixelSlope(tile, NULL); Slope slope = GetTileSlope(tile);
Foundation found_new = GetRoadFoundation(slope, pieces | existing); Foundation found_new = GetRoadFoundation(slope, pieces | existing);
/* Test if all other roadtypes can be built at that foundation */ /* 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; if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
if (tileh != SLOPE_FLAT && ( if (tileh != SLOPE_FLAT && (
!_settings_game.construction.build_on_slopes || !_settings_game.construction.build_on_slopes ||
!CanBuildDepotByTileh(dir, tileh) !CanBuildDepotByTileh(dir, tileh)

View File

@ -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. /* 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. */ * 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) { if (include_invalid_water_class) {
SetWaterClass(t, WATER_CLASS_INVALID); SetWaterClass(t, WATER_CLASS_INVALID);
return; return;
@ -1060,7 +1060,7 @@ bool AfterLoadGame()
if (GB(_m[t].m5, 3, 2) == 0) { if (GB(_m[t].m5, 3, 2) == 0) {
MakeClear(t, CLEAR_GRASS, 3); MakeClear(t, CLEAR_GRASS, 3);
} else { } else {
if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) { if (GetTileSlope(t) != SLOPE_FLAT) {
MakeShore(t); MakeShore(t);
} else { } else {
if (GetTileOwner(t) == OWNER_WATER) { if (GetTileOwner(t) == OWNER_WATER) {
@ -1670,7 +1670,7 @@ bool AfterLoadGame()
* on its neighbouring tiles. Done after river and canal updates to * on its neighbouring tiles. Done after river and canal updates to
* ensure neighbours are correct. */ * ensure neighbours are correct. */
for (TileIndex t = 0; t < map_size; t++) { 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_WATER) && IsLock(t)) SetWaterClassDependingOnSurroundings(t, false);
if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(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)) { if (IsSavegameVersionBefore(149)) {
for (TileIndex t = 0; t < map_size; t++) { for (TileIndex t = 0; t < map_size; t++) {
if (!IsTileType(t, MP_STATION)) continue; 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); SetWaterClass(t, WATER_CLASS_INVALID);
} }
} }

View File

@ -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; 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); if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
direction = ReverseDiagDir(direction); direction = ReverseDiagDir(direction);
@ -2364,7 +2364,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
TileIndex tile_cur = tile + TileOffsByDiagDir(direction); 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); 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; if (ret.Failed()) return ret;
tile_cur += TileOffsByDiagDir(direction); 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); return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
} }
@ -2898,7 +2898,7 @@ static void TileLoop_Station(TileIndex tile)
break; break;
case STATION_DOCK: 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 */ /* FALL THROUGH */
case STATION_OILRIG: //(station part) case STATION_OILRIG: //(station part)
case STATION_BUOY: case STATION_BUOY:

View File

@ -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); bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
if (cur_slope == SLOPE_FLAT) return ret; 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. */ /* Don't terraform if land is plain or if there's a house there. */
if (IsTileType(tile, MP_HOUSE)) return; if (IsTileType(tile, MP_HOUSE)) return;
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
if (tileh == SLOPE_FLAT) return; if (tileh == SLOPE_FLAT) return;
/* First try up, then down */ /* First try up, then down */
@ -871,7 +871,7 @@ static RoadBits GetTownRoadGridElement(Town *t, TileIndex tile, DiagDirection di
RoadBits rb_template; RoadBits rb_template;
switch (GetTilePixelSlope(tile, NULL)) { switch (GetTileSlope(tile)) {
default: rb_template = ROAD_ALL; break; default: rb_template = ROAD_ALL; break;
case SLOPE_W: rb_template = ROAD_NW | ROAD_SW; break; case SLOPE_W: rb_template = ROAD_NW | ROAD_SW; break;
case SLOPE_SW: rb_template = ROAD_Y | 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); 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. /* Make sure the direction is compatible with the slope.
* Well we check if the slope has an up bit set in the * 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; tile = t->xy;
for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) { for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) {
/* Only work with plain land that not already has a house */ /* 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()) { 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); DoCommand(tile, GenRandomRoadBits(), t->index, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD);
cur_company.Restore(); cur_company.Restore();
@ -1500,7 +1500,7 @@ static CommandCost TownCanBePlacedHere(TileIndex tile)
} }
/* Can only build on clear flat areas, possibly with trees. */ /* 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); return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
} }
@ -1697,7 +1697,7 @@ static bool FindFurthestFromWater(TileIndex tile, void *user_data)
uint dist = GetClosestWaterDistance(tile, true); uint dist = GetClosestWaterDistance(tile, true);
if (IsTileType(tile, MP_CLEAR) && if (IsTileType(tile, MP_CLEAR) &&
GetTilePixelSlope(tile, NULL) == SLOPE_FLAT && GetTileSlope(tile) == SLOPE_FLAT &&
IsTileAlignedToGrid(tile, sp->layout) && IsTileAlignedToGrid(tile, sp->layout) &&
dist > sp->max_dist) { dist > sp->max_dist) {
sp->tile = tile; 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) static inline bool CanBuildHouseHere(TileIndex tile, TownID town, bool noslope)
{ {
/* cannot build on these slopes... */ /* cannot build on these slopes... */
Slope slope = GetTilePixelSlope(tile, NULL); Slope slope = GetTileSlope(tile);
if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false; if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false;
/* building under a bridge? */ /* building under a bridge? */
@ -2525,7 +2525,7 @@ static CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags)
static bool SearchTileForStatue(TileIndex tile, void *user_data) 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. */ /* 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. */ /* Don't build statues under bridges. */
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false;

View File

@ -70,7 +70,7 @@ static bool CanPlantTreesOnTile(TileIndex tile, bool allow_desert)
{ {
switch (GetTileType(tile)) { switch (GetTileType(tile)) {
case MP_WATER: case MP_WATER:
return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL)); return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTileSlope(tile));
case MP_CLEAR: case MP_CLEAR:
return !IsBridgeAbove(tile) && !IsClearGround(tile, CLEAR_FIELDS) && GetRawClearGround(tile) != CLEAR_ROCKS && 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; break;
case MP_WATER: case MP_WATER:
if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL))) { if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTileSlope(tile))) {
msg = STR_ERROR_CAN_T_BUILD_ON_WATER; msg = STR_ERROR_CAN_T_BUILD_ON_WATER;
continue; continue;
} }

View File

@ -106,7 +106,7 @@ CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
if ((MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) || if ((MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) ||
(MayHaveBridgeAbove(tile2) && IsBridgeAbove(tile2))) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); (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 */ /* Prevent depots on rapids */
return_cmd_error(STR_ERROR_SITE_UNSUITABLE); return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
} }
@ -220,7 +220,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
cost.AddCost(ret); cost.AddCost(ret);
cost.AddCost(_price[PR_BUILD_CANAL]); 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); 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(ret);
cost.AddCost(_price[PR_BUILD_CANAL]); 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); 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) 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); if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
/* Disallow building of locks on river rapids */ /* 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) { TILE_AREA_LOOP(tile, ta) {
CommandCost ret; CommandCost ret;
Slope slope = GetTilePixelSlope(tile, NULL); Slope slope = GetTileSlope(tile);
if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) { if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) {
return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
} }
@ -419,7 +419,7 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
} }
case WATER_TILE_COAST: { case WATER_TILE_COAST: {
Slope slope = GetTilePixelSlope(tile, NULL); Slope slope = GetTileSlope(tile);
/* Make sure no vehicle is on the tile */ /* Make sure no vehicle is on the tile */
CommandCost ret = EnsureNoVehicleOnGround(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_LOCK: return DiagDirToAxis(GetLockDirection(tile)) == DiagDirToAxis(DirToDiagDir(from));
case WATER_TILE_COAST: 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_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_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW); 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: case MP_RAILWAY:
if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
assert(IsPlainRail(tile)); 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_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_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW); 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 IsTileOnWater(tile);
} }
return (IsDock(tile) && GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) || IsBuoy(tile); return (IsDock(tile) && GetTileSlope(tile) == SLOPE_FLAT) || IsBuoy(tile);
case MP_INDUSTRY: { case MP_INDUSTRY: {
/* Do not draw waterborders inside of industries. /* Do not draw waterborders inside of industries.
@ -931,7 +931,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
switch (GetTileType(tile)) { switch (GetTileType(tile)) {
case MP_WATER: case MP_WATER:
if (IsCoast(tile)) { if (IsCoast(tile)) {
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
return (IsSlopeWithOneCornerRaised(tileh) ? FLOOD_ACTIVE : FLOOD_DRYUP); return (IsSlopeWithOneCornerRaised(tileh) ? FLOOD_ACTIVE : FLOOD_DRYUP);
} }
/* FALL THROUGH */ /* FALL THROUGH */
@ -942,7 +942,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
case MP_RAILWAY: case MP_RAILWAY:
if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { 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; return FLOOD_NONE;
@ -965,7 +965,7 @@ void DoFloodTile(TileIndex target)
Backup<CompanyByte> cur_company(_current_company, OWNER_WATER, FILE_LINE); Backup<CompanyByte> cur_company(_current_company, OWNER_WATER, FILE_LINE);
Slope tileh = GetTilePixelSlope(target, NULL); Slope tileh = GetTileSlope(target);
if (tileh != SLOPE_FLAT) { if (tileh != SLOPE_FLAT) {
/* make coast.. */ /* make coast.. */
switch (GetTileType(target)) { switch (GetTileType(target)) {
@ -1133,7 +1133,7 @@ void ConvertGroundTilesIntoWaterTiles()
uint dir; uint dir;
FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope & ~SLOPE_STEEP]) { FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope & ~SLOPE_STEEP]) {
TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir)); 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)) { if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) {
MakeShore(tile); MakeShore(tile);
break; break;
@ -1154,8 +1154,8 @@ static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode,
if (mode != TRANSPORT_WATER) return 0; if (mode != TRANSPORT_WATER) return 0;
switch (GetWaterTileType(tile)) { switch (GetWaterTileType(tile)) {
case WATER_TILE_CLEAR: ts = (GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) ? TRACK_BIT_ALL : TRACK_BIT_NONE; 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[GetTilePixelSlope(tile, NULL) & 0xF]; 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_LOCK: ts = DiagDirToDiagTrackBits(GetLockDirection(tile)); break;
case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break; case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break;
default: return 0; default: return 0;

View File

@ -124,7 +124,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID *
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile); if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
Slope tileh = GetTilePixelSlope(tile, NULL); Slope tileh = GetTileSlope(tile);
if (tileh != SLOPE_FLAT && if (tileh != SLOPE_FLAT &&
(!_settings_game.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) { (!_settings_game.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) {
return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); 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 (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 (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. */ /* 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); Waypoint *wp = FindDeletedWaypointCloseTo(tile, STR_SV_STNAME_BUOY, OWNER_NONE);