refactor: PVS-Studio warnings fixes

This commit is contained in:
MihailRis
2024-08-04 01:12:42 +03:00
parent 7bc96affbb
commit 245b39be62
22 changed files with 311 additions and 302 deletions
+7 -7
View File
@@ -149,7 +149,7 @@ void Lighting::onChunkLoaded(int cx, int cz, bool expand){
}
void Lighting::onBlockSet(int x, int y, int z, blockid_t id){
Block* block = content->getIndices()->blocks.get(id); //FIXME: Potentional null pointer
const auto& block = content->getIndices()->blocks.require(id);
solverR->remove(x,y,z);
solverG->remove(x,y,z);
solverB->remove(x,y,z);
@@ -161,7 +161,7 @@ void Lighting::onBlockSet(int x, int y, int z, blockid_t id){
if (chunks->getLight(x,y+1,z, 3) == 0xF){
for (int i = y; i >= 0; i--){
voxel* vox = chunks->get(x,i,z);
if ((vox == nullptr || vox->id != 0) && block->skyLightPassing) //-V522
if ((vox == nullptr || vox->id != 0) && block.skyLightPassing)
break;
solverS->add(x,i,z, 0xF);
}
@@ -177,7 +177,7 @@ void Lighting::onBlockSet(int x, int y, int z, blockid_t id){
solverB->solve();
solverS->solve();
} else {
if (!block->skyLightPassing){
if (!block.skyLightPassing){
solverS->remove(x,y,z);
for (int i = y-1; i >= 0; i--){
solverS->remove(x,i,z);
@@ -191,10 +191,10 @@ void Lighting::onBlockSet(int x, int y, int z, blockid_t id){
solverG->solve();
solverB->solve();
if (block->emission[0] || block->emission[1] || block->emission[2]){
solverR->add(x,y,z,block->emission[0]);
solverG->add(x,y,z,block->emission[1]);
solverB->add(x,y,z,block->emission[2]);
if (block.emission[0] || block.emission[1] || block.emission[2]){
solverR->add(x,y,z,block.emission[0]);
solverG->add(x,y,z,block.emission[1]);
solverB->add(x,y,z,block.emission[2]);
solverR->solve();
solverG->solve();
solverB->solve();