]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
Underwater sound filter: simplify code, improve cvar description
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index de40ce7f4ace2882fbd5df95e89b3b2283e8b29f..fbe40b6aa70d9ee5d3965ebc073082fe1a985268 100644 (file)
--- a/host.c
+++ b/host.c
@@ -105,44 +105,33 @@ void Host_Error (const char *error, ...)
        Con_Printf(CON_ERROR "Host_Error: %s\n", hosterrorstring1);
 
        // LadyHavoc: if crashing very early, or currently shutting down, do
-       // Sys_Abort instead
+       // Sys_Error instead
        if (host.framecount < 3 || host.state == host_shutdown)
-               Sys_Abort ("Host_Error during %s: %s", host.framecount < 3 ? "startup" : "shutdown", hosterrorstring1);
+               Sys_Error ("Host_Error during %s: %s", host.framecount < 3 ? "startup" : "shutdown", hosterrorstring1);
 
        if (hosterror)
-               Sys_Abort ("Host_Error: recursively entered (original error was: %s    new error is: %s)", hosterrorstring2, hosterrorstring1);
+               Sys_Error ("Host_Error: recursively entered (original error was: %s    new error is: %s)", hosterrorstring2, hosterrorstring1);
        hosterror = true;
 
        dp_strlcpy(hosterrorstring2, hosterrorstring1, sizeof(hosterrorstring2));
 
        CL_Parse_DumpPacket();
-
        CL_Parse_ErrorCleanUp();
 
-       //PR_Crash();
-
        // print out where the crash happened, if it was caused by QC (and do a cleanup)
-       PRVM_Crash(SVVM_prog);
-       PRVM_Crash(CLVM_prog);
-#ifdef CONFIG_MENU
-       PRVM_Crash(MVM_prog);
-#endif
-
-       Cvar_SetValueQuick(&csqc_progcrc, -1);
-       Cvar_SetValueQuick(&csqc_progsize, -1);
+       PRVM_Crash();
 
        if(host.hook.SV_Shutdown)
                host.hook.SV_Shutdown();
 
        if (cls.state == ca_dedicated)
-               Sys_Abort ("Host_Error: %s",hosterrorstring2);        // dedicated servers exit
+               Sys_Error("Host_Error: %s", hosterrorstring1);        // dedicated servers exit
 
        // prevent an endless loop if the error was triggered by a command
        Cbuf_Clear(cmd_local->cbuf);
 
-       // DP8 TODO: send a disconnect message indicating we errored out, see Sys_Abort() and Sys_HandleCrash()
-       CL_Disconnect();
-       cls.demonum = -1;
+       CL_DisconnectEx(false, "Host_Error: %s", hosterrorstring1);
+       cls.demonum = -1; // stop demo loop
 
        hosterror = false;
 
@@ -351,7 +340,7 @@ void Host_LockSession(void)
                        }
                        else
                        {
-                               Sys_Abort("session lock %s could not be acquired. Please run with -sessionid and an unique session name.\n", p);
+                               Sys_Error("session lock %s could not be acquired. Please run with -sessionid and an unique session name.\n", p);
                        }
                }
        }
@@ -396,7 +385,7 @@ static void Host_Init (void)
        host.state = host_init;
 
        if (setjmp(host.abortframe)) // Huh?!
-               Sys_Abort("Engine initialization failed. Check the console (if available) for additional information.\n");
+               Sys_Error("Engine initialization failed. Check the console (if available) for additional information.\n");
 
        if (Sys_CheckParm("-profilegameonly"))
                Sys_AllowProfiling(false);
@@ -694,7 +683,7 @@ void Host_Main(void)
        oldtime = Sys_DirtyTime();
 
        // Main event loop
-       while(host.state != host_shutdown)
+       while(host.state < host_shutdown) // see Sys_HandleCrash() comments
        {
                // Something bad happened, or the server disconnected
                if (setjmp(host.abortframe))