stmm-games-doc  0.32.0
Classes | Public Member Functions | List of all members
stmg::TileCoords Class Reference
Inheritance diagram for stmg::TileCoords:
Inheritance graph
[legend]

Classes

class  const_iterator
 TileCoords iterator. More...
 

Public Member Functions

 TileCoords () noexcept
 Constructor. More...
 
 TileCoords (int32_t nAtLeastSize) noexcept
 Constructor. More...
 
void reInit (int32_t nAtLeastSize) noexcept
 Clears the instance. More...
 
void add (int32_t nX, int32_t nY, const Tile &oTile) noexcept
 Add a tile coord. More...
 
void add (NPoint oXY, const Tile &oTile) noexcept
 Add a tile coord. More...
 
void addRect (int32_t nX, int32_t nY, int32_t nW, int32_t nH, const Tile &oTile) noexcept
 Set tile for all coords in a rectangle. More...
 
void addRect (NRect oRect, const Tile &oTile) noexcept
 Set tile for all coords in a rectangle. More...
 
std::pair< bool, TilegetTile (int32_t nX, int32_t nY) const noexcept
 Whether the instance contains a tile at a position. More...
 
std::pair< bool, TilegetTile (NPoint oXY) const noexcept
 Whether the instance contains a tile at a position. More...
 
void add (const TileCoords &oTileCoords) noexcept
 Add another coords to this instance. More...
 
void remove (const Coords &oCoords) noexcept
 Remove all the coords of another instance,. More...
 
TileCoords::const_iterator begin () noexcept
 
TileCoords::const_iterator begin () const noexcept
 
TileCoords::const_iterator end () noexcept
 
TileCoords::const_iterator end () const noexcept
 
- Public Member Functions inherited from stmg::Coords
 Coords () noexcept
 Constructor. More...
 
 Coords (int32_t nAtLeastSize) noexcept
 Constructor. More...
 
void reInit () noexcept
 Clears the instance. More...
 
void reInit (int32_t nAtLeastSize) noexcept
 Clears the instance. More...
 
int32_t size () const noexcept
 The number of (unique) coords in the instance. More...
 
bool isEmpty () const noexcept
 Whether set is empty. More...
 
void add (int32_t nX, int32_t nY) noexcept
 Add a coord. More...
 
void add (NPoint oXY) noexcept
 Add a coord. More...
 
void addRect (int32_t nX, int32_t nY, int32_t nW, int32_t nH) noexcept
 Add all cords in a rectangle. More...
 
void addRect (NRect oRect) noexcept
 Add all cords in a rectangle. More...
 
bool contains (int32_t nX, int32_t nY) const noexcept
 Whether the instance contains a coord. More...
 
bool contains (NPoint oXY) const noexcept
 Whether the instance contains a coord. More...
 
bool remove (int32_t nX, int32_t nY) noexcept
 Removes a coord if it exists. More...
 
bool remove (NPoint oXY) noexcept
 Removes a coord if it exists. More...
 
void removeInRect (int32_t nX, int32_t nY, int32_t nW, int32_t nH) noexcept
 Remove all coords within a rect. More...
 
void removeInRect (NRect oRect) noexcept
 Add all cords in a rectangle. More...
 
NRect getMinMax () const noexcept
 Get the smallest recangle containing all the coords. More...
 
void add (const Coords &oCoords) noexcept
 Add another coords to this instance. More...
 
void remove (const Coords &oCoords) noexcept
 Remove all the coords of another instance,. More...
 
const_iterator begin () const noexcept
 
Coords::const_iterator end () const noexcept
 
bool remove (const const_iterator &it) noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from stmg::Coords
 Coords (bool bTileCoords) noexcept
 
 Coords (bool bTileCoords, int32_t nAtLeastSize) noexcept
 
const_iterator find (int32_t nX, int32_t nY) const noexcept
 Returns the iterator. More...
 
int32_t & getOrCreate (NPoint oXY) noexcept
 
void clearData (int32_t nAtLeastSize) noexcept
 

Constructor & Destructor Documentation

◆ TileCoords() [1/2]

stmg::TileCoords::TileCoords ( )
noexcept

Constructor.

◆ TileCoords() [2/2]

stmg::TileCoords::TileCoords ( int32_t  nAtLeastSize)
explicitnoexcept

Constructor.

Parameters
nAtLeastSizeThe indicative minimum number of unique values.

Member Function Documentation

◆ add() [1/3]

void stmg::TileCoords::add ( int32_t  nX,
int32_t  nY,
const Tile oTile 
)
noexcept

Add a tile coord.

If the tile already exists at the position overwrites it.

Might invalidate iterators.

Parameters
nXThe x.
nYThe y.
oTileThe tile.

◆ add() [2/3]

void stmg::TileCoords::add ( NPoint  oXY,
const Tile oTile 
)
noexcept

Add a tile coord.

If the tile already exists at the position overwrites it.

Might invalidate iterators.

Parameters
oXYThe coord to add.
oTileThe tile.

◆ add() [3/3]

void stmg::TileCoords::add ( const TileCoords oTileCoords)
noexcept

Add another coords to this instance.

Parameters
oTileCoordsThee coords to add.

◆ addRect() [1/2]

void stmg::TileCoords::addRect ( int32_t  nX,
int32_t  nY,
int32_t  nW,
int32_t  nH,
const Tile oTile 
)
noexcept

Set tile for all coords in a rectangle.

If tiles already exist at some position overwrites them.

Might invalidate iterators.

Parameters
nXThe x.
nYThe y.
nWThe width. Must be > 0.
nHThe height. Must be > 0.
oTileThe tile.

◆ addRect() [2/2]

void stmg::TileCoords::addRect ( NRect  oRect,
const Tile oTile 
)
noexcept

Set tile for all coords in a rectangle.

If tiles already exist at some position overwrites them.

Might invalidate iterators.

Parameters
oRectThe rectangle.
oTileThe tile.

◆ begin() [1/2]

TileCoords::const_iterator stmg::TileCoords::begin ( )
inlinenoexcept

◆ begin() [2/2]

TileCoords::const_iterator stmg::TileCoords::begin ( ) const
inlinenoexcept

◆ end() [1/2]

TileCoords::const_iterator stmg::TileCoords::end ( )
inlinenoexcept

◆ end() [2/2]

TileCoords::const_iterator stmg::TileCoords::end ( ) const
inlinenoexcept

◆ getTile() [1/2]

std::pair<bool, Tile> stmg::TileCoords::getTile ( int32_t  nX,
int32_t  nY 
) const
noexcept

Whether the instance contains a tile at a position.

Parameters
nXThe x.
nYThe y.
Returns
Whether the instance contains the tile and the tile itself.

◆ getTile() [2/2]

std::pair<bool, Tile> stmg::TileCoords::getTile ( NPoint  oXY) const
noexcept

Whether the instance contains a tile at a position.

Parameters
oXYThe coord.
Returns
Whether the instance contains the tile aand the tile itself.

◆ reInit()

void stmg::TileCoords::reInit ( int32_t  nAtLeastSize)
noexcept

Clears the instance.

All iterators become invalid.

Parameters
nAtLeastSizeThe indicative minimum number of unique values.

◆ remove()

void stmg::TileCoords::remove ( const Coords oCoords)
noexcept

Remove all the coords of another instance,.

Parameters
oCoordsThe coords to remove.