OpenTTD Source 20261112-master-gbcbec5e63f
AirportTileTableIterator Class Reference

Iterator to iterate over all tiles belonging to an airport spec. More...

#include <tilearea_airportlayout.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

 AirportTileTableIterator (std::span< const AirportTileTable > att, TileIndex base_tile, bool include_special)
 Construct the iterator.
bool operator== (const AirportTileTableIterator &other) const
 Compare with other iterator.
bool operator== (const std::default_sentinel_t &) const
 Compare with end sentinel.
TileIndex operator* () const
 Get the current tile.
AirportTileTableIterator & operator++ ()
 Increment the iterator and set it to the next position.
AirportGfx GetAirportGfx () const
 Get the AirportGfx for the current tile.

Private Attributes

std::span< const AirportTileTable > att
 The offsets.
std::span< constAirportTileTable >::iterator iter
 Underlying tile area.
TileIndex base_tile
 The tile we base the offsets off.
TileIndex tile
 The current file.
bool include_special
 Include special tiles.

Detailed Description

Iterator to iterate over all tiles belonging to an airport spec.

Definition at line 16 of file tilearea_airportlayout.h.

Member Typedef Documentation

◆ difference_type

difference_type iterator trait

Definition at line 26 of file tilearea_airportlayout.h.

◆ iterator_category

using AirportTileTableIterator::iterator_category = std::forward_iterator_tag

iterator_category iterator trait

Definition at line 27 of file tilearea_airportlayout.h.

◆ pointer

pointer iterator trait

Definition at line 28 of file tilearea_airportlayout.h.

◆ reference

reference iterator trait

Definition at line 29 of file tilearea_airportlayout.h.

◆ value_type

value_type iterator trait

Definition at line 25 of file tilearea_airportlayout.h.

Constructor & Destructor Documentation

◆ AirportTileTableIterator()

AirportTileTableIterator::AirportTileTableIterator ( std::span< const AirportTileTable > att,
TileIndex base_tile,
bool include_special )
inline

Construct the iterator.

Parameters
attThe TileTable we want to iterate over.
base_tileThe basetile for all offsets.
include_specialInclude special clearance check tiles when iterating the layout.

Definition at line 37 of file tilearea_airportlayout.h.

References att, base_tile, include_special, iter, tile, and ToTileIndexDiff().

Referenced by operator++(), and operator==().

Member Function Documentation

◆ GetAirportGfx()

AirportGfx AirportTileTableIterator::GetAirportGfx ( ) const
inline

Get the AirportGfx for the current tile.

Returns
The identifier of the graphics for this tile.

Definition at line 88 of file tilearea_airportlayout.h.

Referenced by CheckFlatLandAirport(), and operator++().

◆ operator*()

TileIndex AirportTileTableIterator::operator* ( ) const
inline

Get the current tile.

Returns
The current tile, or INVALID_TILE when complete.

Definition at line 62 of file tilearea_airportlayout.h.

◆ operator++()

AirportTileTableIterator & AirportTileTableIterator::operator++ ( )
inline

Increment the iterator and set it to the next position.

Returns
This iterator after incrementing.

Definition at line 71 of file tilearea_airportlayout.h.

References AIRPORTGFX_CLEARTILE_SPECIALCHECK, AirportTileTableIterator(), att, GetAirportGfx(), INVALID_TILE, and ToTileIndexDiff().

◆ operator==() [1/2]

bool AirportTileTableIterator::operator== ( const AirportTileTableIterator & other) const
inline

Compare with other iterator.

Parameters
otherThe other iterator to compare with.
Returns
true iff the other iterator matches this value.

Definition at line 44 of file tilearea_airportlayout.h.

References AirportTileTableIterator(), base_tile, and tile.

◆ operator==() [2/2]

bool AirportTileTableIterator::operator== ( const std::default_sentinel_t & ) const
inline

Compare with end sentinel.

Returns
true iff this iterator is at the end.

Definition at line 53 of file tilearea_airportlayout.h.

References INVALID_TILE.

Field Documentation

◆ att

std::span<const AirportTileTable> AirportTileTableIterator::att
private

The offsets.

Definition at line 18 of file tilearea_airportlayout.h.

Referenced by AirportTileTableIterator(), and operator++().

◆ base_tile

TileIndex AirportTileTableIterator::base_tile
private

The tile we base the offsets off.

Definition at line 20 of file tilearea_airportlayout.h.

Referenced by AirportTileTableIterator(), and operator==().

◆ include_special

bool AirportTileTableIterator::include_special
private

Include special tiles.

Definition at line 22 of file tilearea_airportlayout.h.

Referenced by AirportTileTableIterator().

◆ iter

std::span<constAirportTileTable>::iterator AirportTileTableIterator::iter
private

Underlying tile area.

Definition at line 19 of file tilearea_airportlayout.h.

Referenced by AirportTileTableIterator().

◆ tile

TileIndex AirportTileTableIterator::tile
private

The current file.

Definition at line 21 of file tilearea_airportlayout.h.

Referenced by AirportTileTableIterator(), and operator==().


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