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

@@ -793,7 +793,7 @@ bool FloodHalftile(TileIndex t)
}
} else {
/* 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)) {
flooded = true;
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);
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);
} else {
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);
/* Get the slopes on top of the foundations */
z_old += ApplyFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), &tileh_old);
z_new += ApplyFoundationToSlope(GetRailFoundation(tileh_new, rail_bits), &tileh_new);
z_old += ApplyFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), tileh_old);
z_new += ApplyFoundationToSlope(GetRailFoundation(tileh_new, rail_bits), tileh_new);
Corner track_corner;
switch (rail_bits) {