reduce 'corrupted block detected ...' spam if chunk data is corrupted
This commit is contained in:
parent
cfc16679cb
commit
91fa2838d6
@ -40,13 +40,23 @@ void ChunksStorage::remove(int x, int z) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void check_voxels(const ContentIndices& indices, Chunk* chunk) {
|
static void check_voxels(const ContentIndices& indices, Chunk* chunk) {
|
||||||
|
bool corrupted = false;
|
||||||
for (size_t i = 0; i < CHUNK_VOL; i++) {
|
for (size_t i = 0; i < CHUNK_VOL; i++) {
|
||||||
blockid_t id = chunk->voxels[i].id;
|
blockid_t id = chunk->voxels[i].id;
|
||||||
if (indices.blocks.get(id) == nullptr) {
|
if (indices.blocks.get(id) == nullptr) {
|
||||||
auto logline = logger.error();
|
if (!corrupted) {
|
||||||
logline << "corruped block detected at " << i << " of chunk ";
|
#ifdef NDEBUG
|
||||||
logline << chunk->x << "x" << chunk->z;
|
// release
|
||||||
logline << " -> " << id;
|
auto logline = logger.error();
|
||||||
|
logline << "corruped blocks detected at " << i << " of chunk ";
|
||||||
|
logline << chunk->x << "x" << chunk->z;
|
||||||
|
logline << " -> " << id;
|
||||||
|
corrupted = true;
|
||||||
|
#else
|
||||||
|
// debug
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
chunk->voxels[i].id = BLOCK_AIR;
|
chunk->voxels[i].id = BLOCK_AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user