]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - menu.c
Revert renamings from 591877ee0c64958303dcbb4f2af3d343a420cf6a
[xonotic/darkplaces.git] / menu.c
diff --git a/menu.c b/menu.c
index e26e74d71f604cbce2fdfb7499843e14d315f581..d4d32b811b1836dcfcf7ad0f932e837bb05eed8f 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -2573,7 +2573,7 @@ void M_Menu_Keys_f(cmd_state_t *cmd)
 
                // Only sections? There may be a problem somewhere...
                if (keys_cursor >= numcommands)
-                       Sys_Abort ("M_Init: The key binding list only contains sections");
+                       Sys_Error ("M_Init: The key binding list only contains sections");
        }
 }
 
@@ -5211,41 +5211,45 @@ void MR_SetRouting (qbool forceold);
 void MVM_error_cmd(const char *format, ...) DP_FUNC_PRINTF(1);
 void MVM_error_cmd(const char *format, ...)
 {
-       prvm_prog_t *prog = MVM_prog;
        static qbool processingError = false;
        char errorstring[MAX_INPUTLINE];
        va_list argptr;
+       int outfd = sys.outfd;
+
+       // set output to stderr
+       sys.outfd = fileno(stderr);
 
        va_start (argptr, format);
        dpvsnprintf (errorstring, sizeof(errorstring), format, argptr);
        va_end (argptr);
 
        if (host.framecount < 3)
-               Sys_Abort("Menu_Error: %s\n", errorstring);
+               Sys_Error("Menu_Error: %s", errorstring);
 
-       Con_Printf( "Menu_Error: %s\n", errorstring );
+       Con_Printf(CON_ERROR "Menu_Error: %s\n", errorstring);
 
-       if( !processingError ) {
+       if(!processingError)
+       {
                processingError = true;
-               PRVM_Crash(prog);
+               PRVM_Crash();
                processingError = false;
-       } else {
-               Con_Printf( "Menu_Error: Recursive call to MVM_error_cmd (from PRVM_Crash)!\n" );
        }
+       else
+               Sys_Error("Menu_Error: Recursive call to MVM_error_cmd (from PRVM_Crash)!");
 
-       // fall back to the normal menu
-
-       // say it
-       Con_Print("Falling back to normal menu\n");
-
+       Con_Print("Falling back to engine menu\n");
        key_dest = key_game;
-
-       // init the normal menu now -> this will also correct the menu router pointers
        MR_SetRouting (true);
 
        // reset the active scene, too (to be on the safe side ;))
        R_SelectScene( RST_CLIENT );
 
+       // prevent an endless loop if the error was triggered by a command
+       Cbuf_Clear(cmd_local->cbuf);
+
+       // restore configured outfd
+       sys.outfd = outfd;
+
        // Let video start at least
        Host_AbortCurrentFrame();
 }
@@ -5306,10 +5310,12 @@ static void MP_KeyEvent (int key, int ascii, qbool downevent)
 static void MP_Draw (void)
 {
        prvm_prog_t *prog = MVM_prog;
-       // declarations that are needed right now
-
        float oldquality;
 
+       // don't crash if we draw a frame between prog shutdown and restart, see Host_LoadConfig_f
+       if (!prog->loaded)
+               return;
+
        R_SelectScene( RST_MENU );
 
        // reset the temp entities each frame