OpenTTD Source
20240917-master-g9ab0a47812
|
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->tile =
TileXY(r.left, r.top);
63 this->data.resize(Index(
w,
h));
72 this->data.resize(Index(
w,
h));
82 this->data[Index(
tile)] =
true;
92 this->data[Index(
tile)] =
false;
121 (*this).OrthogonalTileIterator::operator++();
123 (*this).OrthogonalTileIterator::operator++();
128 std::unique_ptr<TileIterator>
Clone()
const override
130 return std::make_unique<BitmapTileIterator>(*
this);
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
int Height() const
Get height of Rect.
void Initialize(const Rect &r)
Initialize the BitmapTileArea with the specified Rect.
void SetTile(TileIndex tile)
Add a tile as part of the tile area.
Iterator to iterate over all tiles belonging to a bitmaptilearea.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
std::unique_ptr< TileIterator > Clone() const override
Allocate a new iterator that is a copy of this one.
uint16_t h
The height of the area.
Iterator to iterate over a tile area (rectangle) of the map.
Represents a tile area containing containing individually set tiles.
Base class for tile iterators.
void Reset()
Reset and clear the BitmapTileArea.
Represents the covered area of e.g.
bool HasTile(TileIndex tile) const
Test if a tile is part of the tile area.
TileIterator & operator++() override
Move ourselves to the next tile in the rectangle on the map.
void ClrTile(TileIndex tile)
Clear a tile from the tile area.
TileIndex tile
The base tile of the area.
uint16_t w
The width of the area.
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
BitmapTileIterator(const BitmapTileArea &bitmap)
Construct the iterator.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
int Width() const
Get width of Rect.
Specification of a rectangle with absolute coordinates of all edges.
bool Contains(TileIndex tile) const
Does this tile area contain a tile?