Merge pull request #1564 from def-/pr-dummy-fixes

Some more dummy fixes (might fix #1415)
This commit is contained in:
Dennis Felsing 2019-04-03 19:02:28 +02:00 committed by GitHub
commit 1fd130cf15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View file

@ -347,6 +347,8 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta)
m_SnapshotStorage[1].Init();
m_ReceivedSnapshots[0] = 0;
m_ReceivedSnapshots[1] = 0;
m_SnapshotParts[0] = 0;
m_SnapshotParts[1] = 0;
m_VersionInfo.m_State = CVersionInfo::STATE_INIT;
@ -606,7 +608,7 @@ void CClient::OnEnterGame()
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV] = 0;
m_SnapshotStorage[g_Config.m_ClDummy].PurgeAll();
m_ReceivedSnapshots[g_Config.m_ClDummy] = 0;
m_SnapshotParts = 0;
m_SnapshotParts[g_Config.m_ClDummy] = 0;
m_PredTick[g_Config.m_ClDummy] = 0;
m_CurrentRecvTick[g_Config.m_ClDummy] = 0;
m_CurGameTick[g_Config.m_ClDummy] = 0;
@ -1767,14 +1769,14 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
{
if(GameTick != m_CurrentRecvTick[g_Config.m_ClDummy])
{
m_SnapshotParts = 0;
m_SnapshotParts[g_Config.m_ClDummy] = 0;
m_CurrentRecvTick[g_Config.m_ClDummy] = GameTick;
}
mem_copy((char*)m_aSnapshotIncomingData + Part*MAX_SNAPSHOT_PACKSIZE, pData, clamp(PartSize, 0, (int)sizeof(m_aSnapshotIncomingData) - Part*MAX_SNAPSHOT_PACKSIZE));
m_SnapshotParts |= 1<<Part;
m_SnapshotParts[g_Config.m_ClDummy] |= 1<<Part;
if(m_SnapshotParts == (unsigned)((1<<NumParts)-1))
if(m_SnapshotParts[g_Config.m_ClDummy] == (unsigned)((1<<NumParts)-1))
{
static CSnapshot Emptysnap;
CSnapshot *pDeltaShot = &Emptysnap;
@ -1789,7 +1791,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
CompleteSize = (NumParts-1) * MAX_SNAPSHOT_PACKSIZE + PartSize;
// reset snapshoting
m_SnapshotParts = 0;
m_SnapshotParts[g_Config.m_ClDummy] = 0;
// find snapshot that we should use as delta
Emptysnap.Clear();
@ -2039,14 +2041,14 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
{
if(GameTick != m_CurrentRecvTick[!g_Config.m_ClDummy])
{
m_SnapshotParts = 0;
m_SnapshotParts[!g_Config.m_ClDummy] = 0;
m_CurrentRecvTick[!g_Config.m_ClDummy] = GameTick;
}
mem_copy((char*)m_aSnapshotIncomingData + Part*MAX_SNAPSHOT_PACKSIZE, pData, clamp(PartSize, 0, (int)sizeof(m_aSnapshotIncomingData) - Part*MAX_SNAPSHOT_PACKSIZE));
m_SnapshotParts |= 1<<Part;
m_SnapshotParts[!g_Config.m_ClDummy] |= 1<<Part;
if(m_SnapshotParts == (unsigned)((1<<NumParts)-1))
if(m_SnapshotParts[!g_Config.m_ClDummy] == (unsigned)((1<<NumParts)-1))
{
static CSnapshot Emptysnap;
CSnapshot *pDeltaShot = &Emptysnap;
@ -2061,7 +2063,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
CompleteSize = (NumParts-1) * MAX_SNAPSHOT_PACKSIZE + PartSize;
// reset snapshoting
m_SnapshotParts = 0;
m_SnapshotParts[!g_Config.m_ClDummy] = 0;
// find snapshot that we should use as delta
Emptysnap.Clear();
@ -2719,7 +2721,6 @@ void CClient::InitInterfaces()
void CClient::Run()
{
m_LocalStartTime = time_get();
m_SnapshotParts = 0;
if(m_GenerateTimeoutSeed)
{

View file

@ -90,7 +90,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
char m_aServerAddressStr[256];
unsigned m_SnapshotParts;
unsigned m_SnapshotParts[2];
int64 m_LocalStartTime;
int m_DebugFont;