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

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