mirror of
https://github.com/ioquake/ioq3.git
synced 2025-02-23 20:11:18 +00:00
Fix hanging client when map_restart executed on the server while client is still loading the map
This commit is contained in:
parent
d1c0401c73
commit
de0e3cba34
2 changed files with 14 additions and 4 deletions
|
@ -338,9 +338,15 @@ static void SV_MapRestart_f( void ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
client->state = CS_ACTIVE;
|
if(client->state == CS_ACTIVE)
|
||||||
|
|
||||||
SV_ClientEnterWorld(client, &client->lastUsercmd);
|
SV_ClientEnterWorld(client, &client->lastUsercmd);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If we don't reset client->lastUsercmd and are restarting during map load,
|
||||||
|
// the client will hang because we'll use the last Usercmd from the previous map,
|
||||||
|
// which is wrong obviously.
|
||||||
|
SV_ClientEnterWorld(client, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// run another frame to allow things to look at all the players
|
// run another frame to allow things to look at all the players
|
||||||
|
|
|
@ -715,7 +715,11 @@ void SV_ClientEnterWorld( client_t *client, usercmd_t *cmd ) {
|
||||||
|
|
||||||
client->deltaMessage = -1;
|
client->deltaMessage = -1;
|
||||||
client->nextSnapshotTime = svs.time; // generate a snapshot immediately
|
client->nextSnapshotTime = svs.time; // generate a snapshot immediately
|
||||||
client->lastUsercmd = *cmd;
|
|
||||||
|
if(cmd)
|
||||||
|
memcpy(&client->lastUsercmd, cmd, sizeof(client->lastUsercmd));
|
||||||
|
else
|
||||||
|
memset(&client->lastUsercmd, '\0', sizeof(client->lastUsercmd));
|
||||||
|
|
||||||
// call the game begin function
|
// call the game begin function
|
||||||
VM_Call( gvm, GAME_CLIENT_BEGIN, client - svs.clients );
|
VM_Call( gvm, GAME_CLIENT_BEGIN, client - svs.clients );
|
||||||
|
|
Loading…
Reference in a new issue