From a12e4764798438b13c9d801086bc352a7c764ce7 Mon Sep 17 00:00:00 2001 From: Joseph Carter Date: Thu, 18 May 2000 01:36:42 +0000 Subject: [PATCH] If new map requested and not found, try to restart the current one. If that also fails, DIE GRACEFULLY rather than continue to run with things all screwed up from the intermission settings. Fixes weird behavior under any mod where a map can change. --- source/sv_ccmds.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/sv_ccmds.c b/source/sv_ccmds.c index fe1cecb..9945e31 100644 --- a/source/sv_ccmds.c +++ b/source/sv_ccmds.c @@ -302,7 +302,8 @@ void SV_Give_f (void) } } - +// Use this to keep track of current level --KB +static char curlevel[MAX_QPATH] = ""; /* ====================== SV_Map_f @@ -331,6 +332,11 @@ void SV_Map_f (void) if (!f) { Con_Printf ("Can't find %s\n", expanded); + // If curlevel == level, something is SCREWED! --KB + if (stricmp (level, curlevel) == 0) + SV_Error ("map: cannot restart level\n"); + else + Cbuf_AddText (va("map %s", curlevel)); return; } fclose (f); @@ -338,6 +344,7 @@ void SV_Map_f (void) SV_BroadcastCommand ("changing\n"); SV_SendMessagesToAll (); + strcpy (curlevel, level); SV_SpawnServer (level); SV_BroadcastCommand ("reconnect\n");