From a785522194f98f2a0d7799c20dbfaaa55730870e Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 28 Oct 2012 22:02:51 -0400 Subject: [PATCH] Only clear block modified flag if writing to db was successful --- src/map.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 0e9b121d..6147bb63 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3344,19 +3344,27 @@ void ServerMap::saveBlock(MapBlock *block) std::string tmp = o.str(); const char *bytes = tmp.c_str(); - if(sqlite3_bind_int64(m_database_write, 1, getBlockAsInteger(p3d)) != SQLITE_OK) + bool success = true; + if(sqlite3_bind_int64(m_database_write, 1, getBlockAsInteger(p3d)) != SQLITE_OK) { infostream<<"WARNING: Block position failed to bind: "<resetModified(); + if (success) + block->resetModified(); } void ServerMap::loadBlock(std::string sectordir, std::string blockfile, MapSector *sector, bool save_after_load) -- 2.30.2