refactor Content
This commit is contained in:
@@ -40,7 +40,7 @@ void ChunksStorage::remove(int x, int z) {
|
||||
static void verifyLoadedChunk(ContentIndices* indices, Chunk* chunk) {
|
||||
for (size_t i = 0; i < CHUNK_VOL; i++) {
|
||||
blockid_t id = chunk->voxels[i].id;
|
||||
if (indices->getBlockDef(id) == nullptr) {
|
||||
if (indices->blocks.get(id) == nullptr) {
|
||||
auto logline = logger.error();
|
||||
logline << "corruped block detected at " << i << " of chunk ";
|
||||
logline << chunk->x << "x" << chunk->z;
|
||||
@@ -79,6 +79,7 @@ std::shared_ptr<Chunk> ChunksStorage::create(int x, int z) {
|
||||
}
|
||||
|
||||
// reduce nesting on next modification
|
||||
// 25.06.2024: not now
|
||||
void ChunksStorage::getVoxels(VoxelsVolume* volume, bool backlight) const {
|
||||
const Content* content = level->content;
|
||||
auto indices = content->getIndices();
|
||||
@@ -137,7 +138,7 @@ void ChunksStorage::getVoxels(VoxelsVolume* volume, bool backlight) const {
|
||||
voxels[vidx] = cvoxels[cidx];
|
||||
light_t light = clights[cidx];
|
||||
if (backlight) {
|
||||
const Block* block = indices->getBlockDef(voxels[vidx].id);
|
||||
auto block = indices->blocks.get(voxels[vidx].id);
|
||||
if (block->lightPassing) {
|
||||
light = Lightmap::combine(
|
||||
min(15, Lightmap::extract(light, 0)+1),
|
||||
|
||||
Reference in New Issue
Block a user