Signal to stop reading demo if invalid command is found

This commit is contained in:
Jordan Cristiano 2015-07-13 23:08:05 -04:00
parent 2bf16179ad
commit f5d8d9bbf1

View File

@ -77,13 +77,9 @@ void DemoFileReader::ReadCmdInfo(democmdinfo_t& info)
void DemoFileReader::ReadCmdHeader(unsigned char& cmd, int32_t& tick)
{
FILE* fp = m_demoFp;
fread(&cmd, sizeof(unsigned char), 1, fp);
fread(&tick, sizeof(int32_t), 1, fp);
if (cmd >= 0)
{
assert(cmd <= dem_lastcmd);
}
else
fread(&cmd, 1, sizeof(unsigned char), fp);
fread(&tick, 1, sizeof(int32_t), fp);
if (cmd > dem_lastcmd)
{
cmd = dem_stop;
}