add chunk 'entities' flag
This commit is contained in:
@@ -35,6 +35,7 @@ public:
|
||||
bool lighted: 1;
|
||||
bool unsaved: 1;
|
||||
bool loadedLights: 1;
|
||||
bool entities: 1;
|
||||
} flags {};
|
||||
|
||||
/// @brief Block inventories map where key is index of block in voxels array
|
||||
|
||||
@@ -717,7 +717,7 @@ void Chunks::save(Chunk* chunk) {
|
||||
list.put(level->entities->serialize(entity));
|
||||
}
|
||||
if (!entities.empty()) {
|
||||
chunk->flags.unsaved = true;
|
||||
chunk->flags.entities = true;
|
||||
}
|
||||
worldFiles->getRegions().put(chunk, json::to_binary(root, true));
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ std::shared_ptr<Chunk> ChunksStorage::create(int x, int z) {
|
||||
|
||||
if (auto map = regions.fetchEntities(chunk->x, chunk->z)) {
|
||||
level->entities->loadEntities(std::move(map));
|
||||
chunk->flags.entities = true;
|
||||
}
|
||||
|
||||
chunk->flags.loaded = true;
|
||||
|
||||
Reference in New Issue
Block a user