Add IsTeleTileNumberUsed function

To check whether the number of a tele tile is used or not.
This commit is contained in:
Robert Müller 2023-03-03 17:57:25 +01:00
parent 245703798b
commit 9c841f1e43
3 changed files with 8 additions and 5 deletions

View file

@ -1335,11 +1335,7 @@ bool CLayerTele::ContainsElementWithId(int Id)
{ {
for(int x = 0; x < m_Width; ++x) for(int x = 0; x < m_Width; ++x)
{ {
if(m_pTeleTile[y * m_Width + x].m_Type == TILE_TELECHECKIN) if(IsTeleTileNumberUsed(m_pTeleTile[y * m_Width + x].m_Type) && m_pTeleTile[y * m_Width + x].m_Number == Id)
continue;
if(m_pTeleTile[y * m_Width + x].m_Type == TILE_TELECHECKINEVIL)
continue;
if(m_pTeleTile[y * m_Width + x].m_Number == Id)
{ {
return true; return true;
} }

View file

@ -57,6 +57,12 @@ bool IsValidTeleTile(int Index)
Index == TILE_TELECHECKINEVIL); Index == TILE_TELECHECKINEVIL);
} }
bool IsTeleTileNumberUsed(int Index)
{
return Index != TILE_TELECHECKIN &&
Index != TILE_TELECHECKINEVIL;
}
bool IsValidSpeedupTile(int Index) bool IsValidSpeedupTile(int Index)
{ {
return Index == TILE_BOOST; return Index == TILE_BOOST;

View file

@ -489,6 +489,7 @@ public:
bool IsValidGameTile(int Index); bool IsValidGameTile(int Index);
bool IsValidFrontTile(int Index); bool IsValidFrontTile(int Index);
bool IsValidTeleTile(int Index); bool IsValidTeleTile(int Index);
bool IsTeleTileNumberUsed(int Index); // Assumes that Index is a valid tele tile index
bool IsValidSpeedupTile(int Index); bool IsValidSpeedupTile(int Index);
bool IsValidSwitchTile(int Index); bool IsValidSwitchTile(int Index);
bool IsValidTuneTile(int Index); bool IsValidTuneTile(int Index);