summaryrefslogtreecommitdiff
path: root/src/tilearea.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-06 13:19:46 +0000
committeralberth <alberth@openttd.org>2010-02-06 13:19:46 +0000
commita6e8c747c9cc04ef800427ac852840d0de2b2c94 (patch)
treecc0c6320cedf311e6cd20924aa2b77259e40dba4 /src/tilearea.cpp
parent21589daea9d55878d029b641374caff10561fff3 (diff)
downloadopenttd-a6e8c747c9cc04ef800427ac852840d0de2b2c94.tar.xz
(svn r19041) -Codechange: Improve selection of tile to draw in zoomed-out smallmaps.
Diffstat (limited to 'src/tilearea.cpp')
-rw-r--r--src/tilearea.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tilearea.cpp b/src/tilearea.cpp
index 81efe96be..fb3e11394 100644
--- a/src/tilearea.cpp
+++ b/src/tilearea.cpp
@@ -95,3 +95,13 @@ bool TileArea::Intersects(const TileArea &ta) const
);
}
+/**
+ * Clamp the tile area to map borders.
+ */
+void TileArea::ClampToMap()
+{
+ assert(this->tile < MapSize());
+ this->w = min(this->w, MapSizeX() - TileX(this->tile));
+ this->h = min(this->h, MapSizeY() - TileY(this->tile));
+}
+