client.h (client_state_t): added mapname[128] as a new member to hold the

current map file name without path and extension.
cl_parse.c (CL_ParseServerInfo): copy the naked name of the map file to
the cl structure.
host_cmd.c (Host_Map_f): print the current map name if no arguments are
given. print help message if not connected.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@16 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-02-16 09:47:04 +00:00
parent 566ead5ada
commit 359116f394
3 changed files with 24 additions and 0 deletions

View File

@ -346,6 +346,9 @@ void CL_ParseServerInfo (void)
// now we try to load everything else until a cache allocation fails
//
// copy the naked name of the map file to the cl structure -- O.S
COM_StripExtension (COM_SkipPath(model_precache[1]), cl.mapname);
for (i=1 ; i<nummodels ; i++)
{
cl.model_precache[i] = Mod_ForName (model_precache[i], false);

View File

@ -207,6 +207,7 @@ typedef struct
struct model_s *model_precache[MAX_MODELS];
struct sfx_s *sound_precache[MAX_SOUNDS];
char mapname[128];
char levelname[128]; // for display on solo scoreboard //johnfitz -- was 40.
int viewentity; // cl_entitites[cl.viewentity] = player
int maxclients;

View File

@ -796,6 +796,26 @@ void Host_Map_f (void)
int i;
char name[MAX_QPATH];
if (Cmd_Argc() < 2) //no map name given
{
if (cls.state == ca_dedicated)
{
if (sv.active)
Con_Printf ("Current map: %s\n", sv.name);
else
Con_Printf ("Server not active\n");
}
else if (cls.state == ca_connected)
{
Con_Printf ("Current map: %s ( %s )\n", cl.levelname, cl.mapname);
}
else
{
Con_Printf ("map <levelname>: start a new server\n");
}
return;
}
if (cmd_source != src_command)
return;