diff options
Diffstat (limited to 'src/tilearea_type.h')
-rw-r--r-- | src/tilearea_type.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/tilearea_type.h b/src/tilearea_type.h index 264821985..e6d9bad60 100644 --- a/src/tilearea_type.h +++ b/src/tilearea_type.h @@ -12,6 +12,8 @@ #include "map_func.h" +class OrthogonalTileIterator; + /** Represents the covered area of e.g. a rail station */ struct OrthogonalTileArea { TileIndex tile; ///< The base tile of the area @@ -58,6 +60,10 @@ struct OrthogonalTileArea { { return TILE_ADDXY(this->tile, this->w / 2, this->h / 2); } + + OrthogonalTileIterator begin() const; + + OrthogonalTileIterator end() const; }; /** Represents a diagonal tile area. */ @@ -124,6 +130,15 @@ public: } /** + * Get the tile we are currently at. + * @return The tile we are at, or INVALID_TILE when we're done. + */ + inline TileIndex operator *() const + { + return this->tile; + } + + /** * Move ourselves to the next tile in the rectangle on the map. */ virtual TileIterator& operator ++() = 0; @@ -223,12 +238,4 @@ public: } }; -/** - * A loop which iterates over the tiles of a TileArea. - * @param var The name of the variable which contains the current tile. - * This variable will be allocated in this \c for of this loop. - * @param ta The tile area to search over. - */ -#define TILE_AREA_LOOP(var, ta) for (OrthogonalTileIterator var(ta); var != INVALID_TILE; ++var) - #endif /* TILEAREA_TYPE_H */ |