# TileArea Struct Reference

Represents the covered area of e.g. More...

`#include <tilearea_type.h>`

Inheritance diagram for TileArea:

## Public Member Functions
| TileArea ()
| Just construct this tile area.
| TileArea (TileIndex tile, uint8 w, uint8 h)
| Construct this tile area with some set values.
| TileArea (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 TileArea &ta) const
| Does this tile area intersect with another?
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.

## Detailed Description

Represents the covered area of e.g.

a rail station

Definition at line 18 of file tilearea_type.h.

## Constructor & Destructor Documentation

TileArea::TileArea | ( | TileIndex | tile,
|  | uint8 | w,
|  | uint8 | h |
| ) |  |  | `[inline]`

Construct this tile area with some set values.

Parameters:

  | tile | the base tile
  | w | the width
  | h | the height

Definition at line 32 of file tilearea_type.h.

TileArea::TileArea | ( | TileIndex | start,
|  | TileIndex | end |
| ) |  |  |

Construct this tile area based on two points.

Parameters:

  | start | the start of the area
  | end | the end of the area

Definition at line 21 of file tilearea.cpp.

References h, Swap(), tile, TileX(), TileXY(), TileY(), and w.

## Member Function Documentation

void TileArea::Add | ( | TileIndex | to_add | ) |

Add a single tile to a tile area; enlarge if needed.

Parameters:

  | to_add | The tile to add

Definition at line 40 of file tilearea.cpp.

References h, INVALID_TILE, max(), min(), tile, TileX(), TileXY(), TileY(), and w.

Referenced by CmdBuildAirport(), CmdBuildRoadStop(), DoCreateNewIndustry(), and RemoveRoadStop().

void TileArea::Clear | ( |  | ) | `[inline]`

Clears the 'tile area', i.e.

make the tile invalid.

Definition at line 42 of file tilearea_type.h.

References h, INVALID_TILE, tile, and w.

Referenced by RemoveAirport(), and RemoveRoadStop().

TileIndex TileArea::GetCenterTile | ( |  | ) | const`[inline]`

Get the center tile.

Returns:
  The tile at the center, or just north of it.

Definition at line 57 of file tilearea_type.h.

References h, tile, TILE_ADDXY, and w.

Referenced by IndustryViewWindow::OnClick().

bool TileArea::Intersects | ( | const TileArea & | ta | ) | const

Does this tile area intersect with another?

Parameters:

  | ta | the other tile area to check against.

Returns:
  true if they intersect.

Definition at line 72 of file tilearea.cpp.

References h, tile, TileX(), TileY(), and w.

Referenced by GetProductionAroundTiles().

The documentation for this struct was generated from the following files:

- src/tilearea_type.h
- src/tilearea.cpp