mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
Chunks::saveAndClear() fix (F5 fix)
This commit is contained in:
parent
87ec71154f
commit
a71314bdad
2 changed files with 12 additions and 4 deletions
|
|
@ -67,6 +67,10 @@ public:
|
||||||
WorldRegions& getRegions() {
|
WorldRegions& getRegions() {
|
||||||
return regions;
|
return regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool doesWriteLights() const {
|
||||||
|
return doWriteLights;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FILES_WORLD_FILES_H_
|
#endif // FILES_WORLD_FILES_H_
|
||||||
|
|
|
||||||
|
|
@ -487,11 +487,15 @@ void Chunks::saveAndClear(){
|
||||||
auto& regions = worldFiles->getRegions();
|
auto& regions = worldFiles->getRegions();
|
||||||
for (size_t i = 0; i < volume; i++){
|
for (size_t i = 0; i < volume; i++){
|
||||||
Chunk* chunk = chunks[i].get();
|
Chunk* chunk = chunks[i].get();
|
||||||
if (chunk) {
|
|
||||||
regions.put(chunk);
|
|
||||||
events->trigger(EVT_CHUNK_HIDDEN, chunk);
|
|
||||||
}
|
|
||||||
chunks[i] = nullptr;
|
chunks[i] = nullptr;
|
||||||
|
if (chunk == nullptr || !chunk->isLighted())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool lightsUnsaved = !chunk->isLoadedLights() &&
|
||||||
|
worldFiles->doesWriteLights();
|
||||||
|
if (!chunk->isUnsaved() && !lightsUnsaved)
|
||||||
|
continue;
|
||||||
|
regions.put(chunk);
|
||||||
}
|
}
|
||||||
chunksCount = 0;
|
chunksCount = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue