Skip to content

Commit bde78f3

Browse files
committed
Fix tuning not being recorded to auto server demos
The `IsRecording` check was only considering `RECORDER_MANUAL` (which is equal to `MAX_CLIENTS`), but not `RECORDER_AUTO`, so if an auto server demo was being recorded without recording a manual demo, the tuning was not being added to the auto demo.
1 parent 5bda840 commit bde78f3

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/engine/server.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ class IGameServer : public IInterface
318318
//
319319
// GlobalSnap is true when sending snapshots to all clients,
320320
// otherwise only forced high bandwidth clients would receive snap.
321-
virtual void OnSnap(int ClientId, bool GlobalSnap) = 0;
321+
// RecordingDemo is true when this snapshot will be recorded to a demo.
322+
virtual void OnSnap(int ClientId, bool GlobalSnap, bool RecordingDemo) = 0;
322323

323324
// Called after sending snapshots to all clients.
324325
//

src/engine/server/server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ void CServer::DoSnapshot()
10061006

10071007
// build snap and possibly add some messages
10081008
m_SnapshotBuilder.Init();
1009-
GameServer()->OnSnap(-1, IsGlobalSnap);
1009+
GameServer()->OnSnap(-1, IsGlobalSnap, true);
10101010
int SnapshotSize = m_SnapshotBuilder.Finish(aData);
10111011

10121012
// write snapshot
@@ -1039,7 +1039,7 @@ void CServer::DoSnapshot()
10391039
m_SnapshotBuilder.Init(m_aClients[i].m_Sixup);
10401040

10411041
// only snap events on global ticks
1042-
GameServer()->OnSnap(i, IsGlobalSnap);
1042+
GameServer()->OnSnap(i, IsGlobalSnap, m_aDemoRecorder[i].IsRecording());
10431043

10441044
// finish snapshot
10451045
char aData[CSnapshot::MAX_SIZE];

src/game/server/gamecontext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4615,13 +4615,13 @@ void CGameContext::LoadMapSettings()
46154615
Console()->ExecuteFile(aBuf, IConsole::CLIENT_ID_NO_GAME);
46164616
}
46174617

4618-
void CGameContext::OnSnap(int ClientId, bool GlobalSnap)
4618+
void CGameContext::OnSnap(int ClientId, bool GlobalSnap, bool RecordingDemo)
46194619
{
46204620
// sixup should only snap during global snap
46214621
dbg_assert(!Server()->IsSixup(ClientId) || GlobalSnap, "sixup should only snap during global snap");
46224622

46234623
// add tuning to demo
4624-
if(Server()->IsRecording(ClientId > -1 ? ClientId : MAX_CLIENTS) && mem_comp(&CTuningParams::DEFAULT, &m_aTuningList[0], sizeof(CTuningParams)) != 0)
4624+
if(RecordingDemo && mem_comp(&CTuningParams::DEFAULT, &m_aTuningList[0], sizeof(CTuningParams)) != 0)
46254625
{
46264626
CMsgPacker Msg(NETMSGTYPE_SV_TUNEPARAMS);
46274627
int *pParams = (int *)&m_aTuningList[0];

src/game/server/gamecontext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class CGameContext : public IGameServer
328328
void OnShutdown(void *pPersistentData) override;
329329

330330
void OnTick() override;
331-
void OnSnap(int ClientId, bool GlobalSnap) override;
331+
void OnSnap(int ClientId, bool GlobalSnap, bool RecordingDemo) override;
332332
void OnPostGlobalSnap() override;
333333

334334
void UpdatePlayerMaps();

0 commit comments

Comments
 (0)