mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 04:31:09 +00:00
Merge pull request #589 from JoBergeron/listmap-cmd
added listmaps command
This commit is contained in:
commit
0fdc3750e0
2 changed files with 39 additions and 0 deletions
|
@ -17,3 +17,7 @@ original clients (Vanilla Quake II) commands are still in place.
|
|||
entities.
|
||||
|
||||
* **teleport <x y z>**: Teleports the player to the given coordinates.
|
||||
|
||||
* **listmaps**: Lists available maps for the player to load. Maps from
|
||||
loaded pak files will be listed first followed by maps placed in
|
||||
the current game's maps folder.
|
||||
|
|
|
@ -309,6 +309,40 @@ SV_Map_f(void)
|
|||
SV_GameMap_f();
|
||||
}
|
||||
|
||||
/*
|
||||
* Lists available maps for user to load.
|
||||
*/
|
||||
SV_ListMaps_f(void)
|
||||
{
|
||||
char **userMapNames;
|
||||
int nUserMaps = 0;
|
||||
int i;
|
||||
char* mapName;
|
||||
|
||||
Com_Printf("\n");
|
||||
|
||||
if ((userMapNames = FS_ListFiles2("maps/*.bsp", &nUserMaps, 0, 0)) != 0)
|
||||
{
|
||||
for (i = 0; i < nUserMaps - 1; i++)
|
||||
{
|
||||
if (strrchr(userMapNames[i], '/'))
|
||||
{
|
||||
mapName = strrchr(userMapNames[i], '/') + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mapName = userMapNames[i];
|
||||
}
|
||||
|
||||
mapName = strtok(mapName, ".");
|
||||
|
||||
Com_Printf("%s\n", mapName);
|
||||
}
|
||||
|
||||
FS_FreeList(userMapNames, nUserMaps);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Kick a user off of the server
|
||||
*/
|
||||
|
@ -654,6 +688,7 @@ SV_InitOperatorCommands(void)
|
|||
Cmd_AddCommand("dumpuser", SV_DumpUser_f);
|
||||
|
||||
Cmd_AddCommand("map", SV_Map_f);
|
||||
Cmd_AddCommand("listmaps", SV_ListMaps_f);
|
||||
Cmd_AddCommand("demomap", SV_DemoMap_f);
|
||||
Cmd_AddCommand("gamemap", SV_GameMap_f);
|
||||
Cmd_AddCommand("setmaster", SV_SetMaster_f);
|
||||
|
|
Loading…
Reference in a new issue