59 int start_a =
TileY(this->tile) +
TileX(this->tile);
60 int start_b =
TileY(this->tile) -
TileX(this->tile);
62 int end_a = start_a + this->a;
63 int end_b = start_b + this->b;
66 if (start_a > end_a) {
71 if (start_b > end_b) {
89 bool new_line =
false;
95 if (this->
b_max > 0) {
102 if (this->
a_max > 0) {
115 if (this->
b_max > 0) {
Iterator to iterate over a diagonal area of the map.
uint base_y
The base tile y coordinate from where the iterating happens.
iterator & operator++()
Increment the iterator and set it to the next position.
int b_max
The (rotated) y coordinate of the end of the iteration.
int a_max
The (rotated) x coordinate of the end of the iteration.
uint base_x
The base tile x coordinate from where the iterating happens.
int b_cur
The current (rotated) y coordinate of the iteration.
TileIndex tile
The current tile.
int a_cur
The current (rotated) x coordinate of the iteration.
int16_t b
Extent in diagonal "y" direction (may be negative to signify the area stretches upwards).
bool Contains(TileIndex tile) const
Does this tile area contain a tile?
int16_t a
Extent in diagonal "x" direction (may be negative to signify the area stretches to the left).
TileIndex tile
Base tile of the area.
std::default_sentinel_t end() const
Returns an iterator to the end of the tile area.
DiagonalTileArea(TileIndex tile=INVALID_TILE, int16_t a=0, int16_t b=0)
Construct this tile area with some set values.
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static uint TileX(TileIndex tile)
Get the X component of a tile.
constexpr T abs(const T a)
Returns the absolute value of (scalar) variable.
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.
static uint Size()
Get the size of the map.
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.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Type for storing and iterating a diagonal tile area.