X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fchunk.cpp;h=569bb11c9f8e240ff25864cf7323ce8aed579504;hb=f2f254f8d576b48fde9305c3d2927552d1d4c20d;hp=50595f4856526220a44eb069c4ab9b6374a0d2b9;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/world/chunk.cpp b/src/world/chunk.cpp index 50595f4..569bb11 100644 --- a/src/world/chunk.cpp +++ b/src/world/chunk.cpp @@ -169,15 +169,16 @@ void Chunk::SetBlock(int index, const Block &block) noexcept { } else if (!new_type.block_light && old_type.block_light) { // obstacle removed int level = 0; + Pos pos(ToPos(index)); for (int face = 0; face < Block::FACE_COUNT; ++face) { - BlockLookup next_block(this, ToPos(index), Block::Face(face)); + BlockLookup next_block(this, pos, Block::Face(face)); if (next_block) { - level = std::min(level, next_block.GetLight()); + level = std::max(level, next_block.GetLight()); } } if (level > 1) { SetLight(index, level - 1); - light_queue.emplace(this, ToPos(index)); + light_queue.emplace(this, pos); work_light(); } } @@ -449,7 +450,6 @@ bool Chunk::Intersection( float &dist, glm::vec3 &normal ) const noexcept { - // TODO: should be possible to heavily optimize this int idx = 0; blkid = -1; dist = std::numeric_limits::infinity(); @@ -750,7 +750,7 @@ bool ChunkLoader::Queued(const Chunk::Pos &pos) noexcept { return true; } } - return nullptr; + return false; } bool ChunkLoader::Known(const Chunk::Pos &pos) noexcept {