diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 41cf583f5..2f9c69fe1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1298,7 +1298,7 @@ int main(int argc, char *argv[]) std::string gameid = getWorldGameId(commanded_world, true); if(gameid == "") gameid = g_settings->get("default_game"); - WorldSpec spec(commanded_world, "[commanded world]", gameid); + WorldSpec spec(commanded_world, "--world", gameid); worldspecs.push_back(spec); menudata.worlds.push_back(narrow_to_wide(spec.name) +L" ["+narrow_to_wide(spec.gameid)+L"]"); @@ -1363,7 +1363,7 @@ int main(int argc, char *argv[]) <<" ["<<worldspec.path<<"]"<<std::endl; } - // Delete map if requested + // Delete world if requested if(menudata.delete_world) { if(menudata.selected_world == -1){ @@ -1383,6 +1383,22 @@ int main(int argc, char *argv[]) continue; } + // Create new world if requested + if(menudata.create_world_name != L"") + { + std::string path = porting::path_user + DIR_DELIM + + "server" + DIR_DELIM + "worlds" + DIR_DELIM + + wide_to_narrow(menudata.create_world_name); + // Create world if it doesn't exist + if(!initializeWorld(path, menudata.create_world_gameid)){ + error_message = L"Failed to initialize world"; + errorstream<<wide_to_narrow(error_message)<<std::endl; + continue; + } + g_settings->set("selected_world_path", path); + continue; + } + playername = wide_to_narrow(menudata.name); password = translatePassword(playername, menudata.password); //infostream<<"Main: password hash: '"<<password<<"'"<<std::endl; |