mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
refactor: PVS-Studio warnings fixes
This commit is contained in:
parent
245b39be62
commit
47db626145
14 changed files with 81 additions and 69 deletions
|
|
@ -119,11 +119,11 @@ static int l_get_x(lua::State* L) {
|
|||
if (vox == nullptr) {
|
||||
return lua::pushivec3_stack(L, 1, 0, 0);
|
||||
}
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable) { //-V522
|
||||
auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
if (!def.rotatable) {
|
||||
return lua::pushivec3_stack(L, 1, 0, 0);
|
||||
} else {
|
||||
const CoordSystem& rot = def->rotations.variants[vox->state.rotation];
|
||||
const CoordSystem& rot = def.rotations.variants[vox->state.rotation];
|
||||
return lua::pushivec3_stack(L, rot.axisX.x, rot.axisX.y, rot.axisX.z);
|
||||
}
|
||||
}
|
||||
|
|
@ -136,11 +136,11 @@ static int l_get_y(lua::State* L) {
|
|||
if (vox == nullptr) {
|
||||
return lua::pushivec3_stack(L, 0, 1, 0);
|
||||
}
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable) { //-V522
|
||||
auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
if (!def.rotatable) {
|
||||
return lua::pushivec3_stack(L, 0, 1, 0);
|
||||
} else {
|
||||
const CoordSystem& rot = def->rotations.variants[vox->state.rotation];
|
||||
const CoordSystem& rot = def.rotations.variants[vox->state.rotation];
|
||||
return lua::pushivec3_stack(L, rot.axisY.x, rot.axisY.y, rot.axisY.z);
|
||||
}
|
||||
}
|
||||
|
|
@ -153,11 +153,11 @@ static int l_get_z(lua::State* L) {
|
|||
if (vox == nullptr) {
|
||||
return lua::pushivec3_stack(L, 0, 0, 1);
|
||||
}
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable) { //-V522
|
||||
auto& def = level->content->getIndices()->blocks.require(vox->id);
|
||||
if (!def.rotatable) {
|
||||
return lua::pushivec3_stack(L, 0, 0, 1);
|
||||
} else {
|
||||
const CoordSystem& rot = def->rotations.variants[vox->state.rotation];
|
||||
const CoordSystem& rot = def.rotations.variants[vox->state.rotation];
|
||||
return lua::pushivec3_stack(L, rot.axisZ.x, rot.axisZ.y, rot.axisZ.z);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue