diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 5236012db..f7749f34b 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3850,22 +3850,17 @@ const char *CClient::DemoPlayer_Play(const char *pFilename, int StorageType) GameClient()->OnConnected(); // setup buffers - mem_zero(m_aaapDemorecSnapshotData, sizeof(m_aaapDemorecSnapshotData)); + mem_zero(m_aaaDemorecSnapshotData, sizeof(m_aaaDemorecSnapshotData)); - m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT] = &m_aDemorecSnapshotHolders[SNAP_CURRENT]; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV] = &m_aDemorecSnapshotHolders[SNAP_PREV]; - - m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_pSnap = (CSnapshot *)m_aaapDemorecSnapshotData[SNAP_CURRENT][0]; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_pAltSnap = (CSnapshot *)m_aaapDemorecSnapshotData[SNAP_CURRENT][1]; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_SnapSize = 0; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_AltSnapSize = 0; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_CURRENT]->m_Tick = -1; - - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_pSnap = (CSnapshot *)m_aaapDemorecSnapshotData[SNAP_PREV][0]; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_pAltSnap = (CSnapshot *)m_aaapDemorecSnapshotData[SNAP_PREV][1]; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_SnapSize = 0; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_AltSnapSize = 0; - m_aapSnapshots[g_Config.m_ClDummy][SNAP_PREV]->m_Tick = -1; + for(int SnapshotType = 0; SnapshotType < NUM_SNAPSHOT_TYPES; SnapshotType++) + { + m_aapSnapshots[g_Config.m_ClDummy][SnapshotType] = &m_aDemorecSnapshotHolders[SnapshotType]; + m_aapSnapshots[g_Config.m_ClDummy][SnapshotType]->m_pSnap = (CSnapshot *)&m_aaaDemorecSnapshotData[SnapshotType][0]; + m_aapSnapshots[g_Config.m_ClDummy][SnapshotType]->m_pAltSnap = (CSnapshot *)&m_aaaDemorecSnapshotData[SnapshotType][1]; + m_aapSnapshots[g_Config.m_ClDummy][SnapshotType]->m_SnapSize = 0; + m_aapSnapshots[g_Config.m_ClDummy][SnapshotType]->m_AltSnapSize = 0; + m_aapSnapshots[g_Config.m_ClDummy][SnapshotType]->m_Tick = -1; + } // enter demo playback state SetState(IClient::STATE_DEMOPLAYBACK); diff --git a/src/engine/client/client.h b/src/engine/client/client.h index d327f7c5d..666dbd570 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -240,7 +240,7 @@ class CClient : public IClient, public CDemoPlayer::IListener int m_aSnapshotIncomingDataSize[NUM_DUMMIES]; CSnapshotStorage::CHolder m_aDemorecSnapshotHolders[NUM_SNAPSHOT_TYPES]; - char *m_aaapDemorecSnapshotData[NUM_SNAPSHOT_TYPES][2][CSnapshot::MAX_SIZE]; + char m_aaaDemorecSnapshotData[NUM_SNAPSHOT_TYPES][2][CSnapshot::MAX_SIZE]; CSnapshotDelta m_SnapshotDelta; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 5e40c8478..8571e4be3 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3594,15 +3594,15 @@ void CGameContext::OnMapChange(char *pNewMapName, int MapNameSize) { int TypeID; int ItemID; - int *pData = (int *)Reader.GetItem(i, &TypeID, &ItemID); + void *pData = Reader.GetItem(i, &TypeID, &ItemID); int Size = Reader.GetItemSize(i); CMapItemInfoSettings MapInfo; if(TypeID == MAPITEMTYPE_INFO && ItemID == 0) { FoundInfo = true; - CMapItemInfoSettings *pInfo = (CMapItemInfoSettings *)pData; if(Size >= (int)sizeof(CMapItemInfoSettings)) { + CMapItemInfoSettings *pInfo = (CMapItemInfoSettings *)pData; if(pInfo->m_Settings > -1) { SettingsIndex = pInfo->m_Settings; @@ -3620,15 +3620,15 @@ void CGameContext::OnMapChange(char *pNewMapName, int MapNameSize) { MapInfo = *pInfo; MapInfo.m_Settings = SettingsIndex; - pData = (int *)&MapInfo; + pData = &MapInfo; Size = sizeof(MapInfo); } } else { - *(CMapItemInfo *)&MapInfo = *(CMapItemInfo *)pInfo; + *(CMapItemInfo *)&MapInfo = *(CMapItemInfo *)pData; MapInfo.m_Settings = SettingsIndex; - pData = (int *)&MapInfo; + pData = &MapInfo; Size = sizeof(MapInfo); } }