Codechange: Use std::tuple for slope functions with two return values

This commit is contained in:
Michael Lutz
2024-03-08 12:12:41 +01:00
parent 5806c2aba4
commit 8dda387f82
21 changed files with 79 additions and 113 deletions

View File

@@ -2580,8 +2580,7 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y, bool)
{
if (IsPlainRail(tile)) {
int z;
Slope tileh = GetTilePixelSlope(tile, &z);
auto [tileh, z] = GetTilePixelSlope(tile);
if (tileh == SLOPE_FLAT) return z;
z += ApplyPixelFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), &tileh);
@@ -2608,8 +2607,7 @@ static void TileLoop_Track(TileIndex tile)
switch (_settings_game.game_creation.landscape) {
case LT_ARCTIC: {
int z;
Slope slope = GetTileSlope(tile, &z);
auto [slope, z] = GetTileSlopeZ(tile);
bool half = false;
/* for non-flat track, use lower part of track
@@ -3052,8 +3050,7 @@ static Vehicle *EnsureNoShipProc(Vehicle *v, void *)
static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
{
int z_old;
Slope tileh_old = GetTileSlope(tile, &z_old);
auto [tileh_old, z_old] = GetTileSlopeZ(tile);
if (IsPlainRail(tile)) {
TrackBits rail_bits = GetTrackBits(tile);
/* Is there flat water on the lower halftile that must be cleared expensively? */