OpenTTD
|
Represents the covered area of e.g. More...
#include <tilearea_type.h>
Public Member Functions | |
OrthogonalTileArea (TileIndex tile=INVALID_TILE, uint8 w=0, uint8 h=0) | |
Construct this tile area with some set values. More... | |
OrthogonalTileArea (TileIndex start, TileIndex end) | |
Construct this tile area based on two points. More... | |
void | Add (TileIndex to_add) |
Add a single tile to a tile area; enlarge if needed. More... | |
void | Clear () |
Clears the 'tile area', i.e. More... | |
bool | Intersects (const OrthogonalTileArea &ta) const |
Does this tile area intersect with another? More... | |
bool | Contains (TileIndex tile) const |
Does this tile area contain a tile? More... | |
void | ClampToMap () |
Clamp the tile area to map borders. | |
TileIndex | GetCenterTile () const |
Get the center tile. More... | |
Data Fields | |
TileIndex | tile |
The base tile of the area. | |
uint16 | w |
The width of the area. | |
uint16 | h |
The height of the area. | |
|
inline |
Construct this tile area with some set values.
tile | the base tile |
w | the width |
h | the height |
Definition at line 29 of file tilearea_type.h.
References Add().
Referenced by OrthogonalTileIterator::OrthogonalTileIterator().
Construct this tile area based on two points.
start | the start of the area |
end | the end of the area |
Definition at line 23 of file tilearea.cpp.
void OrthogonalTileArea::Add | ( | TileIndex | to_add | ) |
Add a single tile to a tile area; enlarge if needed.
to_add | The tile to add |
Definition at line 45 of file tilearea.cpp.
References h, INVALID_TILE, max(), min(), tile, TileX(), TileXY(), TileY(), and w.
Referenced by OrthogonalTileArea().
|
inline |
Clears the 'tile area', i.e.
make the tile invalid.
Definition at line 40 of file tilearea_type.h.
References ClampToMap(), Contains(), Intersects(), and INVALID_TILE.
bool OrthogonalTileArea::Contains | ( | TileIndex | tile | ) | const |
Does this tile area contain a tile?
tile | Tile to test for. |
Definition at line 106 of file tilearea.cpp.
References w.
Referenced by TileMatrix< uint32, 4 >::Add(), Clear(), and DiagonalTileArea::Clear().
|
inline |
Get the center tile.
Definition at line 57 of file tilearea_type.h.
References TILE_ADDXY.
bool OrthogonalTileArea::Intersects | ( | const OrthogonalTileArea & | ta | ) | const |
Does this tile area intersect with another?
ta | the other tile area to check against. |
Definition at line 77 of file tilearea.cpp.
References w.
Referenced by Clear().