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.
This commit is contained in:
Joseph Carter 2000-05-18 01:36:42 +00:00
parent 3a88e0f876
commit a12e476479

View file

@ -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 SV_Map_f
@ -331,6 +332,11 @@ void SV_Map_f (void)
if (!f) if (!f)
{ {
Con_Printf ("Can't find %s\n", expanded); 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; return;
} }
fclose (f); fclose (f);
@ -338,6 +344,7 @@ void SV_Map_f (void)
SV_BroadcastCommand ("changing\n"); SV_BroadcastCommand ("changing\n");
SV_SendMessagesToAll (); SV_SendMessagesToAll ();
strcpy (curlevel, level);
SV_SpawnServer (level); SV_SpawnServer (level);
SV_BroadcastCommand ("reconnect\n"); SV_BroadcastCommand ("reconnect\n");