1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
SamuXarick 32c16b2b76
Merge 38462627db into 1d38cbafcb 2025-07-13 23:10:26 +00:00
SamuXarick 38462627db Codechange: 3 steps of std::min/max with 2 elements are faster than 1 single step with 4 2025-01-02 15:55:42 +00:00
1 changed files with 16 additions and 12 deletions

View File

@ -120,12 +120,14 @@ int GetTileZ(TileIndex tile)
uint x2 = std::min(x1 + 1, Map::MaxX());
uint y2 = std::min(y1 + 1, Map::MaxY());
return std::min({
return std::min(
std::min(
TileHeight(tile), // N corner
TileHeight(TileXY(x2, y1)), // W corner
TileHeight(TileXY(x2, y1))), // W corner
std::min(
TileHeight(TileXY(x1, y2)), // E corner
TileHeight(TileXY(x2, y2)), // S corner
});
TileHeight(TileXY(x2, y2))) // S corner
);
}
/**
@ -140,10 +142,12 @@ int GetTileMaxZ(TileIndex t)
uint x2 = std::min(x1 + 1, Map::MaxX());
uint y2 = std::min(y1 + 1, Map::MaxY());
return std::max({
return std::max(
std::max(
TileHeight(t), // N corner
TileHeight(TileXY(x2, y1)), // W corner
TileHeight(TileXY(x2, y1))), // W corner
std::max(
TileHeight(TileXY(x1, y2)), // E corner
TileHeight(TileXY(x2, y2)), // S corner
});
TileHeight(TileXY(x2, y2))) // S corner
);
}