mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix missing map_meta.txt error when creating new worlds
A missing map_meta.txt should be treated simply as if there were a blank file.
This commit is contained in:
parent
ca217d0416
commit
eeea454bff
1 changed files with 13 additions and 11 deletions
10
src/map.cpp
10
src/map.cpp
|
@ -3109,7 +3109,7 @@ void ServerMap::saveMapMeta()
|
||||||
|
|
||||||
createDirs(m_savedir);
|
createDirs(m_savedir);
|
||||||
|
|
||||||
std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
|
std::string fullpath = m_savedir + DIR_DELIM "map_meta.txt";
|
||||||
std::ostringstream ss(std::ios_base::binary);
|
std::ostringstream ss(std::ios_base::binary);
|
||||||
|
|
||||||
Settings params;
|
Settings params;
|
||||||
|
@ -3133,20 +3133,22 @@ void ServerMap::loadMapMeta()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
|
Settings params;
|
||||||
std::string fullpath = m_savedir + DIR_DELIM "map_meta.txt";
|
std::string fullpath = m_savedir + DIR_DELIM "map_meta.txt";
|
||||||
|
|
||||||
|
if (fs::PathExists(fullpath)) {
|
||||||
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||||
if (!is.good()) {
|
if (!is.good()) {
|
||||||
errorstream << "ServerMap::loadMapMeta(): "
|
errorstream << "ServerMap::loadMapMeta(): "
|
||||||
<< "could not open" << fullpath << std::endl;
|
"could not open " << fullpath << std::endl;
|
||||||
throw FileNotGoodException("Cannot open map metadata");
|
throw FileNotGoodException("Cannot open map metadata");
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings params;
|
|
||||||
|
|
||||||
if (!params.parseConfigLines(is, "[end_of_params]")) {
|
if (!params.parseConfigLines(is, "[end_of_params]")) {
|
||||||
throw SerializationError("ServerMap::loadMapMeta(): "
|
throw SerializationError("ServerMap::loadMapMeta(): "
|
||||||
"[end_of_params] not found!");
|
"[end_of_params] not found!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_emerge->loadParamsFromSettings(¶ms);
|
m_emerge->loadParamsFromSettings(¶ms);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue