|
OpenTTD Source 20261112-master-gbcbec5e63f
|
Iterator to iterate over a diagonal area of the map. More...
#include <tilearea_diagonal.h>
Public Types | |
| using | value_type = TileIndex |
| value_type iterator trait | |
| using | difference_type = std::ptrdiff_t |
| difference_type iterator trait | |
| using | iterator_category = std::forward_iterator_tag |
| iterator_category iterator trait | |
| using | pointer = void |
| pointer iterator trait | |
| using | reference = void |
| reference iterator trait | |
Public Member Functions | |
| iterator (const DiagonalTileArea &ta) | |
| Construct the iterator. | |
| bool | operator== (const iterator &) const =default |
| Compare with other iterator. | |
| bool | operator== (const std::default_sentinel_t &) const |
| Compare with end sentinel. | |
| TileIndex | operator* () const |
| Get the current tile. | |
| iterator & | operator++ () |
| Increment the iterator and set it to the next position. | |
Private Attributes | |
| TileIndex | tile |
| The current tile. | |
| uint | base_x |
| The base tile x coordinate from where the iterating happens. | |
| uint | base_y |
| The base tile y coordinate from where the iterating happens. | |
| int | a_cur |
| The current (rotated) x coordinate of the iteration. | |
| int | b_cur |
| The current (rotated) y coordinate of the iteration. | |
| int | a_max |
| The (rotated) x coordinate of the end of the iteration. | |
| int | b_max |
| The (rotated) y coordinate of the end of the iteration. | |
Iterator to iterate over a diagonal area of the map.
Definition at line 45 of file tilearea_diagonal.h.
| using DiagonalTileArea::iterator::difference_type = std::ptrdiff_t |
difference_type iterator trait
Definition at line 57 of file tilearea_diagonal.h.
| using DiagonalTileArea::iterator::iterator_category = std::forward_iterator_tag |
iterator_category iterator trait
Definition at line 58 of file tilearea_diagonal.h.
| using DiagonalTileArea::iterator::pointer = void |
pointer iterator trait
Definition at line 59 of file tilearea_diagonal.h.
| using DiagonalTileArea::iterator::reference = void |
reference iterator trait
Definition at line 60 of file tilearea_diagonal.h.
value_type iterator trait
Definition at line 56 of file tilearea_diagonal.h.
|
inlineexplicit |
Construct the iterator.
| ta | Area, i.e. begin point and (diagonal) width/height of to-be-iterated area. |
Definition at line 66 of file tilearea_diagonal.h.
References DiagonalTileArea::a, a_cur, a_max, DiagonalTileArea::b, b_cur, b_max, base_x, base_y, DiagonalTileArea::DiagonalTileArea(), tile, TileX(), and TileY().
Referenced by operator==().
|
inline |
Get the current tile.
Definition at line 87 of file tilearea_diagonal.h.
| DiagonalTileArea::iterator & DiagonalTileArea::iterator::operator++ | ( | ) |
Increment the iterator and set it to the next position.
Definition at line 84 of file tilearea_diagonal.cpp.
References a_cur, a_max, abs(), b_cur, b_max, base_x, base_y, INVALID_TILE, Map::Size(), Map::SizeX(), Map::SizeY(), tile, and TileXY().
|
default |
Compare with other iterator.
true iff the other iterator matches this value. References iterator().
|
inline |
Compare with end sentinel.
true iff this iterator is at the end. Definition at line 78 of file tilearea_diagonal.h.
References INVALID_TILE.
|
private |
The current (rotated) x coordinate of the iteration.
Definition at line 50 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().
|
private |
The (rotated) x coordinate of the end of the iteration.
Definition at line 52 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().
|
private |
The current (rotated) y coordinate of the iteration.
Definition at line 51 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().
|
private |
The (rotated) y coordinate of the end of the iteration.
Definition at line 53 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().
|
private |
The base tile x coordinate from where the iterating happens.
Definition at line 48 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().
|
private |
The base tile y coordinate from where the iterating happens.
Definition at line 49 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().
|
private |
The current tile.
Definition at line 47 of file tilearea_diagonal.h.
Referenced by iterator(), and operator++().