10 #ifndef BITMAP_TYPE_HPP 11 #define BITMAP_TYPE_HPP 21 std::vector<bool> data;
23 inline uint Index(uint x, uint y)
const {
return y * this->
w + x; }
40 this->data.resize(Index(this->
w, this->
h));
60 this->tile =
TileXY(r.left, r.top);
61 this->
w = r.right - r.left + 1;
62 this->
h = r.bottom - r.top + 1;
64 this->data.resize(Index(
w,
h));
73 this->data.resize(Index(
w,
h));
83 this->data[Index(tile)] =
true;
93 this->data[Index(tile)] =
false;
102 return this->
Contains(tile) && this->data[Index(tile)];
122 (*this).OrthogonalTileIterator::operator++();
124 (*this).OrthogonalTileIterator::operator++();
Iterator to iterate over all tiles belonging to a bitmaptilearea.
bool Contains(TileIndex tile) const
Does this tile area contain a tile?
virtual TileIterator * Clone() const
Allocate a new iterator that is a copy of this one.
static uint TileX(TileIndex tile)
Get the X component of a tile.
void Initialize(const Rect &r)
Initialize the BitmapTileArea with the specified Rect.
void Reset()
Reset and clear the BitmapTileArea.
uint16 w
The width of the area.
BitmapTileIterator(const BitmapTileArea &bitmap)
Construct the iterator.
Represents the covered area of e.g.
Represents a tile area containing containing individually set tiles.
Base class for tile iterators.
bool HasTile(TileIndex tile) const
Test if a tile is part of the tile area.
TileIndex tile
The base tile of the area.
void ClrTile(TileIndex tile)
Clear a tile from the tile area.
uint32 TileIndex
The index/ID of a Tile.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Iterator to iterate over a tile area (rectangle) of the map.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Specification of a rectangle with absolute coordinates of all edges.
uint16 h
The height of the area.
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
void SetTile(TileIndex tile)
Add a tile as part of the tile area.