Fix server crash with too many items (fixes #3477)

This commit is contained in:
def 2021-01-05 19:09:29 +01:00
parent 71a371a4ee
commit 5c4fc9471a

View file

@ -404,6 +404,8 @@ void CPlayer::Snap(int SnappingClient)
GameServer()->m_apPlayers[SnappingClient]->m_TimerType == TIMERTYPE_SIXUP) GameServer()->m_apPlayers[SnappingClient]->m_TimerType == TIMERTYPE_SIXUP)
{ {
protocol7::CNetObj_PlayerInfoRace *pRaceInfo = static_cast<protocol7::CNetObj_PlayerInfoRace *>(Server()->SnapNewItem(-protocol7::NETOBJTYPE_PLAYERINFORACE, id, sizeof(protocol7::CNetObj_PlayerInfoRace))); protocol7::CNetObj_PlayerInfoRace *pRaceInfo = static_cast<protocol7::CNetObj_PlayerInfoRace *>(Server()->SnapNewItem(-protocol7::NETOBJTYPE_PLAYERINFORACE, id, sizeof(protocol7::CNetObj_PlayerInfoRace)));
if(!pRaceInfo)
return;
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime; pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
} }
@ -418,6 +420,9 @@ void CPlayer::Snap(int SnappingClient)
if(ShowSpec) if(ShowSpec)
{ {
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar))); CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
if(!pSpecChar)
return;
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x; pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y; pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
} }