Send gamestate resend on map_restart (matches real server behavior)

A real map_restart sends SV_SendClientGameState to all clients,
which triggers CL_ParseGamestate → CL_ClearState on the client,
wiping all snapshot and entity history. Previously we only forced
non-delta snapshots which doesn't clear cgame's entity state.

Now we call SV_SendClientGameState for all active clients on the
restart frame, exactly matching real server behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-23 06:15:31 +08:00
parent 595cf9864b
commit 4d89d35a6d
2 changed files with 5 additions and 1 deletions

View file

@ -289,6 +289,7 @@ void SV_AuthorizeIpPacket( netadr_t from );
void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ); void SV_ExecuteClientMessage( client_t *cl, msg_t *msg );
void SV_UserinfoChanged( client_t *cl ); void SV_UserinfoChanged( client_t *cl );
void SV_SendClientGameState( client_t *client );
void SV_ClientEnterWorld( client_t *client, usercmd_t *cmd ); void SV_ClientEnterWorld( client_t *client, usercmd_t *cmd );
void SV_DropClient( client_t *drop, const char *reason ); void SV_DropClient( client_t *drop, const char *reason );

View file

@ -667,9 +667,12 @@ static qboolean SVD_ReadFrame( fileHandle_t f ) {
Com_Memset( demo.playPrevEntities, 0, sizeof(demo.playPrevEntities) ); Com_Memset( demo.playPrevEntities, 0, sizeof(demo.playPrevEntities) );
Com_Memset( demo.playPrevPlayers, 0, sizeof(demo.playPrevPlayers) ); Com_Memset( demo.playPrevPlayers, 0, sizeof(demo.playPrevPlayers) );
svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT; svs.snapFlagServerBit ^= SNAPFLAG_SERVERCOUNT;
// send a full gamestate to all active clients — this makes
// CL_ParseGamestate → CL_ClearState wipe all snapshot/entity
// history, exactly like a real map_restart does.
for ( j = 0; j < sv_maxclients->integer; j++ ) { for ( j = 0; j < sv_maxclients->integer; j++ ) {
if ( svs.clients[j].state >= CS_PRIMED ) { if ( svs.clients[j].state >= CS_PRIMED ) {
svs.clients[j].deltaMessage = -1; SV_SendClientGameState( &svs.clients[j] );
} }
} }
} }