Permalink
Browse files

listmaps server command

  • Loading branch information...
mbasaglia committed Jan 5, 2016
1 parent 57a255b commit 9914cb0e48a5ff31548d54677ed4d82902a900ed
Showing with 30 additions and 0 deletions.
  1. +30 −0 daemon/src/engine/qcommon/common.cpp
@@ -1486,6 +1486,34 @@ void Com_In_Restart_f()
IN_Restart();
}
void Com_ListMaps_f()
{
std::vector<std::string> maps;
FS::RefreshPaks();
std::error_code ignore;
for ( const auto& pak : FS::GetAvailablePaks() )
{
FS::PakPath::LoadPakPrefix(pak, "maps", ignore);
}
for ( const auto& pak : FS::PakPath::ListFiles("maps", ignore) )
{
volatile auto foo = pak;
if ( Str::IsSuffix(".bsp", pak) )
{
maps.push_back( pak );
}
}
std::sort( maps.begin(), maps.end() );
maps.erase( std::unique( maps.begin(), maps.end() ), maps.end() );
for ( const auto& map: maps )
{
Com_Printf("%s", map.c_str());
}
}
/*
=================
Com_Init
@@ -1570,6 +1598,8 @@ void Com_Init( char *commandLine )
Cmd_AddCommand( "in_restart", Com_In_Restart_f );
Cmd_AddCommand( "listmaps", Com_ListMaps_f );
// Pick a qport value that is nice and random.
// As machines get faster, Com_Milliseconds() can't be used
// anymore, as it results in a smaller and smaller range of

0 comments on commit 9914cb0

Please sign in to comment.