refactor: WorldRegions and chunks saving
This commit is contained in:
+6
-14
@@ -35,12 +35,10 @@ World::World(
|
||||
) : name(std::move(name)),
|
||||
generator(std::move(generator)),
|
||||
seed(seed),
|
||||
settings(settings),
|
||||
content(content),
|
||||
packs(packs)
|
||||
{
|
||||
wfile = std::make_unique<WorldFiles>(directory, settings.debug);
|
||||
}
|
||||
packs(packs),
|
||||
wfile(std::make_unique<WorldFiles>(directory, settings.debug))
|
||||
{}
|
||||
|
||||
World::~World(){
|
||||
}
|
||||
@@ -57,16 +55,10 @@ void World::write(Level* level) {
|
||||
auto& regions = wfile->getRegions();
|
||||
|
||||
for (size_t i = 0; i < chunks->volume; i++) {
|
||||
auto chunk = chunks->chunks[i];
|
||||
if (chunk == nullptr || !chunk->flags.lighted)
|
||||
continue;
|
||||
bool lightsUnsaved = !chunk->flags.loadedLights &&
|
||||
settings.debug.doWriteLights.get();
|
||||
if (!chunk->flags.unsaved && !lightsUnsaved)
|
||||
continue;
|
||||
regions.put(chunk.get());
|
||||
if (auto chunk = chunks->chunks[i]) {
|
||||
regions.put(chunk.get());
|
||||
}
|
||||
}
|
||||
|
||||
wfile->write(this, content);
|
||||
auto playerFile = dynamic::Map();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user