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. | |
OrthogonalTileArea (TileIndex start, TileIndex end) | |
Construct this tile area based on two points. | |
void | Add (TileIndex to_add) |
Add a single tile to a tile area; enlarge if needed. | |
void | Clear () |
Clears the 'tile area', i.e. | |
bool | Intersects (const OrthogonalTileArea &ta) const |
Does this tile area intersect with another? | |
bool | Contains (TileIndex tile) const |
Does this tile area contain a tile? | |
void | ClampToMap () |
Clamp the tile area to map borders. | |
TileIndex | GetCenterTile () const |
Get the center tile. |
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.
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 TileMatrix< uint32, 4 >::AllocateStorage(), CmdBuildAirport(), CmdBuildRoadStop(), DoCreateNewIndustry(), and RemoveRoadStop().
|
inline |
Clears the 'tile area', i.e.
make the tile invalid.
Definition at line 40 of file tilearea_type.h.
References h, INVALID_TILE, tile, and w.
Referenced by RemoveAirport(), and RemoveRoadStop().
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 h, IsInsideBS(), TileX(), TileY(), and w.
Referenced by TileMatrix< uint32, 4 >::Add().
|
inline |
Get the center tile.
Definition at line 57 of file tilearea_type.h.
References h, tile, TILE_ADDXY, and w.
Referenced by WaypointWindow::GetCenterTile(), and IndustryViewWindow::OnClick().
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 h, tile, TileX(), TileY(), and w.
Referenced by GetProductionAroundTiles().