Use bool for IsCheckTeleport and IsCheckEvilTeleport

The tele tile number is not used for `TILE_TELECHECKIN` and `TILE_TELECHECKINEVIL` and the results of these functions were always implicitly converted to `bool` while assuming that the tele number was not `0` for these tiles.
This commit is contained in:
Robert Müller 2023-03-03 17:55:39 +01:00
parent c23c5d900e
commit 245703798b
2 changed files with 10 additions and 22 deletions

View file

@ -634,30 +634,18 @@ int CCollision::IsEvilTeleport(int Index) const
return 0; return 0;
} }
int CCollision::IsCheckTeleport(int Index) const bool CCollision::IsCheckTeleport(int Index) const
{ {
if(Index < 0) if(Index < 0 || !m_pTele)
return 0; return false;
if(!m_pTele) return m_pTele[Index].m_Type == TILE_TELECHECKIN;
return 0;
if(m_pTele[Index].m_Type == TILE_TELECHECKIN)
return m_pTele[Index].m_Number;
return 0;
} }
int CCollision::IsCheckEvilTeleport(int Index) const bool CCollision::IsCheckEvilTeleport(int Index) const
{ {
if(Index < 0) if(Index < 0 || !m_pTele)
return 0; return false;
if(!m_pTele) return m_pTele[Index].m_Type == TILE_TELECHECKINEVIL;
return 0;
if(m_pTele[Index].m_Type == TILE_TELECHECKINEVIL)
return m_pTele[Index].m_Number;
return 0;
} }
int CCollision::IsTeleCheckpoint(int Index) const int CCollision::IsTeleCheckpoint(int Index) const

View file

@ -84,8 +84,8 @@ public:
int GetFTileFlags(int Index) const; int GetFTileFlags(int Index) const;
int IsTeleport(int Index) const; int IsTeleport(int Index) const;
int IsEvilTeleport(int Index) const; int IsEvilTeleport(int Index) const;
int IsCheckTeleport(int Index) const; bool IsCheckTeleport(int Index) const;
int IsCheckEvilTeleport(int Index) const; bool IsCheckEvilTeleport(int Index) const;
int IsTeleportWeapon(int Index) const; int IsTeleportWeapon(int Index) const;
int IsTeleportHook(int Index) const; int IsTeleportHook(int Index) const;
int IsTeleCheckpoint(int Index) const; int IsTeleCheckpoint(int Index) const;