Made DemoFileReader::ReadUserCmd return length of usercmd instead of sequence number

This commit is contained in:
Jordan Cristiano 2015-05-27 22:57:30 -04:00
parent 803db77e49
commit 05d1518653
3 changed files with 7 additions and 9 deletions

View File

@ -60,15 +60,10 @@ void DemoFileReader::ReadCmdHeader(unsigned char& cmd, int32_t& tick)
} }
} }
int32_t DemoFileReader::ReadUserCmd(uint8_t* buffer, int32_t length) int32_t DemoFileReader::ReadUserCmd(int32_t& sequenceNum, uint8_t* buffer, int32_t length)
{ {
int32_t sequenceNum;
fread(&sequenceNum, sizeof(int32_t), 1, m_demoFp); fread(&sequenceNum, sizeof(int32_t), 1, m_demoFp);
if (ReadRawData(buffer, length) < 0) return ReadRawData(buffer, length);
{
return -1;
}
return sequenceNum;
} }
// DemoFileWriter // DemoFileWriter

View File

@ -17,7 +17,7 @@ public:
void ReadSequenceInfo(int32_t& seqNum1, int32_t& seqNum2); void ReadSequenceInfo(int32_t& seqNum1, int32_t& seqNum2);
void ReadCmdInfo(democmdinfo_t& info); void ReadCmdInfo(democmdinfo_t& info);
void ReadCmdHeader(unsigned char& cmd, int32_t& tick); void ReadCmdHeader(unsigned char& cmd, int32_t& tick);
int32_t ReadUserCmd(uint8_t* buffer, int32_t length); int32_t ReadUserCmd(int32_t& sequenceNum, uint8_t* buffer, int32_t length);
private: private:
FILE* m_demoFp; FILE* m_demoFp;

View File

@ -136,7 +136,10 @@ void DemoReader::ProcessDem(void* inputFp, IDemoWriter* writer)
reader.ReadRawData(nullptr, 1024); reader.ReadRawData(nullptr, 1024);
break; break;
case dem_usercmd: case dem_usercmd:
reader.ReadUserCmd(buffer.data(), 256); {
int32_t sequenceNum;
reader.ReadUserCmd(sequenceNum, buffer.get(), 256);
}
break; break;
case dem_datatables: case dem_datatables:
// TODO: datatables // TODO: datatables