]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cmd.c
changed rtlight compiled cluster list/pvs to leaf list/pvs to enable slightly more...
[xonotic/darkplaces.git] / cmd.c
diff --git a/cmd.c b/cmd.c
index 18ac78fe5bb7d851756ca2dd69b5b9f527572a5c..89c5a8bfd43028b84d25087f9777efe94fad6d18 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -64,7 +64,9 @@ static void Cmd_Wait_f (void)
 =============================================================================
 */
 
+       // LordHavoc: inreased this from 8192 to 32768
 static sizebuf_t       cmd_text;
+static qbyte           cmd_text_buf[32768];
 
 /*
 ============
@@ -73,8 +75,10 @@ Cbuf_Init
 */
 void Cbuf_Init (void)
 {
-       // LordHavoc: inreased this from 8192 to 32768
-       SZ_Alloc (&cmd_text, 32768, "command buffer"); // space for commands and script files
+       // space for commands and script files
+       cmd_text.data = cmd_text_buf;
+       cmd_text.maxsize = sizeof(cmd_text_buf);
+       cmd_text.cursize = 0;
 }
 
 /*
@@ -84,7 +88,6 @@ Cbuf_Shutdown
 */
 void Cbuf_Shutdown (void)
 {
-       SZ_Free (&cmd_text);
 }
 
 /*
@@ -528,12 +531,18 @@ static void Cmd_TokenizeString (const char *text)
        while (1)
        {
                // skip whitespace up to a /n
-               while (*text && *text <= ' ' && *text != '\n')
+               while (*text && *text <= ' ' && *text != '\r' && *text != '\n')
                        text++;
 
-               if (*text == '\n')
+               // line endings:
+               // UNIX: \n
+               // Mac: \r
+               // Windows: \r\n
+               if (*text == '\n' || *text == '\r')
                {
                        // a newline seperates commands in the buffer
+                       if (*text == '\r' && text[1] == '\n')
+                               text++;
                        text++;
                        break;
                }