10#ifndef BITMAP_TYPE_HPP
11#define BITMAP_TYPE_HPP
32 return y * this->ta.
w + x;
62 this->data[this->
Index(tile)] =
true;
72 this->data[this->
Index(tile)] =
false;
82 return this->ta.
Contains(tile) && this->data[this->
Index(tile)];
114 return this->bitmap == other.
bitmap && this->iter == other.
iter;
161 inline std::default_sentinel_t
end()
const
163 return std::default_sentinel_t();
Iterator to iterate over all tiles belonging to a BitmapTileArea.
TileIndex value_type
value_type iterator trait
iterator(const BitmapTileArea &bitmap)
Construct the iterator.
bool operator==(const std::default_sentinel_t &) const
Compare with end sentinel.
TileIndex operator*() const
Get the current tile.
void reference
reference iterator trait
OrthogonalTileArea::iterator iter
The underlying tile area iterator.
bool operator==(const iterator &other) const
Compare with other iterator.
iterator & operator++()
Increment the iterator and set it to the next position.
void pointer
pointer iterator trait
const BitmapTileArea * bitmap
The bitmap tile area being iterated.
std::ptrdiff_t difference_type
difference_type iterator trait
std::forward_iterator_tag iterator_category
iterator_category iterator trait
void Remove(TileIndex tile)
Remove a tile from the tile area.
BitmapTileArea()=default
Construct an empty bitmap tile area.
std::default_sentinel_t end() const
Returns an iterator to the end of the tile area.
OrthogonalTileArea ta
Underlying tile area.
std::vector< bool > data
Storage of tiles contained within the tile area.
void Add(TileIndex tile)
Add a tile as part of the tile area.
iterator begin() const
Returns an iterator to the start of the tile area.
bool IsEmpty() const
Test if this tile area is empty.
uint Index(TileIndex tile) const
Get the internal index for the given tile.
void Clear()
Reset and clear the BitmapTileArea.
void Initialize(const OrthogonalTileArea &ta)
Initialize the BitmapTileArea with the specified OrthogonalTileArea.
bool Contains(TileIndex tile) const
Test if a tile is part of the tile area.
Iterator to iterate over a tile area (rectangle) of the map.
Represents the covered area of e.g.
bool Contains(TileIndex tile) const
Does this tile area contain a tile?
uint16_t w
The width of the area.
void Clear()
Clears the 'tile area', i.e.
TileIndex tile
The base tile of the area.
TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b)
Returns the diff between two tiles.
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.
Type for storing and iterating orthogonal tile areas.