mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix UB with super (fixes #3830)
This commit is contained in:
parent
a6c1139c91
commit
304d9f36ec
|
@ -1452,7 +1452,7 @@ bool CCharacter::IsSwitchActiveCb(int Number, void *pUser)
|
|||
{
|
||||
CCharacter *pThis = (CCharacter *)pUser;
|
||||
CCollision *pCollision = pThis->GameServer()->Collision();
|
||||
return pCollision->m_pSwitchers && pCollision->m_pSwitchers[Number].m_Status[pThis->Team()] && pThis->Team() != TEAM_SUPER;
|
||||
return pCollision->m_pSwitchers && pThis->Team() != TEAM_SUPER && pCollision->m_pSwitchers[Number].m_Status[pThis->Team()];
|
||||
}
|
||||
|
||||
void CCharacter::HandleTiles(int Index)
|
||||
|
|
|
@ -83,23 +83,26 @@ void CDoor::Snap(int SnappingClient)
|
|||
if(Char == 0)
|
||||
return;
|
||||
|
||||
if(Char->IsAlive() && GameServer()->Collision()->m_NumSwitchers > 0 && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()] && (!Tick))
|
||||
return;
|
||||
|
||||
if(Char->Team() == TEAM_SUPER)
|
||||
{
|
||||
pObj->m_FromX = (int)m_Pos.x;
|
||||
pObj->m_FromY = (int)m_Pos.y;
|
||||
}
|
||||
else if(Char->IsAlive() && GameServer()->Collision()->m_NumSwitchers > 0 && GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()])
|
||||
{
|
||||
pObj->m_FromX = (int)m_To.x;
|
||||
pObj->m_FromY = (int)m_To.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->m_FromX = (int)m_Pos.x;
|
||||
pObj->m_FromY = (int)m_Pos.y;
|
||||
if(Char->IsAlive() && GameServer()->Collision()->m_NumSwitchers > 0 && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()] && (!Tick))
|
||||
return;
|
||||
|
||||
if(Char->IsAlive() && GameServer()->Collision()->m_NumSwitchers > 0 && GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[Char->Team()])
|
||||
{
|
||||
pObj->m_FromX = (int)m_To.x;
|
||||
pObj->m_FromY = (int)m_To.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->m_FromX = (int)m_Pos.x;
|
||||
pObj->m_FromY = (int)m_Pos.y;
|
||||
}
|
||||
}
|
||||
pObj->m_StartTick = Server()->Tick();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue