Clarify teehistorian code

This commit is contained in:
Zwelf 2021-01-28 22:19:16 +01:00
parent 04e8ce56a9
commit 80df59ba5a

View file

@ -47,7 +47,7 @@ void CTeeHistorian::Reset(const CGameInfo *pGameInfo, WRITE_CALLBACK pfnWriteCal
// Tick 0 is implicit at the start, game starts as tick 1.
m_TickWritten = true;
m_MaxClientID = MAX_CLIENTS;
// `m_PrevMaxClientID` is initialized in `BeginTick`
// `m_PrevMaxClientID` is initialized in `BeginPlayers`
for(auto &PrevPlayer : m_aPrevPlayers)
{
PrevPlayer.m_Alive = false;
@ -204,6 +204,8 @@ void CTeeHistorian::BeginPlayers()
dbg_assert(m_State == STATE_BEFORE_PLAYERS, "invalid teehistorian state");
m_PrevMaxClientID = m_MaxClientID;
// ensure that PLAYER_{DIFF, NEW, OLD} don't cause an implicit tick after a TICK_SKIP
// by not overwriting m_MaxClientID during RecordPlayer
m_MaxClientID = -1;
m_State = STATE_PLAYERS;