mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
improved old map support
This commit is contained in:
parent
dc6966cb9d
commit
3236032101
21
src/map.cpp
21
src/map.cpp
@ -5122,13 +5122,30 @@ MapSector* ServerMap::loadSectorMeta(std::string dirname)
|
|||||||
v2s16 p2d = getSectorPos(dirname);
|
v2s16 p2d = getSectorPos(dirname);
|
||||||
std::string dir = m_savedir + "/sectors/" + dirname;
|
std::string dir = m_savedir + "/sectors/" + dirname;
|
||||||
|
|
||||||
|
ServerMapSector *sector = NULL;
|
||||||
|
|
||||||
std::string fullpath = dir + "/meta";
|
std::string fullpath = dir + "/meta";
|
||||||
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||||
if(is.good() == false)
|
if(is.good() == false)
|
||||||
|
{
|
||||||
|
// If the directory exists anyway, it probably is in some old
|
||||||
|
// format. Just go ahead and create the sector.
|
||||||
|
if(fs::PathExists(dir))
|
||||||
|
{
|
||||||
|
dstream<<"ServerMap::loadSectorMeta(): Sector metafile "
|
||||||
|
<<fullpath<<" doesn't exist but directory does."
|
||||||
|
<<" Continuing with a sector with no metadata."
|
||||||
|
<<std::endl;
|
||||||
|
sector = createSector(p2d);
|
||||||
|
}
|
||||||
|
else
|
||||||
throw FileNotGoodException("Cannot open sector metafile");
|
throw FileNotGoodException("Cannot open sector metafile");
|
||||||
|
}
|
||||||
ServerMapSector *sector = ServerMapSector::deSerialize
|
else
|
||||||
|
{
|
||||||
|
sector = ServerMapSector::deSerialize
|
||||||
(is, this, p2d, m_sectors);
|
(is, this, p2d, m_sectors);
|
||||||
|
}
|
||||||
|
|
||||||
sector->differs_from_disk = false;
|
sector->differs_from_disk = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user