mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
World creation button and dialog and functionality
This commit is contained in:
parent
82073025cc
commit
591527d878
11 changed files with 492 additions and 87 deletions
20
src/main.cpp
20
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue