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

@@ -267,8 +267,8 @@ CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type,
}
/* So, now the surface is checked... check the slope of said surface. */
int allowed_z;
if (GetTileSlope(tile, &allowed_z) != SLOPE_FLAT) allowed_z++;
auto [slope, allowed_z] = GetTileSlopeZ(tile);
if (slope != SLOPE_FLAT) allowed_z++;
for (TileIndex t : ta) {
uint16_t callback = CALLBACK_FAILED;
@@ -492,8 +492,7 @@ static void DrawTile_Object(TileInfo *ti)
static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y, bool)
{
if (IsObjectType(tile, OBJECT_OWNED_LAND)) {
int z;
Slope tileh = GetTilePixelSlope(tile, &z);
auto [tileh, z] = GetTilePixelSlope(tile);
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
} else {