23 if (diameter % 2 == 1) {
36 this->
x =
TileX(center) + 1;
75 assert(!this->
IsEnd());
@ Begin
Used for iteration.
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.
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.
void SkipOutsideMap()
Advance the internal state until it reaches a valid tile or the end.
uint position
The current position along an edge.
uint x
The current tile X-coordinate.
uint cur_radius
The current radius.
uint y
The current tile Y-coordinate.
DiagDirection
Enumeration for diagonal directions.
@ Begin
Used for iterations.
@ Invalid
Flag for an invalid DiagDirection.
@ End
Used for iterations.
Functions related to maps.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
TileIndexDiffC TileIndexDiffCByDiagDir(DiagDirection dir)
Returns the TileIndexDiffC offset from a DiagDirection.
static uint TileX(TileIndex tile)
Get the X component of a tile.
TileIndexDiffC TileIndexDiffCByDir(Direction dir)
Returns the TileIndexDiffC offset from a Direction.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
static uint SizeX()
Get the size of the map along the X.
static uint SizeY()
Get the size of the map along the Y.
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.
Type for iterating a sprial tile area.