Auto-stop demo recording on map change

SV_SpawnServer reinitializes the game module, invalidating all
entity and configstring state. Recording across a map boundary
would produce corrupt deltas. Stop recording automatically at
the start of SV_SpawnServer (before game shutdown).

map_restart is unaffected — it has its own path (SV_MapRestart_f)
which doesn't call SV_SpawnServer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-23 05:08:38 +08:00
parent 5987109014
commit 6fc96e7070

View file

@ -351,6 +351,12 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
char systemInfo[16384];
const char *p;
// stop any active demo recording (one demo = one map)
if ( SVD_IsRecording() ) {
Com_Printf( "Map change — stopping demo recording.\n" );
SVD_StopRecord_f();
}
// shut down the existing game if it is running
SV_ShutdownGameProgs();