From d369a5b6935885306b0e478c0cbb6b194f542e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 25 Aug 2022 17:01:24 +0200 Subject: [PATCH] Write messages to all active demo recorders --- src/engine/server/server.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 432a81f3e..763704e7c 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -799,9 +799,13 @@ int CServer::SendMsg(CMsgPacker *pMsg, int Flags, int ClientID) if(RepackMsg(pMsg, Pack7, true)) return -1; - // write message to demo recorder + // write message to demo recorders if(!(Flags & MSGFLAG_NORECORD)) - m_aDemoRecorder[MAX_CLIENTS].RecordMessage(Pack6.Data(), Pack6.Size()); + { + for(auto &Recorder : m_aDemoRecorder) + if(Recorder.IsRecording()) + Recorder.RecordMessage(Pack6.Data(), Pack6.Size()); + } if(!(Flags & MSGFLAG_NOSEND)) { @@ -837,10 +841,13 @@ int CServer::SendMsg(CMsgPacker *pMsg, int Flags, int ClientID) return 0; } + // write message to demo recorders if(!(Flags & MSGFLAG_NORECORD)) { - m_aDemoRecorder[ClientID].RecordMessage(Pack.Data(), Pack.Size()); - m_aDemoRecorder[MAX_CLIENTS].RecordMessage(Pack.Data(), Pack.Size()); + if(m_aDemoRecorder[ClientID].IsRecording()) + m_aDemoRecorder[ClientID].RecordMessage(Pack.Data(), Pack.Size()); + if(m_aDemoRecorder[MAX_CLIENTS].IsRecording()) + m_aDemoRecorder[MAX_CLIENTS].RecordMessage(Pack.Data(), Pack.Size()); } if(!(Flags & MSGFLAG_NOSEND))