Fix server command replay: broadcast instead of targeting slot 63

spectatorClientNum was hardcoded to MAX_CLIENTS-1 (63) but the
spectator actually connects at the first free slot after zombie
reservations. Broadcasting with SV_SendServerCommand(NULL, ...)
reaches the spectator regardless of their actual slot number.
Zombie clients (< CS_PRIMED) are skipped by the broadcast loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-23 05:50:15 +08:00
parent 0d1f1d515e
commit 8b7ec11034

View file

@ -811,11 +811,8 @@ static qboolean SVD_ReadFrame( fileHandle_t f ) {
if ( len > 0 && len < (short)sizeof(buf) ) {
FS_Read( buf, len, f );
buf[len - 1] = '\0';
// send to the spectator client
if ( demo.spectatorClientNum < sv_maxclients->integer
&& svs.clients[demo.spectatorClientNum].state >= CS_PRIMED ) {
SV_SendServerCommand( &svs.clients[demo.spectatorClientNum], "%s", buf );
}
// broadcast — only the spectator is CS_ACTIVE, zombies are skipped
SV_SendServerCommand( NULL, "%s", buf );
}
}
}