summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-09-11 18:22:05 -0400
committerShadowNinja <shadowninja@minetest.net>2014-09-21 14:39:35 -0400
commit6bc4cad0eddd7a7cf593ca1471599e2d75727379 (patch)
treed05d5f039648d18f49fc0cf56132b2e9a5c88e09 /src/map.cpp
parent2ae5d3f3abc7ac5ee96c4dfc7eeead045fdc775e (diff)
downloadminetest-6bc4cad0eddd7a7cf593ca1471599e2d75727379.tar.gz
minetest-6bc4cad0eddd7a7cf593ca1471599e2d75727379.tar.bz2
minetest-6bc4cad0eddd7a7cf593ca1471599e2d75727379.zip
Split settings into seperate source and header files
This also cleans up settings a bit
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 236972ae9..1fe0ca9ad 100644
--- a/src/map.cpp
+++ b/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(&params);
- 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)