regions related code moved from WorldFiles to WorldRegions
This commit is contained in:
@@ -410,6 +410,7 @@ void Chunks::setCenter(int32_t x, int32_t z) {
|
||||
}
|
||||
|
||||
void Chunks::translate(int32_t dx, int32_t dz) {
|
||||
auto& regions = worldFiles->getRegions();
|
||||
for (uint i = 0; i < volume; i++){
|
||||
chunksSecond[i] = nullptr;
|
||||
}
|
||||
@@ -422,8 +423,9 @@ void Chunks::translate(int32_t dx, int32_t dz) {
|
||||
continue;
|
||||
if (nx < 0 || nz < 0 || nx >= int(w) || nz >= int(d)){
|
||||
events->trigger(EVT_CHUNK_HIDDEN, chunk.get());
|
||||
if (worldFiles)
|
||||
worldFiles->put(chunk.get());
|
||||
if (worldFiles) {
|
||||
regions.put(chunk.get());
|
||||
}
|
||||
chunksCount--;
|
||||
continue;
|
||||
}
|
||||
@@ -482,10 +484,11 @@ bool Chunks::putChunk(std::shared_ptr<Chunk> chunk) {
|
||||
}
|
||||
|
||||
void Chunks::saveAndClear(){
|
||||
auto& regions = worldFiles->getRegions();
|
||||
for (size_t i = 0; i < volume; i++){
|
||||
Chunk* chunk = chunks[i].get();
|
||||
if (chunk) {
|
||||
worldFiles->put(chunk);
|
||||
regions.put(chunk);
|
||||
events->trigger(EVT_CHUNK_HIDDEN, chunk);
|
||||
}
|
||||
chunks[i] = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user