summaryrefslogtreecommitdiff
path: root/src/server/sv_net_chan.c
diff options
context:
space:
mode:
authorThilo Schulz <arny@ats.s.bawue.de>2011-07-17 23:43:33 +0000
committerTim Angus <tim@ngus.net>2013-01-10 22:30:00 +0000
commitfb482881f216792ebfb1b8ad6bb6ea5dc272b450 (patch)
tree78705566327339a8b0c0375f65fda46e113f800a /src/server/sv_net_chan.c
parent8573ded969056c0029e1103944b60f8dc472f185 (diff)
Fix legacy protocol with new packet queueing
Diffstat (limited to 'src/server/sv_net_chan.c')
-rw-r--r--src/server/sv_net_chan.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/server/sv_net_chan.c b/src/server/sv_net_chan.c
index a4304566..daa8e60a 100644
--- a/src/server/sv_net_chan.c
+++ b/src/server/sv_net_chan.c
@@ -35,7 +35,8 @@ SV_Netchan_Encode
==============
*/
-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;
@@ -59,7 +60,7 @@ static void SV_Netchan_Encode( client_t *client, msg_t *msg ) {
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;
@@ -166,7 +167,7 @@ void SV_Netchan_TransmitNextInQueue(client_t *client)
#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);
@@ -232,6 +233,13 @@ void SV_Netchan_Transmit( client_t *client, msg_t *msg)
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;
@@ -241,7 +249,7 @@ void SV_Netchan_Transmit( client_t *client, msg_t *msg)
{
#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 );
}