1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Move MapBlock (de)serializing code out of Database class

This commit is contained in:
sfan5 2014-07-08 20:04:37 +02:00
parent 3feece1f28
commit eec456be63
12 changed files with 118 additions and 492 deletions

View file

@ -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