1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-22 22:19:08 +00:00

(svn r23096) -Codechange: remove useless divisions and multiplications by TILE_HEIGHT for the snow line code

This commit is contained in:
rubidium
2011-11-04 10:25:58 +00:00
parent b167c0a396
commit 69162621d8
11 changed files with 33 additions and 32 deletions

View File

@@ -158,7 +158,7 @@ void TileLoopClearHelper(TileIndex tile)
/** Convert to or from snowy tiles. */
static void TileLoopClearAlps(TileIndex tile)
{
int k = GetTilePixelZ(tile) - GetSnowLine() + TILE_HEIGHT;
int k = GetTileZ(tile) - GetSnowLine() + 1;
if (k < 0) {
/* Below the snow line, do nothing if no snow. */
@@ -173,7 +173,7 @@ static void TileLoopClearAlps(TileIndex tile)
}
/* Update snow density. */
uint curent_density = GetClearDensity(tile);
uint req_density = (k < 0) ? 0u : min((uint)k / TILE_HEIGHT, 3);
uint req_density = (k < 0) ? 0u : min((uint)k, 3);
if (curent_density < req_density) {
AddClearDensity(tile, 1);