mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Don't unload blocks if save failed
Improve error handling in saveBlock()
This commit is contained in:
parent
e14c4cdd4c
commit
8b3ed78e53
11 changed files with 108 additions and 67 deletions
19
src/map.cpp
19
src/map.cpp
|
@ -1473,11 +1473,11 @@ void Map::timerUpdate(float dtime, float unload_timeout,
|
|||
v3s16 p = block->getPos();
|
||||
|
||||
// Save if modified
|
||||
if(block->getModified() != MOD_STATE_CLEAN
|
||||
&& save_before_unloading)
|
||||
if (block->getModified() != MOD_STATE_CLEAN && save_before_unloading)
|
||||
{
|
||||
modprofiler.add(block->getModifiedReason(), 1);
|
||||
saveBlock(block);
|
||||
if (!saveBlock(block))
|
||||
continue;
|
||||
saved_blocks_count++;
|
||||
}
|
||||
|
||||
|
@ -3253,20 +3253,23 @@ bool ServerMap::loadSectorFull(v2s16 p2d)
|
|||
}
|
||||
#endif
|
||||
|
||||
void ServerMap::beginSave() {
|
||||
void ServerMap::beginSave()
|
||||
{
|
||||
dbase->beginSave();
|
||||
}
|
||||
|
||||
void ServerMap::endSave() {
|
||||
void ServerMap::endSave()
|
||||
{
|
||||
dbase->endSave();
|
||||
}
|
||||
|
||||
void ServerMap::saveBlock(MapBlock *block)
|
||||
bool ServerMap::saveBlock(MapBlock *block)
|
||||
{
|
||||
dbase->saveBlock(block);
|
||||
return dbase->saveBlock(block);
|
||||
}
|
||||
|
||||
void ServerMap::loadBlock(std::string sectordir, std::string blockfile, MapSector *sector, bool save_after_load)
|
||||
void ServerMap::loadBlock(std::string sectordir, std::string blockfile,
|
||||
MapSector *sector, bool save_after_load)
|
||||
{
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue