10#ifndef BITMAP_TYPE_HPP
11#define BITMAP_TYPE_HPP
20 std::vector<bool> data;
22 inline uint Index(uint x, uint y)
const {
return y * this->
w + x; }
39 this->data.resize(Index(this->
w, this->
h));
59 this->data.resize(Index(
w,
h));
69 this->data[Index(
tile)] =
true;
79 this->data[Index(
tile)] =
false;
Represents a tile area containing containing individually set tiles.
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.
void Reset()
Reset and clear the BitmapTileArea.
TileIterator & operator++() override
Move ourselves to the next tile in the rectangle on the map.
BitmapTileIterator(const BitmapTileArea &bitmap)
Construct the iterator.
OrthogonalTileIterator(const OrthogonalTileArea &ta)
Construct the iterator.
TileIterator & operator++() override
Move ourselves to the next tile in the rectangle on the map.
TileIterator(TileIndex tile=INVALID_TILE)
Initialise the iterator starting at this tile.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static uint TileX(TileIndex tile)
Get the X component of a tile.
bool Contains(TileIndex tile) const
Does this tile area contain a tile?
uint16_t w
The width of the area.
TileIndex tile
The base tile of the area.
uint16_t h
The height of the area.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.