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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Jul 17 19:43:33 EDT 2011


Author: thilo
Date: 2011-07-17 19:43:33 -0400 (Sun, 17 Jul 2011)
New Revision: 2087

Modified:
   trunk/code/server/server.h
   trunk/code/server/sv_net_chan.c
Log:
Fix legacy protocol with new packet queueing


Modified: trunk/code/server/server.h
===================================================================
--- trunk/code/server/server.h	2011-07-17 01:41:39 UTC (rev 2086)
+++ trunk/code/server/server.h	2011-07-17 23:43:33 UTC (rev 2087)
@@ -124,6 +124,9 @@
 typedef struct netchan_buffer_s {
 	msg_t           msg;
 	byte            msgBuffer[MAX_MSGLEN];
+#ifdef LEGACY_PROTOCOL
+	char		clientCommandString[MAX_STRING_CHARS];	// valid command string for SV_Netchan_Encode
+#endif
 	struct netchan_buffer_s *next;
 } netchan_buffer_t;
 

Modified: trunk/code/server/sv_net_chan.c
===================================================================
--- trunk/code/server/sv_net_chan.c	2011-07-17 01:41:39 UTC (rev 2086)
+++ trunk/code/server/sv_net_chan.c	2011-07-17 23:43:33 UTC (rev 2087)
@@ -34,7 +34,8 @@
 
 ==============
 */
-static void SV_Netchan_Encode( client_t *client, msg_t *msg ) {
+static void SV_Netchan_Encode(client_t *client, msg_t *msg, const char *clientCommandString)
+{
 	long i, index;
 	byte key, *string;
 	int	srdc, sbit;
@@ -58,7 +59,7 @@
 	msg->bit = sbit;
 	msg->readcount = srdc;
 
-	string = (byte *)client->lastClientCommandString;
+	string = (byte *) clientCommandString;
 	index = 0;
 	// xor the client challenge with the netchan sequence number
 	key = client->challenge ^ client->netchan.outgoingSequence;
@@ -165,7 +166,7 @@
 
 #ifdef LEGACY_PROTOCOL
 	if(client->compat)
-		SV_Netchan_Encode(client, &netbuf->msg);
+		SV_Netchan_Encode(client, &netbuf->msg, netbuf->clientCommandString);
 #endif
 
 	Netchan_Transmit(&client->netchan, netbuf->msg.cursize, netbuf->msg.data);
@@ -231,6 +232,13 @@
 		netbuf = (netchan_buffer_t *) Z_Malloc(sizeof(netchan_buffer_t));
 		// store the msg, we can't store it encoded, as the encoding depends on stuff we still have to finish sending
 		MSG_Copy(&netbuf->msg, netbuf->msgBuffer, sizeof( netbuf->msgBuffer ), msg);
+#ifdef LEGACY_PROTOCOL
+		if(client->compat)
+		{
+			Q_strncpyz(netbuf->clientCommandString, client->lastClientCommandString,
+				   sizeof(netbuf->clientCommandString));
+		}
+#endif
 		netbuf->next = NULL;
 		// insert it in the queue, the message will be encoded and sent later
 		*client->netchan_end_queue = netbuf;
@@ -240,7 +248,7 @@
 	{
 #ifdef LEGACY_PROTOCOL
 		if(client->compat)
-			SV_Netchan_Encode(client, msg);
+			SV_Netchan_Encode(client, msg, client->lastClientCommandString);
 #endif
 		Netchan_Transmit( &client->netchan, msg->cursize, msg->data );
 	}



More information about the quake3-commits mailing list