OpenTTD Source 20261112-master-gbcbec5e63f
DiagonalTileArea Class Reference

Represents a diagonal tile area. More...

#include <tilearea_diagonal.h>

Data Structures

class  iterator
 Iterator to iterate over a diagonal area of the map. More...

Public Member Functions

 DiagonalTileArea (TileIndex tile=INVALID_TILE, int16_t a=0, int16_t b=0)
 Construct this tile area with some set values.
 DiagonalTileArea (TileIndex start, TileIndex end)
 Create a diagonal tile area from two corners.
void Clear ()
 Clears the TileArea by making the tile invalid and setting a and b to 0.
bool Contains (TileIndex tile) const
 Does this tile area contain a tile?
iterator begin () const
 Returns an iterator to the start of the tile area.
std::default_sentinel_t end () const
 Returns an iterator to the end of the tile area.

Data Fields

TileIndex tile
 Base tile of the area.
int16_t a
 Extent in diagonal "x" direction (may be negative to signify the area stretches to the left).
int16_t b
 Extent in diagonal "y" direction (may be negative to signify the area stretches upwards).

Detailed Description

Represents a diagonal tile area.

Definition at line 16 of file tilearea_diagonal.h.

Constructor & Destructor Documentation

◆ DiagonalTileArea() [1/2]

DiagonalTileArea::DiagonalTileArea ( TileIndex tile = INVALID_TILE,
int16_t a = 0,
int16_t b = 0 )
inline

Construct this tile area with some set values.

Parameters
tileThe base tile.
aThe "x" extent.
bThe "y" extent.

Definition at line 28 of file tilearea_diagonal.h.

References a, b, INVALID_TILE, and tile.

Referenced by DiagonalTileArea::iterator::iterator().

◆ DiagonalTileArea() [2/2]

DiagonalTileArea::DiagonalTileArea ( TileIndex start,
TileIndex end )

Create a diagonal tile area from two corners.

Parameters
startFirst corner of the area.
endSecond corner of the area.

Definition at line 21 of file tilearea_diagonal.cpp.

References a, b, end(), Map::Size(), tile, TileX(), and TileY().

Member Function Documentation

◆ begin()

iterator DiagonalTileArea::begin ( ) const
inline

Returns an iterator to the start of the tile area.

Returns
The DiagonalTileIterator.

Definition at line 99 of file tilearea_diagonal.h.

◆ Clear()

void DiagonalTileArea::Clear ( )
inline

Clears the TileArea by making the tile invalid and setting a and b to 0.

Definition at line 35 of file tilearea_diagonal.h.

References INVALID_TILE.

◆ Contains()

bool DiagonalTileArea::Contains ( TileIndex tile) const

Does this tile area contain a tile?

Parameters
tileTile to test for.
Returns
True if the tile is inside the area.

Definition at line 54 of file tilearea_diagonal.cpp.

References a, b, tile, TileX(), and TileY().

◆ end()

std::default_sentinel_t DiagonalTileArea::end ( ) const
inline

Returns an iterator to the end of the tile area.

Returns
The iterator.

Definition at line 108 of file tilearea_diagonal.h.

Referenced by DiagonalTileArea().

Field Documentation

◆ a

int16_t DiagonalTileArea::a

Extent in diagonal "x" direction (may be negative to signify the area stretches to the left).

Definition at line 19 of file tilearea_diagonal.h.

Referenced by Contains(), DiagonalTileArea(), DiagonalTileArea(), and DiagonalTileArea::iterator::iterator().

◆ b

int16_t DiagonalTileArea::b

Extent in diagonal "y" direction (may be negative to signify the area stretches upwards).

Definition at line 20 of file tilearea_diagonal.h.

Referenced by Contains(), DiagonalTileArea(), DiagonalTileArea(), and DiagonalTileArea::iterator::iterator().

◆ tile

TileIndex DiagonalTileArea::tile

Base tile of the area.

Definition at line 18 of file tilearea_diagonal.h.

Referenced by Contains(), DiagonalTileArea(), and DiagonalTileArea().


The documentation for this class was generated from the following files: