From e71d75ed9a8893b2ee67c6953ab633dd210c072c Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 11 Mar 2012 15:20:42 +0200 Subject: --gameid list --- src/main.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 00776d89c..b1849e4a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -783,7 +783,7 @@ int main(int argc, char *argv[]) allowed_options.insert("logfile", ValueSpec(VALUETYPE_STRING, "Set logfile path (debug.txt)")); allowed_options.insert("gameid", ValueSpec(VALUETYPE_STRING, - "Set gameid")); + "Set gameid (\"--gameid list\" prints available ones)")); #ifndef SERVER allowed_options.insert("speedtests", ValueSpec(VALUETYPE_FLAG, "Run speed tests")); @@ -867,7 +867,17 @@ int main(int argc, char *argv[]) // Debug handler BEGIN_DEBUG_EXCEPTION_HANDLER - + + // List gameids if requested + if(cmd_args.exists("gameid") && cmd_args.get("gameid") == "list") + { + std::set gameids = getAvailableGameIds(); + for(std::set::const_iterator i = gameids.begin(); + i != gameids.end(); i++) + dstream<<(*i)< gameids = getAvailableGameIds(); - infostream<<"Available gameids: "; - for(std::set::const_iterator i = gameids.begin(); - i != gameids.end(); i++) - infostream<<(*i)<<" "; - infostream<