]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
Added CL_Shutdown which took care of 14 memory leaks totaling over 30mb. (needs more...
[xonotic/darkplaces.git] / console.c
index 592e338e3ebc4ceb81583c497c57216007a7e297..92f399a14c96699de538af7f6e6e7ac1a489884e 100644 (file)
--- a/console.c
+++ b/console.c
@@ -129,7 +129,6 @@ void Log_Init (void)
        {
                Cvar_SetQuick (&log_file, "qconsole.log");
                Cvar_SetValueQuick (&log_sync, 1);
-               unlink (va("%s/qconsole.log", fs_gamedir));
        }
 }
 
@@ -433,8 +432,6 @@ void Con_Init (void)
        con_linewidth = -1;
        Con_CheckResize ();
 
-       Con_Print("Console initialized.\n");
-
        // register our cvars
        Cvar_RegisterVariable (&con_notifytime);
        Cvar_RegisterVariable (&con_notify);
@@ -444,7 +441,9 @@ void Con_Init (void)
        Cmd_AddCommand ("messagemode", Con_MessageMode_f);
        Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
        Cmd_AddCommand ("clear", Con_Clear_f);
+
        con_initialized = true;
+       Con_Print("Console initialized.\n");
 }
 
 
@@ -661,7 +660,7 @@ void Con_Printf(const char *fmt, ...)
        char msg[MAXPRINTMSG];
 
        va_start(argptr,fmt);
-       vsprintf(msg,fmt,argptr);
+       vsnprintf(msg,sizeof(msg),fmt,argptr);
        va_end(argptr);
 
        Con_Print(msg);
@@ -697,39 +696,7 @@ void Con_DPrintf(const char *fmt, ...)
                return;                 // don't confuse non-developers with techie stuff...
 
        va_start(argptr,fmt);
-       vsprintf(msg,fmt,argptr);
-       va_end(argptr);
-
-       Con_Print(msg);
-}
-
-
-/*
-================
-Con_SafePrint
-
-Okay to call even when the screen can't be updated
-==================
-*/
-void Con_SafePrint(const char *msg)
-{
-       Con_Print(msg);
-}
-
-/*
-==================
-Con_SafePrintf
-
-Okay to call even when the screen can't be updated
-==================
-*/
-void Con_SafePrintf(const char *fmt, ...)
-{
-       va_list argptr;
-       char msg[MAXPRINTMSG];
-
-       va_start(argptr,fmt);
-       vsprintf(msg,fmt,argptr);
+       vsnprintf(msg,sizeof(msg),fmt,argptr);
        va_end(argptr);
 
        Con_Print(msg);
@@ -830,7 +797,15 @@ void Con_DrawNotify (void)
                        continue;
                text = con_text + (i % con_totallines)*con_linewidth;
 
-               DrawQ_String(0, v, text, con_linewidth, 8, 8, 1, 1, 1, 1, 0);
+               if (gamemode == GAME_NEXUIZ) {
+                       int linewidth;
+
+                       for (linewidth = con_linewidth; linewidth && text[linewidth-1] == ' '; linewidth--);
+                       x = (vid.conwidth - linewidth * 8) / 2;
+               } else 
+                       x = 0;
+
+               DrawQ_String(x, v, text, con_linewidth, 8, 8, 1, 1, 1, 1, 0);
 
                v += 8;
        }