From f37e8be035a395f9cc4ae3b1faab33a91c935299 Mon Sep 17 00:00:00 2001 From: stevenaaus Date: Sun, 29 Aug 2010 23:03:50 +0000 Subject: [PATCH] Remove any trailing ".bsp" from mapname git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@313 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/host_cmd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/host_cmd.c b/quakespasm/Quake/host_cmd.c index 1287abea..1579f847 100644 --- a/quakespasm/Quake/host_cmd.c +++ b/quakespasm/Quake/host_cmd.c @@ -827,6 +827,7 @@ void Host_Map_f (void) key_dest = key_game; // remove console or menu SCR_BeginLoadingPlaque (); +// mapstring isn't used anywhere! cls.mapstring[0] = 0; for (i = 0; i < Cmd_Argc(); i++) { @@ -836,7 +837,17 @@ void Host_Map_f (void) strcat (cls.mapstring, "\n"); svs.serverflags = 0; // haven't completed an episode yet - strcpy (name, Cmd_Argv(1)); + + // remove (any) trailing ".bsp" from mapname S.A. + + char mapname[64], *needle; + strcpy (mapname, Cmd_Argv(1)); + + needle = strstr(mapname,".bsp"); + if (needle && (needle + 4 == mapname + Q_strlen(mapname))) + needle[0] = '\0'; + + strcpy (name, mapname); SV_SpawnServer (name); if (!sv.active) return;