1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Don't unload blocks if save failed

Improve error handling in saveBlock()
This commit is contained in:
kwolekr 2014-07-07 01:20:25 -04:00
parent e14c4cdd4c
commit 8b3ed78e53
11 changed files with 108 additions and 67 deletions

View file

@ -45,7 +45,7 @@ int Database_Dummy::Initialized(void)
void Database_Dummy::beginSave() {}
void Database_Dummy::endSave() {}
void Database_Dummy::saveBlock(MapBlock *block)
bool Database_Dummy::saveBlock(MapBlock *block)
{
DSTACK(__FUNCTION_NAME);
/*
@ -53,7 +53,10 @@ void Database_Dummy::saveBlock(MapBlock *block)
*/
if(block->isDummy())
{
return;
v3s16 p = block->getPos();
infostream<<"Database_Dummy::saveBlock(): WARNING: Not writing dummy block "
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"<<std::endl;
return true;
}
// Format used for writing
@ -76,6 +79,7 @@ void Database_Dummy::saveBlock(MapBlock *block)
m_database[getBlockAsInteger(p3d)] = tmp;
// We just wrote it to the disk so clear modified flag
block->resetModified();
return true;
}
MapBlock* Database_Dummy::loadBlock(v3s16 blockpos)