World indices check
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "ChunksStorage.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "VoxelsVolume.h"
|
||||
#include "Chunk.h"
|
||||
@@ -53,6 +54,18 @@ std::shared_ptr<Chunk> ChunksStorage::create(int x, int z) {
|
||||
chunk->setLoaded(true);
|
||||
}
|
||||
|
||||
// Verifying and converting data
|
||||
ContentIndices* indices = level->content->indices;
|
||||
for (size_t i = 0; i < CHUNK_VOL; i++) {
|
||||
blockid_t id = chunk->voxels[i].id;
|
||||
if (indices->getBlockDef(id) == nullptr) {
|
||||
std::cout << "corruped block detected at " << i << " of chunk ";
|
||||
std::cout << chunk->x << "x" << chunk->z;
|
||||
std::cout << " -> " << (int)id << std::endl;
|
||||
chunk->voxels[i].id = 11;
|
||||
}
|
||||
}
|
||||
|
||||
light_t* lights = world->wfile->getLights(chunk->x, chunk->z);
|
||||
if (lights) {
|
||||
chunk->lightmap->set(lights);
|
||||
|
||||
Reference in New Issue
Block a user