From 0d525189f4d8392654a5e4c9ba9b89d3b7919c6a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 10 Apr 2002 21:03:02 +0000 Subject: [PATCH] fix some problems with error printing, especially when using the curses console --- qw/source/sv_main.c | 17 ++++++++++++----- qw/source/sv_progs.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 984a392cb..7389965d2 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -69,6 +69,7 @@ static const char rcsid[] = #include "QF/cmd.h" #include "QF/console.h" #include "QF/cvar.h" +#include "QF/dstring.h" #include "QF/model.h" #include "QF/msg.h" #include "QF/plugin.h" @@ -244,19 +245,25 @@ SV_Shutdown (void) void SV_Error (const char *error, va_list argptr) { - static char string[1024]; + dstring_t *string; static qboolean inerror = false; if (inerror) return; + string = dstring_new (); + inerror = true; - vsnprintf (string, sizeof (string), error, argptr); + dvsprintf (string, error, argptr); + dstring_insertstr (string, "server crashed: ", 0); + dstring_appendstr (string, "\n"); + SV_FinalMessage (string->str); - SV_FinalMessage (va ("server crashed: %s\n", string)); - - Sys_Print (stderr, error, argptr); + if (con_module) + con_module->functions->console->pC_Print (error, argptr); + else + Sys_Print (stderr, error, argptr); } /* diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index ec7388e16..6389e5d6f 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -179,7 +179,7 @@ SV_LoadProgs (void) PR_LoadProgs (&sv_pr_state, sv_progs->string, MAX_EDICTS, 0); if (!sv_pr_state.progs) - Sys_Error ("SV_LoadProgs: couldn't load %s", sv_progs->string); + Sys_Error ("SV_LoadProgs: couldn't load %s\n", sv_progs->string); // progs engine needs these globals anyway sv_globals.self = sv_pr_state.globals.self; sv_globals.time = sv_pr_state.globals.time;