mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
reduce 'corrupted block detected ...' spam if chunk data is corrupted
This commit is contained in:
parent
cfc16679cb
commit
91fa2838d6
1 changed files with 14 additions and 4 deletions
|
|
@ -40,13 +40,23 @@ void ChunksStorage::remove(int x, int z) {
|
|||
}
|
||||
|
||||
static void check_voxels(const ContentIndices& indices, Chunk* chunk) {
|
||||
bool corrupted = false;
|
||||
for (size_t i = 0; i < CHUNK_VOL; i++) {
|
||||
blockid_t id = chunk->voxels[i].id;
|
||||
if (indices.blocks.get(id) == nullptr) {
|
||||
auto logline = logger.error();
|
||||
logline << "corruped block detected at " << i << " of chunk ";
|
||||
logline << chunk->x << "x" << chunk->z;
|
||||
logline << " -> " << id;
|
||||
if (!corrupted) {
|
||||
#ifdef NDEBUG
|
||||
// release
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue