]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
improved packet command to have more escape codes (like \0)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 26 Feb 2006 09:37:52 +0000 (09:37 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 26 Feb 2006 09:37:52 +0000 (09:37 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6037 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c

index b0d86868c6528b25aac158ea1182cc1b4b89a6d0..721b76a5fe69d2a0ef2e10c139d1cbb14ae83119 100644 (file)
@@ -2240,14 +2240,33 @@ void Host_Packet_f (void) // credit: taken from QuakeWorld
                        *out++ = '\n';
                        i++;
                }
+               else if (in[i] == '\\' && in[i+1] == '0')
+               {
+                       *out++ = '\0';
+                       i++;
+               }
+               else if (in[i] == '\\' && in[i+1] == 't')
+               {
+                       *out++ = '\t';
+                       i++;
+               }
+               else if (in[i] == '\\' && in[i+1] == 'r')
+               {
+                       *out++ = '\r';
+                       i++;
+               }
+               else if (in[i] == '\\' && in[i+1] == '"')
+               {
+                       *out++ = '\"';
+                       i++;
+               }
                else
                        *out++ = in[i];
        }
-       *out = 0;
 
        mysocket = NetConn_ChooseClientSocketForAddress(&address);
        if (mysocket)
-               NetConn_WriteString(mysocket, send, &address);
+               NetConn_Write(mysocket, send, out - send, &address);
 }
 
 //=============================================================================