summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-16 21:25:33 +0000
committerfrosch <frosch@openttd.org>2011-08-16 21:25:33 +0000
commitf34c666bc5d83a7ed32a2aadbafab79333d60f0b (patch)
tree55ff0ead357436aadb3bbb27c9fc7ed942114458 /src
parent79508cb5c9a6ae0a73523d1b31f1f3f013a5564b (diff)
downloadopenttd-f34c666bc5d83a7ed32a2aadbafab79333d60f0b.tar.xz
(svn r22755) -Fix [FS#4727]: When marking tile selections dirty, use the height information of the corners instead of the surface slope. This is more accurate when the foundation is kind of undefined.
Diffstat (limited to 'src')
-rw-r--r--src/viewport.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index f73f5f817..800d2d359 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1723,8 +1723,13 @@ static void SetSelectionTilesDirty()
int bot_y = top_y;
do {
- Point top = RemapCoords2(top_x, top_y); // topmost dirty point
- Point bot = RemapCoords2(bot_x + TILE_SIZE - 1, bot_y + TILE_SIZE - 1); // bottommost point
+ /* topmost dirty point */
+ TileIndex top_tile = TileVirtXY(top_x, top_y);
+ Point top = RemapCoords(top_x, top_y, GetTileMaxZ(top_tile));
+
+ /* bottommost point */
+ TileIndex bottom_tile = TileVirtXY(bot_x, bot_y);
+ Point bot = RemapCoords(bot_x + TILE_SIZE, bot_y + TILE_SIZE, GetTileZ(bottom_tile)); // bottommost point
/* the 'x' coordinate of 'top' and 'bot' is the same (and always in the same distance from tile middle),
* tile height/slope affects only the 'y' on-screen coordinate! */