summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorJohannes E. Krause <j.k@eclipso.de>2019-01-13 20:56:10 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-01-24 21:17:17 +0100
commit05da5a177c7e976d5da0da541a842482ab23017d (patch)
tree1fe26eed5c786404bc6638c938c8745161e27923 /src/viewport.cpp
parentf744dea0ff7104a4ac9f1cfdc067caaf2c10acd0 (diff)
downloadopenttd-05da5a177c7e976d5da0da541a842482ab23017d.tar.xz
Codechange: Simplify marking tiles dirty when terraforming (Patch by adf88, #6583)
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 7fe280a20..11a158712 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1779,11 +1779,12 @@ void ConstrainAllViewportsZoom()
* Mark a tile given by its index dirty for repaint.
* @param tile The tile to mark dirty.
* @param bridge_level_offset Height of bridge on tile to also mark dirty. (Height level relative to north corner.)
+ * @param tile_height_override Height of the tile (#TileHeight).
* @ingroup dirty
*/
-void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset)
+void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
{
- Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, TilePixelHeight(tile));
+ Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, tile_height_override * TILE_HEIGHT);
MarkAllViewportsDirty(
pt.x - MAX_TILE_EXTENT_LEFT,
pt.y - MAX_TILE_EXTENT_TOP - ZOOM_LVL_BASE * TILE_HEIGHT * bridge_level_offset,
@@ -1792,22 +1793,6 @@ void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset)
}
/**
- * Mark a (virtual) tile outside the map dirty for repaint.
- * @param x Tile X position.
- * @param y Tile Y position.
- * @ingroup dirty
- */
-void MarkTileDirtyByTileOutsideMap(int x, int y)
-{
- Point pt = RemapCoords(x * TILE_SIZE, y * TILE_SIZE, TilePixelHeightOutsideMap(x, y));
- MarkAllViewportsDirty(
- pt.x - MAX_TILE_EXTENT_LEFT,
- pt.y, // no buildings outside of map
- pt.x + MAX_TILE_EXTENT_RIGHT,
- pt.y + MAX_TILE_EXTENT_BOTTOM);
-}
-
-/**
* Marks the selected tiles as dirty.
*
* This function marks the selected tiles as dirty for repaint