Style cleanup

This commit is contained in:
def 2016-01-23 21:44:45 +01:00
parent 51504d2bd2
commit 52224875b4
2 changed files with 20 additions and 24 deletions

View file

@ -336,8 +336,8 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta)
mem_zero(m_aSnapshots, sizeof(m_aSnapshots));
m_SnapshotStorage[0].Init();
m_SnapshotStorage[1].Init();
m_RecivedSnapshots[0] = 0;
m_RecivedSnapshots[1] = 0;
m_ReceivedSnapshots[0] = 0;
m_ReceivedSnapshots[1] = 0;
m_VersionInfo.m_State = CVersionInfo::STATE_INIT;
@ -650,7 +650,7 @@ void CClient::OnEnterGame()
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] = 0;
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV] = 0;
m_SnapshotStorage[g_Config.m_ClDummy].PurgeAll();
m_RecivedSnapshots[g_Config.m_ClDummy] = 0;
m_ReceivedSnapshots[g_Config.m_ClDummy] = 0;
m_SnapshotParts = 0;
m_PredTick[g_Config.m_ClDummy] = 0;
m_CurrentRecvTick[g_Config.m_ClDummy] = 0;
@ -750,7 +750,7 @@ void CClient::DisconnectWithReason(const char *pReason)
// clear snapshots
m_aSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] = 0;
m_aSnapshots[g_Config.m_ClDummy][SNAP_PREV] = 0;
m_RecivedSnapshots[g_Config.m_ClDummy] = 0;
m_ReceivedSnapshots[g_Config.m_ClDummy] = 0;
}
void CClient::Disconnect()
@ -1090,7 +1090,7 @@ const char *CClient::LoadMap(const char *pName, const char *pFilename, unsigned
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "loaded map '%s'", pFilename);
m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client", aBuf);
m_RecivedSnapshots[g_Config.m_ClDummy] = 0;
m_ReceivedSnapshots[g_Config.m_ClDummy] = 0;
str_copy(m_aCurrentMap, pName, sizeof(m_aCurrentMap));
m_CurrentMapCrc = m_pMap->Crc();
@ -1715,7 +1715,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
}
// TODO: clean this up abit
mem_copy((char*)m_aSnapshotIncommingData + Part*MAX_SNAPSHOT_PACKSIZE, pData, PartSize);
mem_copy((char*)m_aSnapshotIncomingData + Part*MAX_SNAPSHOT_PACKSIZE, pData, PartSize);
m_SnapshotParts |= 1<<Part;
if(m_SnapshotParts == (unsigned)((1<<NumParts)-1))
@ -1767,7 +1767,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
if(CompleteSize)
{
int IntSize = CVariableInt::Decompress(m_aSnapshotIncommingData, CompleteSize, aTmpBuffer2);
int IntSize = CVariableInt::Decompress(m_aSnapshotIncomingData, CompleteSize, aTmpBuffer2);
if(IntSize < 0) // failure during decompression, bail
return;
@ -1840,12 +1840,12 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
}
// apply snapshot, cycle pointers
m_RecivedSnapshots[g_Config.m_ClDummy]++;
m_ReceivedSnapshots[g_Config.m_ClDummy]++;
m_CurrentRecvTick[g_Config.m_ClDummy] = GameTick;
// we got two snapshots until we see us self as connected
if(m_RecivedSnapshots[g_Config.m_ClDummy] == 2)
if(m_ReceivedSnapshots[g_Config.m_ClDummy] == 2)
{
// start at 200ms and work from there
m_PredictedTime.Init(GameTick*time_freq()/50);
@ -1859,7 +1859,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
}
// adjust game time
if(m_RecivedSnapshots[g_Config.m_ClDummy] > 2)
if(m_ReceivedSnapshots[g_Config.m_ClDummy] > 2)
{
int64 Now = m_GameTime[g_Config.m_ClDummy].Get(time_get());
int64 TickStart = GameTick*time_freq()/50;
@ -1867,7 +1867,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
m_GameTime[g_Config.m_ClDummy].Update(&m_GametimeMarginGraph, (GameTick-1)*time_freq()/50, TimeLeft, 0);
}
if(m_RecivedSnapshots[g_Config.m_ClDummy] > 50 && !m_TimeoutCodeSent[g_Config.m_ClDummy])
if(m_ReceivedSnapshots[g_Config.m_ClDummy] > 50 && !m_TimeoutCodeSent[g_Config.m_ClDummy])
{
if(IsDDNet(&m_CurrentServerInfo))
{
@ -1971,7 +1971,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
}
// TODO: clean this up abit
mem_copy((char*)m_aSnapshotIncommingData + Part*MAX_SNAPSHOT_PACKSIZE, pData, PartSize);
mem_copy((char*)m_aSnapshotIncomingData + Part*MAX_SNAPSHOT_PACKSIZE, pData, PartSize);
m_SnapshotParts |= 1<<Part;
if(m_SnapshotParts == (unsigned)((1<<NumParts)-1))
@ -2023,7 +2023,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
if(CompleteSize)
{
int IntSize = CVariableInt::Decompress(m_aSnapshotIncommingData, CompleteSize, aTmpBuffer2);
int IntSize = CVariableInt::Decompress(m_aSnapshotIncomingData, CompleteSize, aTmpBuffer2);
if(IntSize < 0) // failure during decompression, bail
return;
@ -2078,12 +2078,12 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
m_SnapshotStorage[!g_Config.m_ClDummy].Add(GameTick, time_get(), SnapSize, pTmpBuffer3, 1);
// apply snapshot, cycle pointers
m_RecivedSnapshots[!g_Config.m_ClDummy]++;
m_ReceivedSnapshots[!g_Config.m_ClDummy]++;
m_CurrentRecvTick[!g_Config.m_ClDummy] = GameTick;
// we got two snapshots until we see us self as connected
if(m_RecivedSnapshots[!g_Config.m_ClDummy] == 2)
if(m_ReceivedSnapshots[!g_Config.m_ClDummy] == 2)
{
// start at 200ms and work from there
//m_PredictedTime[!g_Config.m_ClDummy].Init(GameTick*time_freq()/50);
@ -2096,7 +2096,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
}
// adjust game time
if(m_RecivedSnapshots[!g_Config.m_ClDummy] > 2)
if(m_ReceivedSnapshots[!g_Config.m_ClDummy] > 2)
{
int64 Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get());
int64 TickStart = GameTick*time_freq()/50;
@ -2300,16 +2300,12 @@ void CClient::Update()
Disconnect();
}
}
else if(State() == IClient::STATE_ONLINE && m_RecivedSnapshots[g_Config.m_ClDummy] >= 3)
else if(State() == IClient::STATE_ONLINE && m_ReceivedSnapshots[g_Config.m_ClDummy] >= 3)
{
if(m_RecivedSnapshots[!g_Config.m_ClDummy] >= 3)
if(m_ReceivedSnapshots[!g_Config.m_ClDummy] >= 3)
{
// switch dummy snapshot
int Repredict = 0;
int64 Freq = time_freq();
int64 Now = m_GameTime[!g_Config.m_ClDummy].Get(time_get());
int64 PredNow = m_PredictedTime.Get(time_get());
while(1)
{
CSnapshotStorage::CHolder *pCur = m_aSnapshots[!g_Config.m_ClDummy][SNAP_CURRENT];

View file

@ -161,8 +161,8 @@ class CClient : public IClient, public CDemoPlayer::IListner
class CSnapshotStorage m_SnapshotStorage[2];
CSnapshotStorage::CHolder *m_aSnapshots[2][NUM_SNAPSHOT_TYPES];
int m_RecivedSnapshots[2];
char m_aSnapshotIncommingData[CSnapshot::MAX_SIZE];
int m_ReceivedSnapshots[2];
char m_aSnapshotIncomingData[CSnapshot::MAX_SIZE];
class CSnapshotStorage::CHolder m_aDemorecSnapshotHolders[NUM_SNAPSHOT_TYPES];
char *m_aDemorecSnapshotData[NUM_SNAPSHOT_TYPES][2][CSnapshot::MAX_SIZE];