X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunkStore.hpp;h=a0fd0f93686b07b68a934160c658cc4390828e76;hb=7bd3601fafbecae415bd96fc24404b21338cd7a4;hp=68434bbd84952489a98fa4dd9b2490ad7606cdd9;hpb=13e676a6e49128ebc6c63b8dd08bef51d360e8e9;p=blank.git diff --git a/src/world/ChunkStore.hpp b/src/world/ChunkStore.hpp index 68434bb..a0fd0f9 100644 --- a/src/world/ChunkStore.hpp +++ b/src/world/ChunkStore.hpp @@ -13,20 +13,23 @@ class ChunkIndex; class ChunkStore { public: - ChunkStore(const BlockTypeRegistry &); + explicit ChunkStore(const BlockTypeRegistry &); ~ChunkStore(); ChunkStore(const ChunkStore &) = delete; ChunkStore &operator =(const ChunkStore &) = delete; public: - ChunkIndex &MakeIndex(const Chunk::Pos &base, int extent); + ChunkIndex &MakeIndex(const ExactLocation::Coarse &base, int extent); void UnregisterIndex(ChunkIndex &); + ChunkIndex *ClosestIndex(const ExactLocation::Coarse &pos); + /// returns nullptr if given position is not loaded - Chunk *Get(const Chunk::Pos &); + Chunk *Get(const ExactLocation::Coarse &) noexcept; + const Chunk *Get(const ExactLocation::Coarse &) const noexcept; /// returns nullptr if given position is not indexed - Chunk *Allocate(const Chunk::Pos &); + Chunk *Allocate(const ExactLocation::Coarse &); std::list::iterator begin() noexcept { return loaded.begin(); } std::list::iterator end() noexcept { return loaded.end(); } @@ -42,7 +45,7 @@ public: /// get coordinates of a missing chunk /// this will return garbage if none are actually missing - Chunk::Pos NextMissing() noexcept; + ExactLocation::Coarse NextMissing() noexcept; void Clean();