Update to 1.10.0-beta1

This commit is contained in:
dP
2019-10-31 22:24:28 +03:00
parent b84a475e14
commit 599ccf0c2b
1470 changed files with 354219 additions and 16795 deletions

View File

@@ -117,6 +117,27 @@ bool OrthogonalTileArea::Contains(TileIndex tile) const
return IsInsideBS(tile_x, left, this->w) && IsInsideBS(tile_y, top, this->h);
}
/**
* Expand a tile area by rad tiles in each direction, keeping within map bounds.
* @param rad Number of tiles to expand
* @return The OrthogonalTileArea.
*/
OrthogonalTileArea &OrthogonalTileArea::Expand(int rad)
{
int x = TileX(this->tile);
int y = TileY(this->tile);
int sx = max(x - rad, 0);
int sy = max(y - rad, 0);
int ex = min(x + this->w + rad, MapSizeX());
int ey = min(y + this->h + rad, MapSizeY());
this->tile = TileXY(sx, sy);
this->w = ex - sx;
this->h = ey - sy;
return *this;
}
/**
* Clamp the tile area to map borders.
*/