1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make server world selection not brain dead and use gameid 'minetest' instead of 'mesetint'

This commit is contained in:
Perttu Ahola 2012-03-25 20:29:56 +03:00
parent 4fb6c07535
commit 6779036d25
110 changed files with 140 additions and 30 deletions

View file

@ -78,7 +78,13 @@ std::vector<SubgameSpec> getAvailableGames()
return specs;
}
#define LEGACY_GAMEID "mesetint"
#define LEGACY_GAMEID "minetest"
bool getWorldExists(const std::string &world_path)
{
return (fs::PathExists(world_path + DIR_DELIM + "map_meta.txt") ||
fs::PathExists(world_path + DIR_DELIM + "world.mt"));
}
std::string getWorldGameId(const std::string &world_path, bool can_be_legacy)
{
@ -95,6 +101,9 @@ std::string getWorldGameId(const std::string &world_path, bool can_be_legacy)
}
if(!conf.exists("gameid"))
return "";
// The "mesetint" gameid has been discarded
if(conf.get("gameid") == "mesetint")
return "minetest";
return conf.get("gameid");
}
@ -113,7 +122,9 @@ std::vector<WorldSpec> getAvailableWorlds()
continue;
std::string fullpath = *i + DIR_DELIM + dirvector[j].name;
std::string name = dirvector[j].name;
std::string gameid = getWorldGameId(fullpath);
// Just allow filling in the gameid always for now
bool can_be_legacy = true;
std::string gameid = getWorldGameId(fullpath, can_be_legacy);
WorldSpec spec(fullpath, name, gameid);
if(!spec.isValid()){
infostream<<"(invalid: "<<name<<") ";