|
OpenTTD Source 20261112-master-gbcbec5e63f
|
Represents a tile area containing containing individually set tiles. More...
#include <tilearea_bitmap.h>
Data Structures | |
| class | iterator |
| Iterator to iterate over all tiles belonging to a BitmapTileArea. More... | |
Public Member Functions | |
| BitmapTileArea ()=default | |
| Construct an empty bitmap tile area. | |
| BitmapTileArea (const OrthogonalTileArea &ta) | |
| Construct this BitmapTileArea from an OrthogonalTileArea. | |
| void | Clear () |
| Reset and clear the BitmapTileArea. | |
| bool | IsEmpty () const |
| Test if this tile area is empty. | |
| void | Initialize (const OrthogonalTileArea &ta) |
| Initialize the BitmapTileArea with the specified OrthogonalTileArea. | |
| void | Add (TileIndex tile) |
| Add a tile as part of the tile area. | |
| void | Remove (TileIndex tile) |
| Remove a tile from the tile area. | |
| bool | Contains (TileIndex tile) const |
| Test if a tile is part of the tile area. | |
| iterator | begin () const |
| Returns an iterator to the start of the tile area. | |
| std::default_sentinel_t | end () const |
| Returns an iterator to the end of the tile area. | |
Private Member Functions | |
| uint | Index (TileIndex tile) const |
| Get the internal index for the given tile. | |
Private Attributes | |
| std::vector< bool > | data |
| Storage of tiles contained within the tile area. | |
| OrthogonalTileArea | ta {INVALID_TILE, 0, 0} |
| Underlying tile area. | |
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 19 of file tilearea_bitmap.h.
|
explicit |
Construct this BitmapTileArea from an OrthogonalTileArea.
| ta | The orthogonal tile area. |
Definition at line 20 of file tilearea_bitmap.cpp.
References data, ta, and OrthogonalTileArea::w.
|
inline |
Add a tile as part of the tile area.
| tile | Tile to add. |
Definition at line 59 of file tilearea_bitmap.h.
References OrthogonalTileArea::Contains(), and Index().
|
inline |
Returns an iterator to the start of the tile area.
Definition at line 152 of file tilearea_bitmap.h.
|
inline |
Reset and clear the BitmapTileArea.
Definition at line 46 of file tilearea_bitmap.h.
References OrthogonalTileArea::Clear().
|
inline |
Test if a tile is part of the tile area.
| tile | Tile to check. |
true iff the tile is in this area. Definition at line 80 of file tilearea_bitmap.h.
References OrthogonalTileArea::Contains(), and Index().
Referenced by BitmapTileArea::iterator::iterator(), and BitmapTileArea::iterator::operator++().
|
inline |
Returns an iterator to the end of the tile area.
Definition at line 161 of file tilearea_bitmap.h.
|
inlineprivate |
Get the internal index for the given tile.
| tile | The tile. |
Definition at line 29 of file tilearea_bitmap.h.
References OrthogonalTileArea::tile, TileIndexToTileIndexDiffC(), and OrthogonalTileArea::w.
Referenced by Add(), Contains(), and Remove().
| void BitmapTileArea::Initialize | ( | const OrthogonalTileArea & | ta | ) |
Initialize the BitmapTileArea with the specified OrthogonalTileArea.
| ta | The tile area. |
Definition at line 40 of file tilearea_bitmap.cpp.
References data, OrthogonalTileArea::h, ta, OrthogonalTileArea::tile, and OrthogonalTileArea::w.
| bool BitmapTileArea::IsEmpty | ( | ) | const |
Test if this tile area is empty.
true iff the tile area is empty. Definition at line 29 of file tilearea_bitmap.cpp.
|
inline |
Remove a tile from the tile area.
| tile | Tile to clear |
Definition at line 69 of file tilearea_bitmap.h.
References OrthogonalTileArea::Contains(), and Index().
|
private |
Storage of tiles contained within the tile area.
Definition at line 21 of file tilearea_bitmap.h.
Referenced by BitmapTileArea(), Initialize(), and IsEmpty().
|
private |
Underlying tile area.
Definition at line 22 of file tilearea_bitmap.h.
Referenced by BitmapTileArea(), BitmapTileArea(), Initialize(), IsEmpty(), and BitmapTileArea::iterator::iterator().