]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
changed most COM_ParseToken calls to COM_ParseTokenConsole, this fixed the kills...
[xonotic/darkplaces.git] / console.c
index 23b6196472173aa261afd53971d72088430ed14a..c244706d25aee8feb25c56f76c08c16fa3cda3f4 100644 (file)
--- a/console.c
+++ b/console.c
@@ -747,7 +747,7 @@ void Con_DrawNotify (void)
 {
        float   x, v;
        char    *text;
-       int             i;
+       int             i, stop;
        float   time;
        char    temptext[MAX_INPUTLINE];
        int colorindex = -1; //-1 for default
@@ -760,7 +760,9 @@ void Con_DrawNotify (void)
                v = 8;
        else
                v = 0;
-       for (i= con_current-con_notify.integer+1 ; i<=con_current ; i++)
+       // make a copy of con_current here so that we can't get in a runaway loop printing new messages while drawing the notify text
+       stop = con_current;
+       for (i= stop-con_notify.integer+1 ; i<=stop ; i++)
        {
 
                if (i < 0)
@@ -774,7 +776,6 @@ void Con_DrawNotify (void)
                text = con_text + (i % con_totallines)*con_linewidth;
 
                if (gamemode == GAME_NEXUIZ) {
-                       int linewidth = 0;
                        int chars = 0;
                        int finalchars = 0;
                        int j;
@@ -791,7 +792,6 @@ void Con_DrawNotify (void)
                                if (text[j] == ' ')
                                        continue;
                                finalchars = chars;
-                               linewidth = j + 1;
                        }
                        // center the line using the calculated width
                        x = (vid_conwidth.integer - finalchars * con_textsize.value) * 0.5;
@@ -839,7 +839,7 @@ The typing input line at the bottom should only be drawn if typing is allowed
 */
 void Con_DrawConsole (int lines)
 {
-       int i, rows, j;
+       int i, rows, j, stop;
        float y;
        char *text;
        int colorindex = -1;
@@ -857,7 +857,9 @@ void Con_DrawConsole (int lines)
        rows = (int)ceil((lines/con_textsize.value)-2);         // rows of text to draw
        y = lines - (rows+2)*con_textsize.value;        // may start slightly negative
 
-       for (i = con_current - rows + 1;i <= con_current;i++, y += con_textsize.value)
+       // make a copy of con_current here so that we can't get in a runaway loop printing new messages while drawing the notify text
+       stop = con_current;
+       for (i = stop - rows + 1;i <= stop;i++, y += con_textsize.value)
        {
                j = max(i - con_backscroll, 0);
                text = con_text + (j % con_totallines)*con_linewidth;
@@ -975,7 +977,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                for (;;)
                                {
                                        int l;
-                                       if (!COM_ParseToken(&data, false))
+                                       if (!COM_ParseTokenConsole(&data))
                                                break;
                                        if (com_token[0] == '{')
                                                continue;
@@ -986,7 +988,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                        for (l = 0;l < (int)sizeof(keyname) - 1 && com_token[k+l] && com_token[k+l] > ' ';l++)
                                                keyname[l] = com_token[k+l];
                                        keyname[l] = 0;
-                                       if (!COM_ParseToken(&data, false))
+                                       if (!COM_ParseTokenConsole(&data))
                                                break;
                                        if (developer.integer >= 100)
                                                Con_Printf("key: %s %s\n", keyname, com_token);