From: kwolekr Date: Mon, 29 Oct 2012 02:02:51 +0000 (-0400) Subject: Only clear block modified flag if writing to db was successful X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=a785522194f98f2a0d7799c20dbfaaa55730870e;p=zefram%2Fminetest%2Fminetest_engine.git Only clear block modified flag if writing to db was successful --- 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)