]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cmd.c
fix hl sprite loading (stupid typo in handling sprite types)
[xonotic/darkplaces.git] / cmd.c
diff --git a/cmd.c b/cmd.c
index fe455296ef4fc3278ac270e7308ebcd0c1ae95f7..ce200ea2de3ad16414b041fe1a4b5978fcf3493b 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -77,6 +77,15 @@ void Cbuf_Init (void)
        SZ_Alloc (&cmd_text, 32768, "command buffer"); // space for commands and script files
 }
 
+/*
+============
+Cbuf_Shutdown
+============
+*/
+void Cbuf_Shutdown (void)
+{
+       SZ_Free (&cmd_text);
+}
 
 /*
 ============
@@ -459,6 +468,16 @@ void Cmd_Init (void)
        Cmd_AddCommand ("seta", Cvar_SetA_f);
 }
 
+/*
+============
+Cmd_Shutdown
+============
+*/
+void Cmd_Shutdown(void)
+{
+       Mem_FreePool(&cmd_mempool);
+}
+
 /*
 ============
 Cmd_Argc
@@ -509,12 +528,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;
                }