mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 06:20:48 +00:00
Fix loading Coop savegames without starting server first
This commit is contained in:
parent
b44fd32572
commit
04a33c9837
1 changed files with 11 additions and 2 deletions
|
@ -645,7 +645,16 @@ SV_FinalMessage(char *message, qboolean reconnect)
|
|||
}
|
||||
|
||||
/* stagger the packets to crutch operating system limited buffers */
|
||||
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
|
||||
/* DG: we can't just use the maxclients cvar here for the number of clients,
|
||||
* because this is called by SV_Shutdown() and the shut down server might have
|
||||
* a different number of clients (e.g. 1 if it's single player), when maxclients
|
||||
* has already been set to a higher value for multiplayer (e.g. 4 for coop)
|
||||
* Luckily, svs.num_client_entities = maxclients->value * UPDATE_BACKUP * 64;
|
||||
* with the maxclients value from when the current server was started (see SV_InitGame())
|
||||
* so we can just calculate the right number of clients from that
|
||||
*/
|
||||
int numClients = svs.num_client_entities / ( UPDATE_BACKUP * 64 );
|
||||
for (i = 0, cl = svs.clients; i < numClients; i++, cl++)
|
||||
{
|
||||
if (cl->state >= cs_connected)
|
||||
{
|
||||
|
@ -654,7 +663,7 @@ SV_FinalMessage(char *message, qboolean reconnect)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
|
||||
for (i = 0, cl = svs.clients; i < numClients; i++, cl++)
|
||||
{
|
||||
if (cl->state >= cs_connected)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue