MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / BitmapTileIterator

Class BitmapTileIterator

src/bitmap_type.h:106–132  ·  view source on GitHub ↗

Iterator to iterate over all tiles belonging to a bitmaptilearea. */

Source from the content-addressed store, hash-verified

104
105/** Iterator to iterate over all tiles belonging to a bitmaptilearea. */
106class BitmapTileIterator : public OrthogonalTileIterator {
107protected:
108 const BitmapTileArea *bitmap;
109public:
110 /**
111 * Construct the iterator.
112 * @param bitmap BitmapTileArea to iterate.
113 */
114 BitmapTileIterator(const BitmapTileArea &bitmap) : OrthogonalTileIterator(bitmap), bitmap(&bitmap)
115 {
116 if (!this->bitmap->HasTile(TileIndex(this->tile))) ++(*this);
117 }
118
119 inline TileIterator& operator ++() override
120 {
121 this->OrthogonalTileIterator::operator++();
122 while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) {
123 this->OrthogonalTileIterator::operator++();
124 }
125 return *this;
126 }
127
128 std::unique_ptr<TileIterator> Clone() const override
129 {
130 return std::make_unique<BitmapTileIterator>(*this);
131 }
132};
133
134#endif /* BITMAP_TYPE_HPP */

Callers

nothing calls this directly

Calls 1

HasTileMethod · 0.80

Tested by

no test coverage detected