Codechange: Use references for non-optional in/out values of slope functions

This commit is contained in:
Michael Lutz 2024-03-08 17:31:20 +01:00
parent 8dda387f82
commit 8b9f59d320
8 changed files with 52 additions and 52 deletions

View File

@ -73,5 +73,5 @@ int GetBridgeHeight(TileIndex t)
Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(t))); Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(t)));
/* one height level extra for the ramp */ /* one height level extra for the ramp */
return h + 1 + ApplyFoundationToSlope(f, &tileh); return h + 1 + ApplyFoundationToSlope(f, tileh);
} }

View File

@ -389,7 +389,7 @@ static void DrawRailCatenaryRailway(const TileInfo *ti)
foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour))); foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour)));
} }
ApplyFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]); ApplyFoundationToSlope(foundation, tileh[TS_NEIGHBOUR]);
/* Half tile slopes coincide only with horizontal/vertical track. /* Half tile slopes coincide only with horizontal/vertical track.
* Faking a flat slope results in the correct sprites on positions. */ * Faking a flat slope results in the correct sprites on positions. */

View File

@ -163,44 +163,44 @@ Point InverseRemapCoords2(int x, int y, bool clamp_to_map, bool *clamped)
* @param s The #Slope to modify. * @param s The #Slope to modify.
* @return Increment to the tile Z coordinate. * @return Increment to the tile Z coordinate.
*/ */
uint ApplyFoundationToSlope(Foundation f, Slope *s) uint ApplyFoundationToSlope(Foundation f, Slope &s)
{ {
if (!IsFoundation(f)) return 0; if (!IsFoundation(f)) return 0;
if (IsLeveledFoundation(f)) { if (IsLeveledFoundation(f)) {
uint dz = 1 + (IsSteepSlope(*s) ? 1 : 0); uint dz = 1 + (IsSteepSlope(s) ? 1 : 0);
*s = SLOPE_FLAT; s = SLOPE_FLAT;
return dz; return dz;
} }
if (f != FOUNDATION_STEEP_BOTH && IsNonContinuousFoundation(f)) { if (f != FOUNDATION_STEEP_BOTH && IsNonContinuousFoundation(f)) {
*s = HalftileSlope(*s, GetHalftileFoundationCorner(f)); s = HalftileSlope(s, GetHalftileFoundationCorner(f));
return 0; return 0;
} }
if (IsSpecialRailFoundation(f)) { if (IsSpecialRailFoundation(f)) {
*s = SlopeWithThreeCornersRaised(OppositeCorner(GetRailFoundationCorner(f))); s = SlopeWithThreeCornersRaised(OppositeCorner(GetRailFoundationCorner(f)));
return 0; return 0;
} }
uint dz = IsSteepSlope(*s) ? 1 : 0; uint dz = IsSteepSlope(s) ? 1 : 0;
Corner highest_corner = GetHighestSlopeCorner(*s); Corner highest_corner = GetHighestSlopeCorner(s);
switch (f) { switch (f) {
case FOUNDATION_INCLINED_X: case FOUNDATION_INCLINED_X:
*s = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? SLOPE_SW : SLOPE_NE); s = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? SLOPE_SW : SLOPE_NE);
break; break;
case FOUNDATION_INCLINED_Y: case FOUNDATION_INCLINED_Y:
*s = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? SLOPE_SE : SLOPE_NW); s = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? SLOPE_SE : SLOPE_NW);
break; break;
case FOUNDATION_STEEP_LOWER: case FOUNDATION_STEEP_LOWER:
*s = SlopeWithOneCornerRaised(highest_corner); s = SlopeWithOneCornerRaised(highest_corner);
break; break;
case FOUNDATION_STEEP_BOTH: case FOUNDATION_STEEP_BOTH:
*s = HalftileSlope(SlopeWithOneCornerRaised(highest_corner), highest_corner); s = HalftileSlope(SlopeWithOneCornerRaised(highest_corner), highest_corner);
break; break;
default: NOT_REACHED(); default: NOT_REACHED();
@ -347,7 +347,7 @@ int GetSlopeZInCorner(Slope tileh, Corner corner)
* @param z1 Gets incremented by the height of the first corner of the edge. (near corner wrt. the camera) * @param z1 Gets incremented by the height of the first corner of the edge. (near corner wrt. the camera)
* @param z2 Gets incremented by the height of the second corner of the edge. (far corner wrt. the camera) * @param z2 Gets incremented by the height of the second corner of the edge. (far corner wrt. the camera)
*/ */
void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2) void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int &z1, int &z2)
{ {
static const Slope corners[4][4] = { static const Slope corners[4][4] = {
/* corner | steep slope /* corner | steep slope
@ -359,13 +359,13 @@ void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2)
}; };
int halftile_test = (IsHalftileSlope(tileh) ? SlopeWithOneCornerRaised(GetHalftileSlopeCorner(tileh)) : 0); int halftile_test = (IsHalftileSlope(tileh) ? SlopeWithOneCornerRaised(GetHalftileSlopeCorner(tileh)) : 0);
if (halftile_test == corners[edge][0]) *z2 += TILE_HEIGHT; // The slope is non-continuous in z2. z2 is on the upper side. if (halftile_test == corners[edge][0]) z2 += TILE_HEIGHT; // The slope is non-continuous in z2. z2 is on the upper side.
if (halftile_test == corners[edge][1]) *z1 += TILE_HEIGHT; // The slope is non-continuous in z1. z1 is on the upper side. if (halftile_test == corners[edge][1]) z1 += TILE_HEIGHT; // The slope is non-continuous in z1. z1 is on the upper side.
if ((tileh & corners[edge][0]) != 0) *z1 += TILE_HEIGHT; // z1 is raised if ((tileh & corners[edge][0]) != 0) z1 += TILE_HEIGHT; // z1 is raised
if ((tileh & corners[edge][1]) != 0) *z2 += TILE_HEIGHT; // z2 is raised if ((tileh & corners[edge][1]) != 0) z2 += TILE_HEIGHT; // z2 is raised
if (RemoveHalftileSlope(tileh) == corners[edge][2]) *z1 += TILE_HEIGHT; // z1 is highest corner of a steep slope if (RemoveHalftileSlope(tileh) == corners[edge][2]) z1 += TILE_HEIGHT; // z1 is highest corner of a steep slope
if (RemoveHalftileSlope(tileh) == corners[edge][3]) *z2 += TILE_HEIGHT; // z2 is highest corner of a steep slope if (RemoveHalftileSlope(tileh) == corners[edge][3]) z2 += TILE_HEIGHT; // z2 is highest corner of a steep slope
} }
/** /**
@ -379,7 +379,7 @@ std::tuple<Slope, int> GetFoundationSlope(TileIndex tile)
{ {
auto [tileh, z] = GetTileSlopeZ(tile); auto [tileh, z] = GetTileSlopeZ(tile);
Foundation f = _tile_type_procs[GetTileType(tile)]->get_foundation_proc(tile, tileh); Foundation f = _tile_type_procs[GetTileType(tile)]->get_foundation_proc(tile, tileh);
z += ApplyFoundationToSlope(f, &tileh); z += ApplyFoundationToSlope(f, tileh);
return {tileh, z}; return {tileh, z};
} }
@ -388,12 +388,12 @@ bool HasFoundationNW(TileIndex tile, Slope slope_here, uint z_here)
{ {
int z_W_here = z_here; int z_W_here = z_here;
int z_N_here = z_here; int z_N_here = z_here;
GetSlopePixelZOnEdge(slope_here, DIAGDIR_NW, &z_W_here, &z_N_here); GetSlopePixelZOnEdge(slope_here, DIAGDIR_NW, z_W_here, z_N_here);
auto [slope, z] = GetFoundationPixelSlope(TILE_ADDXY(tile, 0, -1)); auto [slope, z] = GetFoundationPixelSlope(TILE_ADDXY(tile, 0, -1));
int z_W = z; int z_W = z;
int z_N = z; int z_N = z;
GetSlopePixelZOnEdge(slope, DIAGDIR_SE, &z_W, &z_N); GetSlopePixelZOnEdge(slope, DIAGDIR_SE, z_W, z_N);
return (z_N_here > z_N) || (z_W_here > z_W); return (z_N_here > z_N) || (z_W_here > z_W);
} }
@ -403,12 +403,12 @@ bool HasFoundationNE(TileIndex tile, Slope slope_here, uint z_here)
{ {
int z_E_here = z_here; int z_E_here = z_here;
int z_N_here = z_here; int z_N_here = z_here;
GetSlopePixelZOnEdge(slope_here, DIAGDIR_NE, &z_E_here, &z_N_here); GetSlopePixelZOnEdge(slope_here, DIAGDIR_NE, z_E_here, z_N_here);
auto [slope, z] = GetFoundationPixelSlope(TILE_ADDXY(tile, -1, 0)); auto [slope, z] = GetFoundationPixelSlope(TILE_ADDXY(tile, -1, 0));
int z_E = z; int z_E = z;
int z_N = z; int z_N = z;
GetSlopePixelZOnEdge(slope, DIAGDIR_SW, &z_E, &z_N); GetSlopePixelZOnEdge(slope, DIAGDIR_SW, z_E, z_N);
return (z_N_here > z_N) || (z_E_here > z_E); return (z_N_here > z_N) || (z_E_here > z_E);
} }
@ -451,7 +451,7 @@ void DrawFoundation(TileInfo *ti, Foundation f)
} }
Corner highest_corner = GetHighestSlopeCorner(ti->tileh); Corner highest_corner = GetHighestSlopeCorner(ti->tileh);
ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh); ti->z += ApplyPixelFoundationToSlope(f, ti->tileh);
if (IsInclinedFoundation(f)) { if (IsInclinedFoundation(f)) {
/* inclined foundation */ /* inclined foundation */
@ -519,7 +519,7 @@ void DrawFoundation(TileInfo *ti, Foundation f)
); );
OffsetGroundSprite(0, 0); OffsetGroundSprite(0, 0);
} }
ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh); ti->z += ApplyPixelFoundationToSlope(f, ti->tileh);
} }
} }

View File

@ -39,7 +39,7 @@ std::tuple<Slope, int> GetFoundationSlope(TileIndex tile);
uint GetPartialPixelZ(int x, int y, Slope corners); uint GetPartialPixelZ(int x, int y, Slope corners);
int GetSlopePixelZ(int x, int y, bool ground_vehicle = false); int GetSlopePixelZ(int x, int y, bool ground_vehicle = false);
int GetSlopePixelZOutsideMap(int x, int y); int GetSlopePixelZOutsideMap(int x, int y);
void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2); void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int &z1, int &z2);
/** /**
* Determine the Z height of a corner relative to TileZ. * Determine the Z height of a corner relative to TileZ.
@ -114,7 +114,7 @@ inline Point InverseRemapCoords(int x, int y)
Point InverseRemapCoords2(int x, int y, bool clamp_to_map = false, bool *clamped = nullptr); Point InverseRemapCoords2(int x, int y, bool clamp_to_map = false, bool *clamped = nullptr);
uint ApplyFoundationToSlope(Foundation f, Slope *s); uint ApplyFoundationToSlope(Foundation f, Slope &s);
/** /**
* Applies a foundation to a slope. * Applies a foundation to a slope.
* *
@ -123,7 +123,7 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s);
* @param s The #Slope to modify. * @param s The #Slope to modify.
* @return Increment to the tile Z coordinate. * @return Increment to the tile Z coordinate.
*/ */
inline uint ApplyPixelFoundationToSlope(Foundation f, Slope *s) inline uint ApplyPixelFoundationToSlope(Foundation f, Slope &s)
{ {
return ApplyFoundationToSlope(f, s) * TILE_HEIGHT; return ApplyFoundationToSlope(f, s) * TILE_HEIGHT;
} }

View File

@ -793,7 +793,7 @@ bool FloodHalftile(TileIndex t)
} }
} else { } else {
/* Make shore on steep slopes and 'three-corners-raised'-slopes. */ /* Make shore on steep slopes and 'three-corners-raised'-slopes. */
if (ApplyFoundationToSlope(GetRailFoundation(tileh, rail_bits), &tileh) == 0) { if (ApplyFoundationToSlope(GetRailFoundation(tileh, rail_bits), tileh) == 0) {
if (IsSteepSlope(tileh) || IsSlopeWithThreeCornersRaised(tileh)) { if (IsSteepSlope(tileh) || IsSlopeWithThreeCornersRaised(tileh)) {
flooded = true; flooded = true;
SetRailGroundType(t, RAIL_GROUND_WATER); SetRailGroundType(t, RAIL_GROUND_WATER);
@ -2583,7 +2583,7 @@ static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y, bool)
auto [tileh, z] = GetTilePixelSlope(tile); auto [tileh, z] = GetTilePixelSlope(tile);
if (tileh == SLOPE_FLAT) return z; if (tileh == SLOPE_FLAT) return z;
z += ApplyPixelFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), &tileh); z += ApplyPixelFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), tileh);
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
} else { } else {
return GetTileMaxPixelZ(tile); return GetTileMaxPixelZ(tile);
@ -3009,8 +3009,8 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old
if (CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile).Failed()) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK); if (CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile).Failed()) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK);
/* Get the slopes on top of the foundations */ /* Get the slopes on top of the foundations */
z_old += ApplyFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), &tileh_old); z_old += ApplyFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), tileh_old);
z_new += ApplyFoundationToSlope(GetRailFoundation(tileh_new, rail_bits), &tileh_new); z_new += ApplyFoundationToSlope(GetRailFoundation(tileh_new, rail_bits), tileh_new);
Corner track_corner; Corner track_corner;
switch (rail_bits) { switch (rail_bits) {

View File

@ -1930,7 +1930,7 @@ static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y, bool)
if (tileh == SLOPE_FLAT) return z; if (tileh == SLOPE_FLAT) return z;
Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile)); Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile));
z += ApplyPixelFoundationToSlope(f, &tileh); z += ApplyPixelFoundationToSlope(f, tileh);
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
} else { } else {
return GetTileMaxPixelZ(tile); return GetTileMaxPixelZ(tile);
@ -2345,8 +2345,8 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z
auto [tileh_old, z_old] = GetTileSlopeZ(tile); auto [tileh_old, z_old] = GetTileSlopeZ(tile);
/* Get the slope on top of the foundation */ /* Get the slope on top of the foundation */
z_old += ApplyFoundationToSlope(GetRoadFoundation(tileh_old, bits), &tileh_old); z_old += ApplyFoundationToSlope(GetRoadFoundation(tileh_old, bits), tileh_old);
z_new += ApplyFoundationToSlope(GetRoadFoundation(tileh_new, bits), &tileh_new); z_new += ApplyFoundationToSlope(GetRoadFoundation(tileh_new, bits), tileh_new);
/* The surface slope must not be changed */ /* The surface slope must not be changed */
if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);

View File

@ -3087,7 +3087,7 @@ static void DrawTile_Station(TileInfo *ti)
} }
OffsetGroundSprite(0, -8); OffsetGroundSprite(0, -8);
ti->z += ApplyPixelFoundationToSlope(FOUNDATION_LEVELED, &ti->tileh); ti->z += ApplyPixelFoundationToSlope(FOUNDATION_LEVELED, ti->tileh);
} else { } else {
draw_default_foundation: draw_default_foundation:
DrawFoundation(ti, FOUNDATION_LEVELED); DrawFoundation(ti, FOUNDATION_LEVELED);

View File

@ -144,7 +144,7 @@ Foundation GetBridgeFoundation(Slope tileh, Axis axis)
*/ */
bool HasBridgeFlatRamp(Slope tileh, Axis axis) bool HasBridgeFlatRamp(Slope tileh, Axis axis)
{ {
ApplyFoundationToSlope(GetBridgeFoundation(tileh, axis), &tileh); ApplyFoundationToSlope(GetBridgeFoundation(tileh, axis), tileh);
/* If the foundation slope is flat the bridge has a non-flat ramp and vice versa. */ /* If the foundation slope is flat the bridge has a non-flat ramp and vice versa. */
return (tileh != SLOPE_FLAT); return (tileh != SLOPE_FLAT);
} }
@ -170,12 +170,12 @@ static inline const PalSpriteID *GetBridgeSpriteTable(int index, BridgePieces ta
* @param z TileZ corresponding to tileh, gets modified as well * @param z TileZ corresponding to tileh, gets modified as well
* @return Error or cost for bridge foundation * @return Error or cost for bridge foundation
*/ */
static CommandCost CheckBridgeSlope(BridgePieces bridge_piece, Axis axis, Slope *tileh, int *z) static CommandCost CheckBridgeSlope(BridgePieces bridge_piece, Axis axis, Slope &tileh, int &z)
{ {
assert(bridge_piece == BRIDGE_PIECE_NORTH || bridge_piece == BRIDGE_PIECE_SOUTH); assert(bridge_piece == BRIDGE_PIECE_NORTH || bridge_piece == BRIDGE_PIECE_SOUTH);
Foundation f = GetBridgeFoundation(*tileh, axis); Foundation f = GetBridgeFoundation(tileh, axis);
*z += ApplyFoundationToSlope(f, tileh); z += ApplyFoundationToSlope(f, tileh);
Slope valid_inclined; Slope valid_inclined;
if (bridge_piece == BRIDGE_PIECE_NORTH) { if (bridge_piece == BRIDGE_PIECE_NORTH) {
@ -183,7 +183,7 @@ static CommandCost CheckBridgeSlope(BridgePieces bridge_piece, Axis axis, Slope
} else { } else {
valid_inclined = (axis == AXIS_X ? SLOPE_SW : SLOPE_SE); valid_inclined = (axis == AXIS_X ? SLOPE_SW : SLOPE_SE);
} }
if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; if ((tileh != SLOPE_FLAT) && (tileh != valid_inclined)) return CMD_ERROR;
if (f == FOUNDATION_NONE) return CommandCost(); if (f == FOUNDATION_NONE) return CommandCost();
@ -328,8 +328,8 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex tile_end, TileIndex ti
auto [tileh_end, z_end] = GetTileSlopeZ(tile_end); auto [tileh_end, z_end] = GetTileSlopeZ(tile_end);
bool pbs_reservation = false; bool pbs_reservation = false;
CommandCost terraform_cost_north = CheckBridgeSlope(BRIDGE_PIECE_NORTH, direction, &tileh_start, &z_start); CommandCost terraform_cost_north = CheckBridgeSlope(BRIDGE_PIECE_NORTH, direction, tileh_start, z_start);
CommandCost terraform_cost_south = CheckBridgeSlope(BRIDGE_PIECE_SOUTH, direction, &tileh_end, &z_end); CommandCost terraform_cost_south = CheckBridgeSlope(BRIDGE_PIECE_SOUTH, direction, tileh_end, z_end);
/* Aqueducts can't be built of flat land. */ /* Aqueducts can't be built of flat land. */
if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
@ -1090,8 +1090,8 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis
int z_back_north = ti->z; int z_back_north = ti->z;
int z_front_south = ti->z; int z_front_south = ti->z;
int z_back_south = ti->z; int z_back_south = ti->z;
GetSlopePixelZOnEdge(ti->tileh, south_dir, &z_front_south, &z_back_south); GetSlopePixelZOnEdge(ti->tileh, south_dir, z_front_south, z_back_south);
GetSlopePixelZOnEdge(ti->tileh, ReverseDiagDir(south_dir), &z_front_north, &z_back_north); GetSlopePixelZOnEdge(ti->tileh, ReverseDiagDir(south_dir), z_front_north, z_back_north);
/* Shared height of pillars */ /* Shared height of pillars */
int z_front = std::max(z_front_north, z_front_south); int z_front = std::max(z_front_north, z_front_south);
@ -1673,7 +1673,7 @@ static int GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y, bool grou
if (ground_vehicle) return z; if (ground_vehicle) return z;
} else { // IsBridge(tile) } else { // IsBridge(tile)
DiagDirection dir = GetTunnelBridgeDirection(tile); DiagDirection dir = GetTunnelBridgeDirection(tile);
z += ApplyPixelFoundationToSlope(GetBridgeFoundation(tileh, DiagDirToAxis(dir)), &tileh); z += ApplyPixelFoundationToSlope(GetBridgeFoundation(tileh, DiagDirToAxis(dir)), tileh);
/* On the bridge ramp? */ /* On the bridge ramp? */
if (ground_vehicle) { if (ground_vehicle) {
@ -2042,11 +2042,11 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
/* Check if new slope is valid for bridges in general (so we can safely call GetBridgeFoundation()) */ /* Check if new slope is valid for bridges in general (so we can safely call GetBridgeFoundation()) */
if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) { if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) {
CheckBridgeSlope(BRIDGE_PIECE_SOUTH, axis, &tileh_old, &z_old); CheckBridgeSlope(BRIDGE_PIECE_SOUTH, axis, tileh_old, z_old);
res = CheckBridgeSlope(BRIDGE_PIECE_SOUTH, axis, &tileh_new, &z_new); res = CheckBridgeSlope(BRIDGE_PIECE_SOUTH, axis, tileh_new, z_new);
} else { } else {
CheckBridgeSlope(BRIDGE_PIECE_NORTH, axis, &tileh_old, &z_old); CheckBridgeSlope(BRIDGE_PIECE_NORTH, axis, tileh_old, z_old);
res = CheckBridgeSlope(BRIDGE_PIECE_NORTH, axis, &tileh_new, &z_new); res = CheckBridgeSlope(BRIDGE_PIECE_NORTH, axis, tileh_new, z_new);
} }
/* Surface slope is valid and remains unchanged? */ /* Surface slope is valid and remains unchanged? */