diff options
author | rubidium <rubidium@openttd.org> | 2011-11-04 11:52:19 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-04 11:52:19 +0000 |
commit | 2a2c102b0b173d6ebcfb90291eb56e82c4e935a7 (patch) | |
tree | eea14ef6e9fcafd4cb4fb4a1a4aec8cbf1f928b7 /src/viewport.cpp | |
parent | 459c9523e8acdf314ce697460f4768eec228daac (diff) | |
download | openttd-2a2c102b0b173d6ebcfb90291eb56e82c4e935a7.tar.xz |
(svn r23108) -Codechange: more uint -> int / byte -> int conversions for Z related variables
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index a587a872e..58fa27606 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -369,7 +369,7 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y) { Point pt; int a, b; - uint z; + int z; if ( (uint)(x -= vp->left) >= (uint)vp->width || (uint)(y -= vp->top) >= (uint)vp->height) { @@ -400,12 +400,12 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y) int min_coord = _settings_game.construction.freeform_edges ? TILE_SIZE : 0; - for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + (int)max(z, 4u) - 4, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, 4u) - 4, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; - for (uint malus = 3; malus > 0; malus--) z = GetSlopePixelZ(Clamp(a + (int)max(z, malus) - (int)malus, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, malus) - (int)malus, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; - for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; + for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + max(z, 4) - 4, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + max(z, 4) - 4, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; + for (int malus = 3; malus > 0; malus--) z = GetSlopePixelZ(Clamp(a + max(z, malus) - malus, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + max(z, malus) - malus, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; + for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + z, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + z, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; - pt.x = Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1); - pt.y = Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1); + pt.x = Clamp(a + z, min_coord, MapMaxX() * TILE_SIZE - 1); + pt.y = Clamp(b + z, min_coord, MapMaxY() * TILE_SIZE - 1); return pt; } |