10#ifndef TILEAREA_SPIRAL_H
11#define TILEAREA_SPIRAL_H
38 return this->
x == rhs.
x && this->
y == rhs.
y;
165 std::default_sentinel_t
end()
const
167 return std::default_sentinel_t();
Helper class for SpiralTileSequence.
SpiralTileIterator(TileIndex center, uint diameter)
Create the iterator.
void InitPosition()
Initialise "position" after "dir" was changed.
const uint max_radius
The maximum radius of the spiral.
bool IsEnd() const
Test whether the iterator reached the end.
SpiralTileIterator & operator++()
Increment the iterator and set it to the next position.
DiagDirection dir
The current spiral direction.
DiagDirectionIndexArray< uint > extent
Size of hole in the centre of the spiral.
void Increment()
Advance the internal state to the next potential tile.
bool operator==(const SpiralTileIterator &rhs) const
Compare with other iterator.
void SkipOutsideMap()
Advance the internal state until it reaches a valid tile or the end.
uint position
The current position along an edge.
bool operator==(const std::default_sentinel_t &) const
Compare with end sentinel.
std::ptrdiff_t difference_type
difference_type iterator trait
uint x
The current tile X-coordinate.
void pointer
pointer iterator trait
TileIndex value_type
value_type iterator trait
uint cur_radius
The current radius.
std::forward_iterator_tag iterator_category
iterator_category iterator trait
TileIndex operator*() const
Get the current tile.
void reference
reference iterator trait
uint y
The current tile Y-coordinate.
SpiralTileIterator begin() const
Returns an iterator to the start of the tile area.
SpiralTileSequence(TileIndex center, uint diameter)
Generate TileIndices for a square area around a center tile.
SpiralTileSequence(TileIndex start_north, uint radius, uint w, uint h)
Generate TileIndices for a rectangular area with an optional rectangular hole in the center.
std::default_sentinel_t end() const
Returns an iterator to the end of the tile area.
SpiralTileIterator start
The starting iterator for thi spiral sequence.
SpiralTileIterator iterator
The tile iterator type for this tile area type.
Different types to 'show' directions.
EnumIndexArray< T, DiagDirection, DiagDirection::End > DiagDirectionIndexArray
Array with DiagDirection as index.
DiagDirection
Enumeration for diagonal directions.
@ Invalid
Flag for an invalid DiagDirection.
Functions related to maps.
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.