]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
i'm sure there are plenty of bugs here for you guys to fix
[xonotic/darkplaces.git] / console.c
index eeed6627f255acf64a0a101d665579977774ad39..01fe262298218f43bdb236db346e9ddd3ebc2f1c 100644 (file)
--- a/console.c
+++ b/console.c
@@ -77,8 +77,9 @@ LOGGING
 
 cvar_t log_file = {0, "log_file","", "filename to log messages to"};
 cvar_t log_dest_udp = {0, "log_dest_udp","", "UDP address to log messages to (in QW rcon compatible format); multiple destinations can be separated by spaces; DO NOT SPECIFY DNS NAMES HERE"};
-char log_dest_buffer[1500]; // UDP packet
+char log_dest_buffer[1400]; // UDP packet
 size_t log_dest_buffer_pos;
+qboolean log_dest_buffer_appending;
 char crt_log_file [MAX_OSPATH] = "";
 qfile_t* logfile = NULL;
 
@@ -112,10 +113,11 @@ void Log_DestBuffer_Flush()
        qboolean have_opened_temp_sockets = false;
        if(s) if(log_dest_buffer_pos > 5)
        {
+               ++log_dest_buffer_appending;
                log_dest_buffer[log_dest_buffer_pos++] = 0;
 
                if(!NetConn_HaveServerPorts() && !NetConn_HaveClientPorts()) // then temporarily open one
-               {
+               {
                        have_opened_temp_sockets = true;
                        NetConn_OpenServerPorts(true);
                }
@@ -132,6 +134,7 @@ void Log_DestBuffer_Flush()
 
                if(have_opened_temp_sockets)
                        NetConn_CloseServerPorts();
+               --log_dest_buffer_appending;
        }
        log_dest_buffer_pos = 0;
 }
@@ -347,7 +350,7 @@ Con_Clear_f
 */
 void Con_Clear_f (void)
 {
-       if (con_text)
+       //if (con_text)
                memset (con_text, ' ', CON_TEXTSIZE);
 }
 
@@ -677,10 +680,15 @@ Con_Rcon_AddChar
 Adds a character to the rcon buffer
 ================
 */
-inline void Con_Rcon_AddChar(char c)
+void Con_Rcon_AddChar(char c)
 {
+       if(log_dest_buffer_appending)
+               return;
+       ++log_dest_buffer_appending;
+
        // if this print is in response to an rcon command, add the character
        // to the rcon redirect buffer
+
        if (rcon_redirect && rcon_redirect_bufferpos < (int)sizeof(rcon_redirect_buffer) - 1)
                rcon_redirect_buffer[rcon_redirect_bufferpos++] = c;
        else if(*log_dest_udp.string) // don't duplicate rcon command responses here, these are sent another way
@@ -693,6 +701,8 @@ inline void Con_Rcon_AddChar(char c)
        }
        else
                log_dest_buffer_pos = 0;
+
+       --log_dest_buffer_appending;
 }
 
 /*
@@ -1272,7 +1282,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                for (;;)
                                {
                                        int l;
-                                       if (!COM_ParseToken_Simple(&data, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false))
                                                break;
                                        if (com_token[0] == '{')
                                                continue;
@@ -1283,7 +1293,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_Simple(&data, false))
+                                       if (!COM_ParseToken_Simple(&data, false, false))
                                                break;
                                        if (developer.integer >= 100)
                                                Con_Printf("key: %s %s\n", keyname, com_token);