mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
refactor: WorldRegions and chunks saving
This commit is contained in:
parent
f206042b00
commit
c67e4b04bb
8 changed files with 50 additions and 45 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue