mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Split settings into seperate source and header files
This also cleans up settings a bit
This commit is contained in:
parent
2ae5d3f3ab
commit
6bc4cad0ed
27 changed files with 996 additions and 941 deletions
30
src/map.cpp
30
src/map.cpp
|
@ -3065,37 +3065,25 @@ void ServerMap::loadMapMeta()
|
|||
{
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
|
||||
/*infostream<<"ServerMap::loadMapMeta(): Loading map metadata"
|
||||
<<std::endl;*/
|
||||
|
||||
std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
|
||||
std::string fullpath = m_savedir + DIR_DELIM "map_meta.txt";
|
||||
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||
if(is.good() == false)
|
||||
{
|
||||
infostream<<"ERROR: ServerMap::loadMapMeta(): "
|
||||
<<"could not open"<<fullpath<<std::endl;
|
||||
if (!is.good()) {
|
||||
errorstream << "ServerMap::loadMapMeta(): "
|
||||
<< "could not open" << fullpath << std::endl;
|
||||
throw FileNotGoodException("Cannot open map metadata");
|
||||
}
|
||||
|
||||
Settings params;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(is.eof())
|
||||
throw SerializationError
|
||||
("ServerMap::loadMapMeta(): [end_of_params] not found");
|
||||
std::string line;
|
||||
std::getline(is, line);
|
||||
std::string trimmedline = trim(line);
|
||||
if(trimmedline == "[end_of_params]")
|
||||
break;
|
||||
params.parseConfigLine(line);
|
||||
if (!params.parseConfigLines(is, "[end_of_params]")) {
|
||||
throw SerializationError("ServerMap::loadMapMeta(): "
|
||||
"[end_of_params] not found!");
|
||||
}
|
||||
|
||||
m_emerge->loadParamsFromSettings(¶ms);
|
||||
|
||||
verbosestream<<"ServerMap::loadMapMeta(): seed="
|
||||
<< m_emerge->params.seed<<std::endl;
|
||||
verbosestream << "ServerMap::loadMapMeta(): seed="
|
||||
<< m_emerge->params.seed << std::endl;
|
||||
}
|
||||
|
||||
void ServerMap::saveSectorMeta(ServerMapSector *sector)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue