X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FBlockLookup.hpp;h=122b3c76f7e76374eaf50aa264513d54564b43c6;hb=dbfcb12348b80e2582f710acb1e4ed0011889ba2;hp=4c8b12ba41a6a50f14c4f5033b685ce42ddaeca3;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/world/BlockLookup.hpp b/src/world/BlockLookup.hpp index 4c8b12b..122b3c7 100644 --- a/src/world/BlockLookup.hpp +++ b/src/world/BlockLookup.hpp @@ -10,13 +10,13 @@ namespace blank { class BlockLookup { public: - // resolve chunk/position from oob coordinates + /// resolve chunk/position from oob coordinates BlockLookup(Chunk *c, const Chunk::Pos &p) noexcept; - // resolve chunk/position from ib coordinates and direction + /// resolve chunk/position from ib coordinates and direction BlockLookup(Chunk *c, const Chunk::Pos &p, Block::Face dir) noexcept; - // check if lookup was successful + /// check if lookup was successful operator bool() const { return chunk; } // only valid if lookup was successful @@ -26,6 +26,8 @@ public: const BlockType &GetType() const noexcept { return GetChunk().Type(GetBlock()); } int GetLight() const noexcept { return GetChunk().GetLight(GetBlockPos()); } + void SetBlock(const Block &b) noexcept { GetChunk().SetBlock(GetBlockPos(), b); } + // traverse in given direction BlockLookup Next(Block::Face f) const { return BlockLookup(chunk, pos, f); }