mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #8186 from ChillerDragon/pr_optimize_demo_snap
Remove demo snap buffer and mem copy
This commit is contained in:
commit
c20baa5035
|
@ -11,6 +11,7 @@
|
|||
#include <game/generated/protocol.h>
|
||||
|
||||
#include <engine/friends.h>
|
||||
#include <engine/shared/snapshot.h>
|
||||
#include <functional>
|
||||
|
||||
struct SWarning;
|
||||
|
@ -346,7 +347,7 @@ public:
|
|||
virtual CNetObjHandler *GetNetObjHandler() = 0;
|
||||
};
|
||||
|
||||
void SnapshotRemoveExtraProjectileInfo(unsigned char *pData);
|
||||
void SnapshotRemoveExtraProjectileInfo(CSnapshot *pSnap);
|
||||
|
||||
extern IGameClient *CreateGameClient();
|
||||
#endif
|
||||
|
|
|
@ -1821,9 +1821,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
if(!Dummy)
|
||||
{
|
||||
// for antiping: if the projectile netobjects from the server contains extra data, this is removed and the original content restored before recording demo
|
||||
unsigned char aExtraInfoRemoved[CSnapshot::MAX_SIZE];
|
||||
mem_copy(aExtraInfoRemoved, pTmpBuffer3, SnapSize);
|
||||
SnapshotRemoveExtraProjectileInfo(aExtraInfoRemoved);
|
||||
SnapshotRemoveExtraProjectileInfo(pTmpBuffer3);
|
||||
|
||||
// add snapshot to demo
|
||||
for(auto &DemoRecorder : m_aDemoRecorder)
|
||||
|
@ -1831,7 +1829,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
if(DemoRecorder.IsRecording())
|
||||
{
|
||||
// write snapshot
|
||||
DemoRecorder.RecordSnapshot(GameTick, aExtraInfoRemoved, SnapSize);
|
||||
DemoRecorder.RecordSnapshot(GameTick, pTmpBuffer3, SnapSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,9 +104,8 @@ CProjectileData ExtractProjectileInfoDDNet(const CNetObj_DDNetProjectile *pProj)
|
|||
return Result;
|
||||
}
|
||||
|
||||
void SnapshotRemoveExtraProjectileInfo(unsigned char *pData)
|
||||
void SnapshotRemoveExtraProjectileInfo(CSnapshot *pSnap)
|
||||
{
|
||||
CSnapshot *pSnap = (CSnapshot *)pData;
|
||||
for(int Index = 0; Index < pSnap->NumItems(); Index++)
|
||||
{
|
||||
const CSnapshotItem *pItem = pSnap->GetItem(Index);
|
||||
|
|
Loading…
Reference in a new issue