diff options
Diffstat (limited to 'src/tilearea.cpp')
-rw-r--r-- | src/tilearea.cpp | 10 |
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)); +} + |