OpenTTD Source: BitmapTileArea Class Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Protected Member Functions | Protected Attributes
BitmapTileArea Class Reference

Represents a tile area containing containing individually set tiles. More...

`#include <bitmap_type.h>`

Inheritance diagram for BitmapTileArea:

## Public Member Functions
| BitmapTileArea (const TileArea &ta)
void | Reset ()
| Reset and clear the BitmapTileArea.
void | Initialize (const Rect &r)
| Initialize the BitmapTileArea with the specified Rect.
void | Initialize (const TileArea &ta)
void | SetTile (TileIndex tile)
| Add a tile as part of the tile area.
void | ClrTile (TileIndex tile)
| Clear a tile from the tile area.
bool | HasTile (TileIndex tile) const
| Test if a tile is part of the tile area.
Public Member Functions inherited from OrthogonalTileArea
| OrthogonalTileArea (TileIndex tile=INVALID_TILE, uint16_t w=0, uint16_t 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?
OrthogonalTileArea & | Expand (int rad)
| Expand a tile area by rad tiles in each direction, keeping within map bounds.
void | ClampToMap ()
| Clamp the tile area to map borders.
TileIndex | GetCenterTile () const
| Get the center tile.
OrthogonalTileIterator | begin () const
| Returns an iterator to the beginning of the tile area.
OrthogonalTileIterator | end () const
| Returns an iterator to the end of the tile area.

## Protected Member Functions
uint | Index (uint x, uint y) const
uint | Index (TileIndex tile) const

## Protected Attributes
std::vector< bool > | data

## Additional Inherited Members
Data Fields inherited from OrthogonalTileArea
TileIndex | tile
| The base tile of the area.
uint16_t | w
| The width of the area.
uint16_t | h
| The height of the area.

## Detailed Description

Represents a tile area containing containing individually set tiles.

Each tile must be contained within the preallocated area. A std::vector<bool> is used to mark which tiles are contained.

Definition at line 18 of file bitmap_type.h.

## Constructor & Destructor Documentation

## ◆ BitmapTileArea() [1/2]

BitmapTileArea::BitmapTileArea | ( |  | ) |
| inline

Definition at line 27 of file bitmap_type.h.

## ◆ BitmapTileArea() [2/2]

BitmapTileArea::BitmapTileArea | ( | const TileArea & | ta | ) |
| inline

Definition at line 34 of file bitmap_type.h.

## Member Function Documentation

## ◆ ClrTile()

void BitmapTileArea::ClrTile | ( | TileIndex | tile | ) |
| inline

Clear a tile from the tile area.

Parameters

  tile | Tile to clear

Definition at line 89 of file bitmap_type.h.

References OrthogonalTileArea::Contains(), and OrthogonalTileArea::tile.

## ◆ HasTile()

bool BitmapTileArea::HasTile | ( | TileIndex | tile | ) | const
| inline

Test if a tile is part of the tile area.

Parameters

  tile | Tile to check

Definition at line 99 of file bitmap_type.h.

References OrthogonalTileArea::Contains(), and OrthogonalTileArea::tile.

Referenced by BitmapTileIterator::BitmapTileIterator(), and BitmapTileIterator::operator++().

## ◆ Index() [1/2]

uint BitmapTileArea::Index | ( | TileIndex | tile | ) | const
| inlineprotected

Definition at line 24 of file bitmap_type.h.

## ◆ Index() [2/2]

uint BitmapTileArea::Index | ( | uint | x,
|  | uint | y
| ) |  | const
| inlineprotected

Definition at line 22 of file bitmap_type.h.

## ◆ Initialize() [1/2]

void BitmapTileArea::Initialize | ( | const Rect & | r | ) |
| inline

Initialize the BitmapTileArea with the specified Rect.

Parameters

  rect | Rect to use.

Definition at line 57 of file bitmap_type.h.

References OrthogonalTileArea::h, Rect::Height(), TileXY(), OrthogonalTileArea::w, and Rect::Width().

Referenced by Station::RecomputeCatchment().

## ◆ Initialize() [2/2]

void BitmapTileArea::Initialize | ( | const TileArea & | ta | ) |
| inline

Definition at line 66 of file bitmap_type.h.

## ◆ Reset()

void BitmapTileArea::Reset | ( |  | ) |
| inline

Reset and clear the BitmapTileArea.

Definition at line 45 of file bitmap_type.h.

References OrthogonalTileArea::h, INVALID_TILE, and OrthogonalTileArea::w.

Referenced by Station::RecomputeCatchment().

## ◆ SetTile()

void BitmapTileArea::SetTile | ( | TileIndex | tile | ) |
| inline

Add a tile as part of the tile area.

Parameters

  tile | Tile to add.

Definition at line 79 of file bitmap_type.h.

References OrthogonalTileArea::Contains(), and OrthogonalTileArea::tile.

Referenced by Station::RecomputeCatchment().

## Field Documentation

## ◆ data

std::vector<bool> BitmapTileArea::data
| protected

Definition at line 20 of file bitmap_type.h.

The documentation for this class was generated from the following file:

- src/bitmap_type.h