summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-11 15:20:42 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-11 15:20:42 +0200
commite71d75ed9a8893b2ee67c6953ab633dd210c072c (patch)
treef55822fa3a84314d8b5ad2cafa02190dc2a287cc /src/main.cpp
parenta4a35f659b755bcf2996838be30e06415ae2027b (diff)
downloadminetest-e71d75ed9a8893b2ee67c6953ab633dd210c072c.tar.gz
minetest-e71d75ed9a8893b2ee67c6953ab633dd210c072c.tar.bz2
minetest-e71d75ed9a8893b2ee67c6953ab633dd210c072c.zip
--gameid list
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 12 insertions, 8 deletions
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<std::string> gameids = getAvailableGameIds();
+ for(std::set<std::string>::const_iterator i = gameids.begin();
+ i != gameids.end(); i++)
+ dstream<<(*i)<<std::endl;
+ return 0;
+ }
+
// Print startup message
actionstream<<PROJECT_NAME<<
" with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
@@ -1010,12 +1020,6 @@ int main(int argc, char *argv[])
SubgameSpec gamespec = findSubgame(gameid);
if(!gamespec.isValid()){
errorstream<<"Game \""<<gameid<<"\" not found"<<std::endl;
- std::set<std::string> gameids = getAvailableGameIds();
- infostream<<"Available gameids: ";
- for(std::set<std::string>::const_iterator i = gameids.begin();
- i != gameids.end(); i++)
- infostream<<(*i)<<" ";
- infostream<<std::endl;
return 1;
}