Public Member Functions | Data Fields

# OrthogonalTileArea Struct Reference

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

`#include <tilearea_type.h>`

Inheritance diagram for OrthogonalTileArea:

## 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.

## Detailed Description

Represents the covered area of e.g.

a rail station

Definition at line 18 of file tilearea_type.h.

## Constructor & Destructor Documentation

OrthogonalTileArea::OrthogonalTileArea | ( | TileIndex | tile = `INVALID_TILE`,
|  | uint8 | w = `0`,
|  | uint8 | h = `0` |
| ) |  |  | `[inline]`

Construct this tile area with some set values.

Parameters:

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

Definition at line 29 of file tilearea_type.h.

OrthogonalTileArea::OrthogonalTileArea | ( | 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, MapSize(), Swap(), tile, TileX(), TileXY(), TileY(), and w.

## Member Function Documentation

void OrthogonalTileArea::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 43 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().

void OrthogonalTileArea::Clear | ( |  | ) | `[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?

Parameters:

  | tile | Tile to test for.

Returns:
  True if the tile is inside the area.

Definition at line 104 of file tilearea.cpp.

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

Referenced by TileMatrix< uint32, 4 >::Add().

TileIndex OrthogonalTileArea::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 OrthogonalTileArea::Intersects | ( | const OrthogonalTileArea & | 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 75 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