From: havoc Date: Thu, 18 Oct 2007 07:09:15 +0000 (+0000) Subject: fixed a bug in multiplayer savegame loading that caused all players X-Git-Tag: xonotic-v0.1.0preview~2835 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c5e4b3574c5a65919d9c92ad470999eeeed41791;p=xonotic%2Fdarkplaces.git fixed a bug in multiplayer savegame loading that caused all players after the first one to respawn immediately after loading (sv.loadgame and sv.paused were being cleared by the first player) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7646 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host.c b/host.c index 7888bffd..e0536ff6 100644 --- a/host.c +++ b/host.c @@ -462,6 +462,18 @@ void SV_DropClient(qboolean crash) // update server listing on the master because player count changed // (which the master uses for filtering empty/full servers) NetConn_Heartbeat(1); + + if (sv.loadgame) + { + for (i = 0;i < svs.maxclients;i++) + if (svs.clients[i].active && !svs.clients[i].spawned) + break; + if (i == svs.maxclients) + { + Con_Printf("Loaded game, everyone rejoined - unpausing\n"); + sv.paused = sv.loadgame = false; // we're basically done with loading now + } + } } /* @@ -527,7 +539,7 @@ void Host_GetConsoleCommands (void) ================== Host_TimeReport -Returns a time report string, for example for +Returns a time report string, for example for ================== */ const char *Host_TimingReport() diff --git a/host_cmd.c b/host_cmd.c index 21c8690a..8bb5e69a 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1405,9 +1405,6 @@ void Host_Spawn_f (void) if (sv.loadgame) { // loaded games are fully initialized already - // if this is the last client to be connected, unpause - sv.paused = false; - if (prog->funcoffsets.RestoreGame) { Con_DPrint("Calling RestoreGame\n"); @@ -1430,8 +1427,8 @@ void Host_Spawn_f (void) prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict); PRVM_ExecuteProgram (prog->globals.server->ClientConnect, "QC function ClientConnect is missing"); - if (svs.maxclients > 1 || cls.state == ca_dedicated) - Con_Printf("%s entered the game\n", host_client->name); + if (cls.state == ca_dedicated) + Con_Printf("%s connected\n", host_client->name); PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing"); } @@ -1498,7 +1495,6 @@ void Host_Spawn_f (void) MSG_WriteAngle (&host_client->netconnection->message, host_client->edict->fields.server->v_angle[0], sv.protocol); MSG_WriteAngle (&host_client->netconnection->message, host_client->edict->fields.server->v_angle[1], sv.protocol); MSG_WriteAngle (&host_client->netconnection->message, 0, sv.protocol); - sv.loadgame = false; // we're basically done with loading now } else { @@ -1522,6 +1518,20 @@ Host_Begin_f void Host_Begin_f (void) { host_client->spawned = true; + + // LordHavoc: note: this code also exists in SV_DropClient + if (sv.loadgame) + { + int i; + for (i = 0;i < svs.maxclients;i++) + if (svs.clients[i].active && !svs.clients[i].spawned) + break; + if (i == svs.maxclients) + { + Con_Printf("Loaded game, everyone rejoined - unpausing\n"); + sv.paused = sv.loadgame = false; // we're basically done with loading now + } + } } //===========================================================================