X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunkIndex.hpp;fp=src%2Fworld%2FChunkIndex.hpp;h=91fc704909114a2980f60346364d1a4d7ff97934;hb=825f479edf9867938b6789215ad7ae6303596cba;hp=17b9dd697de901f38b4febbb8e6ba4e40241c2d2;hpb=78dcbeb7a905c4c153cb1b20e23f5adc1efc6d7e;p=blank.git diff --git a/src/world/ChunkIndex.hpp b/src/world/ChunkIndex.hpp index 17b9dd6..91fc704 100644 --- a/src/world/ChunkIndex.hpp +++ b/src/world/ChunkIndex.hpp @@ -1,7 +1,9 @@ #ifndef BLANK_WORLD_CHUNKINDEX_HPP_ #define BLANK_WORLD_CHUNKINDEX_HPP_ +#include "BlockLookup.hpp" #include "Chunk.hpp" +#include "../rand/GaloisLFSR.hpp" #include @@ -30,6 +32,13 @@ public: Chunk *operator [](int i) noexcept { return chunks[i]; } const Chunk *operator [](int i) const noexcept { return chunks[i]; } + Chunk *RandomChunk(GaloisLFSR &rand) { + return rand.From(chunks); + } + BlockLookup RandomBlock(GaloisLFSR &rand) { + return BlockLookup(RandomChunk(rand), Chunk::ToPos(rand.Next() % Chunk::size)); + } + int Extent() const noexcept { return extent; } Chunk::Pos CoordsBegin() const noexcept { return base - Chunk::Pos(extent); }