]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
Remove Con_Warnf and Errorf. Use macros to change color and identify the message
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 5c9da7eb436e50d41711f09dacfa11bc5165b482..bd8439433b8f7c3e91ceebaa3058813acc68da70 100644 (file)
--- a/host.c
+++ b/host.c
@@ -118,7 +118,7 @@ void Host_Error (const char *error, ...)
        dpvsnprintf (hosterrorstring1,sizeof(hosterrorstring1),error,argptr);
        va_end (argptr);
 
-       Con_Errorf("Host_Error: %s\n", hosterrorstring1);
+       Con_Printf(CON_ERROR "Host_Error: %s\n", hosterrorstring1);
 
        // LadyHavoc: if crashing very early, or currently shutting down, do
        // Sys_Error instead
@@ -213,6 +213,24 @@ static void Host_ServerOptions (void)
                Cvar_SetValueQuick(&deathmatch, 1);
 }
 
+/*
+==================
+Host_Quit_f
+==================
+*/
+void Host_Quit_f(cmd_state_t *cmd)
+{
+       if(host.state == host_shutdown)
+               Con_Printf("shutting down already!\n");
+       else
+               host.state = host_shutdown;
+}
+
+static void Host_Version_f(cmd_state_t *cmd)
+{
+       Con_Printf("Version: %s build %s\n", gamename, buildstring);
+}
+
 /*
 =======================
 Host_InitLocal
@@ -224,6 +242,8 @@ extern cvar_t sv_writepicture_quality;
 extern cvar_t r_texture_jpeg_fastpicmip;
 static void Host_InitLocal (void)
 {
+       Cmd_AddCommand(CMD_SHARED, "quit", Host_Quit_f, "quit the game");
+       Cmd_AddCommand(CMD_SHARED, "version", Host_Version_f, "print engine version");
        Cmd_AddCommand(CMD_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)");
        Cmd_AddCommand(CMD_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs");
        Cvar_RegisterVariable (&cl_maxphysicsframesperserverframe);
@@ -276,7 +296,7 @@ static void Host_SaveConfig_to(const char *file)
                f = FS_OpenRealFile(file, "wb", false);
                if (!f)
                {
-                       Con_Errorf("Couldn't write %s.\n", file);
+                       Con_Printf(CON_ERROR "Couldn't write %s.\n", file);
                        return;
                }
 
@@ -410,12 +430,12 @@ void Host_Main(void)
                {
                        // warn if it's significant
                        if (time < -0.01)
-                               Con_Warnf("Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, time);
+                               Con_Printf(CON_WARN "Host_Mingled: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, time);
                        time = 0;
                }
                else if (time >= 1800)
                {
-                       Con_Warnf("Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", oldtime, newtime, time);
+                       Con_Printf(CON_WARN "Host_Mingled: time stepped forward (went from %f to %f, difference %f)\n", oldtime, newtime, time);
                        time = 0;
                }
                host.realtime += time;
@@ -851,7 +871,7 @@ void Host_LockSession(void)
                {
                        if(locksession.integer == 2)
                        {
-                               Con_Warnf("WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p);
+                               Con_Printf(CON_WARN "WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p);
                        }
                        else
                        {