summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-13 00:06:37 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-13 00:06:37 +0200
commit591527d8787b6dfaafd2113bc001fe892b3eb0fb (patch)
tree8c6391f41af9b027779329c8ce68358099a781cc /src/main.cpp
parent82073025ccc551c2fd205cc1dc6fcecac61cc7ea (diff)
downloadminetest-591527d8787b6dfaafd2113bc001fe892b3eb0fb.tar.gz
minetest-591527d8787b6dfaafd2113bc001fe892b3eb0fb.tar.bz2
minetest-591527d8787b6dfaafd2113bc001fe892b3eb0fb.zip
World creation button and dialog and functionality
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
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;