std::mutex mut_; | std::mutex mut_; | ||||
private: | private: | ||||
std::unique_ptr<LightServer> lighting_; | |||||
std::map<std::pair<int, int>, Chunk> chunks_; | std::map<std::pair<int, int>, Chunk> chunks_; | ||||
std::vector<Chunk *> activeChunks_; | std::vector<Chunk *> activeChunks_; | ||||
std::vector<std::pair<ChunkPos, Chunk *>> tickChunks_; | std::vector<std::pair<ChunkPos, Chunk *>> tickChunks_; | ||||
std::deque<Chunk *> chunkInitList_; | std::deque<Chunk *> chunkInitList_; | ||||
std::vector<TilePos> debugBoxes_; | std::vector<TilePos> debugBoxes_; | ||||
// The lighting server must destruct first. Until it has been destructed, | |||||
// it might call onLightChunkUpdated. If that happens after some other | |||||
// members have destructed, we have a problem. | |||||
// TODO: Rewrite this to not use a callback-based interface. | |||||
std::unique_ptr<LightServer> lighting_; | |||||
}; | }; | ||||
/* | /* |
ID id, World *world, std::unique_ptr<WorldGen> gen, | ID id, World *world, std::unique_ptr<WorldGen> gen, | ||||
std::vector<std::unique_ptr<EntityCollection>> &&colls): | std::vector<std::unique_ptr<EntityCollection>> &&colls): | ||||
id_(id), world_(world), gen_(std::move(gen)), | id_(id), world_(world), gen_(std::move(gen)), | ||||
lighting_(std::make_unique<LightServer>(*this)), | |||||
entColls_(std::move(colls)) { | |||||
entColls_(std::move(colls)), | |||||
lighting_(std::make_unique<LightServer>(*this)) { | |||||
for (auto &coll: entColls_) { | for (auto &coll: entColls_) { | ||||
entCollsByType_[coll->type()] = coll.get(); | entCollsByType_[coll->type()] = coll.get(); |