diff --git a/code/server/sv_ccmds.c b/code/server/sv_ccmds.c index 2b425c88..ba2d3b31 100644 --- a/code/server/sv_ccmds.c +++ b/code/server/sv_ccmds.c @@ -338,9 +338,15 @@ static void SV_MapRestart_f( void ) { continue; } - client->state = CS_ACTIVE; - - SV_ClientEnterWorld( client, &client->lastUsercmd ); + if(client->state == CS_ACTIVE) + 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 diff --git a/code/server/sv_client.c b/code/server/sv_client.c index d6c355ad..1db1a3bb 100644 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -715,7 +715,11 @@ void SV_ClientEnterWorld( client_t *client, usercmd_t *cmd ) { client->deltaMessage = -1; 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 VM_Call( gvm, GAME_CLIENT_BEGIN, client - svs.clients );