diff --git a/src/game/editor/layer_tiles.cpp b/src/game/editor/layer_tiles.cpp index a7d2165af..286c3536e 100644 --- a/src/game/editor/layer_tiles.cpp +++ b/src/game/editor/layer_tiles.cpp @@ -1335,11 +1335,7 @@ bool CLayerTele::ContainsElementWithId(int Id) { for(int x = 0; x < m_Width; ++x) { - if(m_pTeleTile[y * m_Width + x].m_Type == TILE_TELECHECKIN) - continue; - if(m_pTeleTile[y * m_Width + x].m_Type == TILE_TELECHECKINEVIL) - continue; - if(m_pTeleTile[y * m_Width + x].m_Number == Id) + if(IsTeleTileNumberUsed(m_pTeleTile[y * m_Width + x].m_Type) && m_pTeleTile[y * m_Width + x].m_Number == Id) { return true; } diff --git a/src/game/mapitems.cpp b/src/game/mapitems.cpp index d683cd7cf..c65c42031 100644 --- a/src/game/mapitems.cpp +++ b/src/game/mapitems.cpp @@ -57,6 +57,12 @@ bool IsValidTeleTile(int Index) Index == TILE_TELECHECKINEVIL); } +bool IsTeleTileNumberUsed(int Index) +{ + return Index != TILE_TELECHECKIN && + Index != TILE_TELECHECKINEVIL; +} + bool IsValidSpeedupTile(int Index) { return Index == TILE_BOOST; diff --git a/src/game/mapitems.h b/src/game/mapitems.h index a3cbf6ee0..b778c322b 100644 --- a/src/game/mapitems.h +++ b/src/game/mapitems.h @@ -489,6 +489,7 @@ public: bool IsValidGameTile(int Index); bool IsValidFrontTile(int Index); bool IsValidTeleTile(int Index); +bool IsTeleTileNumberUsed(int Index); // Assumes that Index is a valid tele tile index bool IsValidSpeedupTile(int Index); bool IsValidSwitchTile(int Index); bool IsValidTuneTile(int Index);