refactor: PVS-Studio warnings fixes
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user