diff options
author | sfan5 <sfan5@live.de> | 2014-07-08 20:04:37 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2014-07-12 17:38:17 +0200 |
commit | eec456be63f6fee8604f7a9c40aa41a1af3f1fac (patch) | |
tree | e97d792d648fa6f76c1479ac3e978ada2c075a48 /src/main.cpp | |
parent | 3feece1f2887eda368c0a9e42e3ab26b4b754354 (diff) | |
download | minetest-eec456be63f6fee8604f7a9c40aa41a1af3f1fac.tar.gz minetest-eec456be63f6fee8604f7a9c40aa41a1af3f1fac.tar.bz2 minetest-eec456be63f6fee8604f7a9c40aa41a1af3f1fac.zip |
Move MapBlock (de)serializing code out of Database class
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 8a9d14d0a..bb2ac5faf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1296,9 +1296,13 @@ int main(int argc, char *argv[]) new_db->beginSave(); for (std::list<v3s16>::iterator i = blocks.begin(); i != blocks.end(); i++) { MapBlock *block = old_map.loadBlock(*i); - new_db->saveBlock(block); - MapSector *sector = old_map.getSectorNoGenerate(v2s16(i->X, i->Z)); - sector->deleteBlock(block); + if (!block) { + errorstream << "Failed to load block " << PP(*i) << ", skipping it."; + } else { + old_map.saveBlock(block, new_db); + MapSector *sector = old_map.getSectorNoGenerate(v2s16(i->X, i->Z)); + sector->deleteBlock(block); + } ++count; if (count % 500 == 0) actionstream << "Migrated " << count << " blocks " @@ -1947,4 +1951,3 @@ int main(int argc, char *argv[]) } //END - |