[quake3-commits] r1826 - trunk/code/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jan 27 11:40:18 EST 2011


Author: thilo
Date: 2011-01-27 11:40:15 -0500 (Thu, 27 Jan 2011)
New Revision: 1826

Modified:
   trunk/code/server/sv_ccmds.c
   trunk/code/server/sv_client.c
Log:
Fix hanging client when map_restart executed on the server while client is still loading the map


Modified: trunk/code/server/sv_ccmds.c
===================================================================
--- trunk/code/server/sv_ccmds.c	2011-01-27 12:34:58 UTC (rev 1825)
+++ trunk/code/server/sv_ccmds.c	2011-01-27 16:40:15 UTC (rev 1826)
@@ -338,9 +338,15 @@
 			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

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2011-01-27 12:34:58 UTC (rev 1825)
+++ trunk/code/server/sv_client.c	2011-01-27 16:40:15 UTC (rev 1826)
@@ -715,8 +715,12 @@
 
 	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 );
 }



More information about the quake3-commits mailing list