Avoid creating a new sound index when there is no active client

This commit is contained in:
smallmodel 2024-06-16 23:20:30 +02:00
parent a5691d7779
commit 40492daecd
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -70,9 +70,17 @@ void SV_Sound( vec3_t *org, int entnum, int channel, const char *sound_name, flo
{
int i;
for (i = 0; i < sv_maxclients->integer; i++)
for (i = 0; i < svs.iNumClients; i++)
{
client_t* client = &svs.clients[i];
if (client->state != CS_ACTIVE) {
continue;
}
if (client->number_of_server_sounds >= MAX_SERVER_SOUNDS) {
continue;
}
SV_ClientSound(client, org, entnum, channel, SV_SoundIndex(sound_name, streamed), volume, mindist, pitch, maxdist, streamed);
}
}