fix: PVS-Studio V522 mark false
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
4efa574eec
commit
3621e7ce1b
@ -96,8 +96,8 @@ void ALStream::bindSpeaker(speakerid_t speaker) {
|
||||
this->speaker = speaker;
|
||||
sp = audio::get_speaker(speaker);
|
||||
if (sp) {
|
||||
auto alspeaker = dynamic_cast<ALSpeaker*>(sp);
|
||||
alspeaker->stream = this;
|
||||
auto alspeaker = dynamic_cast<ALSpeaker*>(sp); //FIXME: Potentional null pointer
|
||||
alspeaker->stream = this; //-V522
|
||||
alspeaker->duration = source->getTotalDuration();
|
||||
}
|
||||
}
|
||||
@ -148,8 +148,8 @@ void ALStream::update(double delta) {
|
||||
speaker = 0;
|
||||
return;
|
||||
}
|
||||
ALSpeaker* alspeaker = dynamic_cast<ALSpeaker*>(speaker);
|
||||
if (alspeaker->stopped) {
|
||||
ALSpeaker* alspeaker = dynamic_cast<ALSpeaker*>(speaker); //FIXME: Potentional null pointer
|
||||
if (alspeaker->stopped) { //-V522
|
||||
speaker = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
indices.push_back(i);
|
||||
}
|
||||
for (size_t i = 0; i < unitIndices.count(); i++) {
|
||||
names.push_back(unitIndices.get(i)->name);
|
||||
names.push_back(unitIndices.get(i)->name); //FIXME: .get(i) potentional null pointer //-V522
|
||||
}
|
||||
for (size_t i = unitIndices.count(); i < count; i++) {
|
||||
names.emplace_back("");
|
||||
|
||||
@ -269,7 +269,7 @@ void Engine::loadAssets() {
|
||||
// no need
|
||||
// correct log messages order is more useful
|
||||
bool threading = false;
|
||||
if (threading) {
|
||||
if (threading) { // TODO: Why is always false?
|
||||
auto task = loader.startTask([=](){});
|
||||
task->waitForEnd();
|
||||
} else {
|
||||
|
||||
@ -105,7 +105,7 @@ static void write_indices(
|
||||
) {
|
||||
size_t count = indices.count();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
list.put(indices.get(i)->name);
|
||||
list.put(indices.get(i)->name); //FIXME: .get(i) potential null pointer //-V522
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@ ContentGfxCache::ContentGfxCache(const Content* content, Assets* assets) : conte
|
||||
auto atlas = assets->get<Atlas>("blocks");
|
||||
|
||||
for (uint i = 0; i < indices->blocks.count(); i++) {
|
||||
Block* def = indices->blocks.get(i);
|
||||
Block* def = indices->blocks.get(i); //FIXME: Potential null pointer
|
||||
for (uint side = 0; side < 6; side++) {
|
||||
const std::string& tex = def->textureFaces[side];
|
||||
const std::string& tex = def->textureFaces[side]; //-V522
|
||||
if (atlas->has(tex)) {
|
||||
sideregions[i * 6 + side] = atlas->get(tex);
|
||||
} else if (atlas->has(TEXTURE_NOTFOUND)) {
|
||||
|
||||
@ -154,9 +154,9 @@ std::unique_ptr<Atlas> BlocksPreview::build(
|
||||
|
||||
fbo.bind();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
auto def = indices->blocks.get(i);
|
||||
auto def = indices->blocks.get(i); //FIXME: Potentional null pointer
|
||||
atlas->getTexture()->bind();
|
||||
builder.add(def->name, draw(cache, shader, &fbo, &batch, def, iconSize));
|
||||
builder.add(def->name, draw(cache, shader, &fbo, &batch, def, iconSize)); //-V522
|
||||
}
|
||||
fbo.unbind();
|
||||
|
||||
|
||||
@ -141,11 +141,11 @@ void Skybox::refresh(const DrawContext& pctx, float t, float mie, uint quality)
|
||||
ctx.setFramebuffer(fbo.get());
|
||||
ctx.setViewport(Viewport(size, size));
|
||||
|
||||
auto cubemap = dynamic_cast<Cubemap*>(fbo->getTexture());
|
||||
auto cubemap = dynamic_cast<Cubemap*>(fbo->getTexture()); //FIXME: Potentional null pointer
|
||||
|
||||
ready = true;
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
cubemap->bind();
|
||||
cubemap->bind(); //-V522
|
||||
shader->use();
|
||||
|
||||
const glm::vec3 xaxs[] = {
|
||||
|
||||
@ -172,10 +172,10 @@ void WorldRenderer::setupWorldShader(
|
||||
{
|
||||
auto inventory = player->getInventory();
|
||||
ItemStack& stack = inventory->getSlot(player->getChosenSlot());
|
||||
auto item = indices->items.get(stack.getItemId());
|
||||
auto item = indices->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
float multiplier = 0.5f;
|
||||
shader->uniform3f("u_torchlightColor",
|
||||
item->emission[0] / 15.0f * multiplier,
|
||||
item->emission[0] / 15.0f * multiplier, //-V522
|
||||
item->emission[1] / 15.0f * multiplier,
|
||||
item->emission[2] / 15.0f * multiplier
|
||||
);
|
||||
@ -222,12 +222,12 @@ void WorldRenderer::renderBlockSelection() {
|
||||
const auto& selection = player->selection;
|
||||
auto indices = level->content->getIndices();
|
||||
blockid_t id = selection.vox.id;
|
||||
auto block = indices->blocks.get(id);
|
||||
auto block = indices->blocks.get(id); //FIXME: Potentional null pointer
|
||||
const glm::ivec3 pos = player->selection.position;
|
||||
const glm::vec3 point = selection.hitPosition;
|
||||
const glm::vec3 norm = selection.normal;
|
||||
|
||||
const std::vector<AABB>& hitboxes = block->rotatable
|
||||
const std::vector<AABB>& hitboxes = block->rotatable //-V522
|
||||
? block->rt.hitboxes[selection.vox.state.rotation]
|
||||
: block->hitboxes;
|
||||
|
||||
|
||||
@ -121,9 +121,9 @@ void SlotView::draw(const DrawContext* pctx, Assets* assets) {
|
||||
itemid_t itemid = bound->getItemId();
|
||||
if (itemid != prevItem) {
|
||||
if (itemid) {
|
||||
auto def = content->getIndices()->items.get(itemid);
|
||||
auto def = content->getIndices()->items.get(itemid); //FIXME: Potentional null pointer
|
||||
tooltip = util::pascal_case(
|
||||
langs::get(util::str2wstr_utf8(def->caption))
|
||||
langs::get(util::str2wstr_utf8(def->caption)) //-V522
|
||||
);
|
||||
} else {
|
||||
tooltip.clear();
|
||||
@ -159,8 +159,8 @@ void SlotView::draw(const DrawContext* pctx, Assets* assets) {
|
||||
auto previews = assets->get<Atlas>("block-previews");
|
||||
auto indices = content->getIndices();
|
||||
|
||||
ItemDef* item = indices->items.get(stack.getItemId());
|
||||
switch (item->iconType) {
|
||||
ItemDef* item = indices->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
switch (item->iconType) { //-V522
|
||||
case item_icon_type::none:
|
||||
break;
|
||||
case item_icon_type::block: {
|
||||
@ -268,12 +268,12 @@ void SlotView::clicked(gui::GUI* gui, mousecode button) {
|
||||
stack.setCount(halfremain);
|
||||
}
|
||||
} else {
|
||||
auto stackDef = content->getIndices()->items.get(stack.getItemId());
|
||||
auto stackDef = content->getIndices()->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
if (stack.isEmpty()) {
|
||||
stack.set(grabbed);
|
||||
stack.setCount(1);
|
||||
grabbed.setCount(grabbed.getCount()-1);
|
||||
} else if (stack.accepts(grabbed) && stack.getCount() < stackDef->stackSize){
|
||||
} else if (stack.accepts(grabbed) && stack.getCount() < stackDef->stackSize){ //-V522
|
||||
stack.setCount(stack.getCount()+1);
|
||||
grabbed.setCount(grabbed.getCount()-1);
|
||||
}
|
||||
|
||||
@ -26,8 +26,8 @@ bool ItemStack::accepts(const ItemStack& other) const {
|
||||
}
|
||||
|
||||
void ItemStack::move(ItemStack& item, const ContentIndices* indices) {
|
||||
auto def = indices->items.get(item.getItemId());
|
||||
int count = std::min(item.count, def->stackSize - this->count);
|
||||
auto def = indices->items.get(item.getItemId()); //FIXME: Potentional null pointer
|
||||
int count = std::min(item.count, def->stackSize - this->count); //-V522
|
||||
if (isEmpty()) {
|
||||
set(ItemStack(item.getItemId(), count));
|
||||
} else {
|
||||
|
||||
@ -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);
|
||||
Block* block = content->getIndices()->blocks.get(id); //FIXME: Potentional null pointer
|
||||
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)
|
||||
if ((vox == nullptr || vox->id != 0) && block->skyLightPassing) //-V522
|
||||
break;
|
||||
solverS->add(x,i,z, 0xF);
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ void BlocksController::placeBlock(
|
||||
void BlocksController::updateBlock(int x, int y, int z) {
|
||||
voxel* vox = chunks->get(x, y, z);
|
||||
if (vox == nullptr) return;
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id);
|
||||
if (def->grounded) {
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (def->grounded) { //-V522
|
||||
const auto& vec = get_ground_direction(def, vox->state.rotation);
|
||||
if (!chunks->isSolidBlock(x + vec.x, y + vec.y, z + vec.z)) {
|
||||
breakBlock(nullptr, def, x, y, z);
|
||||
@ -93,8 +93,8 @@ void BlocksController::onBlocksTick(int tickid, int parts) {
|
||||
int tickRate = blocksTickClock.getTickRate();
|
||||
for (size_t id = 0; id < indices->blocks.count(); id++) {
|
||||
if ((id + tickid) % parts != 0) continue;
|
||||
auto def = indices->blocks.get(id);
|
||||
auto interval = def->tickInterval;
|
||||
auto def = indices->blocks.get(id); //FIXME: Potentional null pointer
|
||||
auto interval = def->tickInterval; //-V522
|
||||
if (def->rt.funcsset.onblockstick && tickid / parts % interval == 0) {
|
||||
scripting::on_blocks_tick(def, tickRate / interval);
|
||||
}
|
||||
@ -112,8 +112,8 @@ void BlocksController::randomTick(
|
||||
int by = random.rand() % segheight + s * segheight;
|
||||
int bz = random.rand() % CHUNK_D;
|
||||
const voxel& vox = chunk.voxels[(by * CHUNK_D + bz) * CHUNK_W + bx];
|
||||
Block* block = indices->blocks.get(vox.id);
|
||||
if (block->rt.funcsset.randupdate) {
|
||||
Block* block = indices->blocks.get(vox.id); //FIXME: Potentional null pointer
|
||||
if (block->rt.funcsset.randupdate) { //-V522
|
||||
scripting::random_update_block(
|
||||
block, chunk.x * CHUNK_W + bx, by, chunk.z * CHUNK_D + bz
|
||||
);
|
||||
@ -153,8 +153,8 @@ int64_t BlocksController::createBlockInventory(int x, int y, int z) {
|
||||
auto inv = chunk->getBlockInventory(lx, y, lz);
|
||||
if (inv == nullptr) {
|
||||
auto indices = level->content->getIndices();
|
||||
auto def = indices->blocks.get(chunk->voxels[vox_index(lx, y, lz)].id);
|
||||
int invsize = def->inventorySize;
|
||||
auto def = indices->blocks.get(chunk->voxels[vox_index(lx, y, lz)].id); //FIXME: Potentional null pointer
|
||||
int invsize = def->inventorySize; //-V522
|
||||
if (invsize == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -208,8 +208,8 @@ void PlayerController::onFootstep(const Hitbox& hitbox) {
|
||||
int z = std::floor(pos.z + half.z * offsetZ);
|
||||
auto vox = level->chunks->get(x, y, z);
|
||||
if (vox) {
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id);
|
||||
if (!def->obstacle) continue;
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->obstacle) continue; //-V522
|
||||
blocksController->onBlockInteraction(
|
||||
player.get(),
|
||||
glm::ivec3(x, y, z),
|
||||
@ -333,8 +333,8 @@ static int determine_rotation(
|
||||
static void pick_block(
|
||||
ContentIndices* indices, Chunks* chunks, Player* player, int x, int y, int z
|
||||
) {
|
||||
auto block = indices->blocks.get(chunks->get(x, y, z)->id);
|
||||
itemid_t id = block->rt.pickingItem;
|
||||
auto block = indices->blocks.get(chunks->get(x, y, z)->id); //FIXME: Potentional null pointer
|
||||
itemid_t id = block->rt.pickingItem; //-V522
|
||||
auto inventory = player->getInventory();
|
||||
size_t slotid = inventory->findSlotByItem(id, 0, 10);
|
||||
if (slotid == Inventory::npos) {
|
||||
@ -492,11 +492,11 @@ void PlayerController::updateInteraction() {
|
||||
|
||||
auto inventory = player->getInventory();
|
||||
const ItemStack& stack = inventory->getSlot(player->getChosenSlot());
|
||||
ItemDef* item = indices->items.get(stack.getItemId());
|
||||
ItemDef* item = indices->items.get(stack.getItemId()); //FIXME: Potentional null pointer
|
||||
|
||||
auto vox = updateSelection(maxDistance);
|
||||
if (vox == nullptr) {
|
||||
if (rclick && item->rt.funcsset.on_use) {
|
||||
if (rclick && item->rt.funcsset.on_use) { //-V522
|
||||
scripting::on_item_use(player.get(), item);
|
||||
}
|
||||
if (selection.entity) {
|
||||
@ -513,8 +513,8 @@ void PlayerController::updateInteraction() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto target = indices->blocks.get(vox->id);
|
||||
if (lclick && target->breakable) {
|
||||
auto target = indices->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (lclick && target->breakable) { //-V522
|
||||
blocksController->breakBlock(
|
||||
player.get(), target, iend.x, iend.y, iend.z
|
||||
);
|
||||
|
||||
@ -122,8 +122,8 @@ 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);
|
||||
if (!def->rotatable) {
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable) { //-V522
|
||||
return lua::pushivec3_stack(L, 1, 0, 0);
|
||||
} else {
|
||||
const CoordSystem& rot = def->rotations.variants[vox->state.rotation];
|
||||
@ -139,8 +139,8 @@ 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);
|
||||
if (!def->rotatable) {
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable) { //-V522
|
||||
return lua::pushivec3_stack(L, 0, 1, 0);
|
||||
} else {
|
||||
const CoordSystem& rot = def->rotations.variants[vox->state.rotation];
|
||||
@ -156,8 +156,8 @@ 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);
|
||||
if (!def->rotatable) {
|
||||
auto def = level->content->getIndices()->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable) { //-V522
|
||||
return lua::pushivec3_stack(L, 0, 0, 1);
|
||||
} else {
|
||||
const CoordSystem& rot = def->rotations.variants[vox->state.rotation];
|
||||
|
||||
@ -53,34 +53,34 @@ static DocumentNode getDocumentNode(lua::State* L, int idx = 1) {
|
||||
|
||||
static int l_menu_back(lua::State* L) {
|
||||
auto node = getDocumentNode(L);
|
||||
auto menu = dynamic_cast<Menu*>(node.node.get());
|
||||
menu->back();
|
||||
auto menu = dynamic_cast<Menu*>(node.node.get()); //FIXME: Potentional null pointer
|
||||
menu->back(); //-V522
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_menu_reset(lua::State* L) {
|
||||
auto node = getDocumentNode(L);
|
||||
auto menu = dynamic_cast<Menu*>(node.node.get());
|
||||
menu->reset();
|
||||
auto menu = dynamic_cast<Menu*>(node.node.get()); //FIXME: Potentional null pointer
|
||||
menu->reset(); //-V522
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_textbox_paste(lua::State* L) {
|
||||
auto node = getDocumentNode(L);
|
||||
auto box = dynamic_cast<TextBox*>(node.node.get());
|
||||
auto box = dynamic_cast<TextBox*>(node.node.get()); //FIXME: Potentional null pointer
|
||||
auto text = lua::require_string(L, 2);
|
||||
box->paste(util::str2wstr_utf8(text));
|
||||
box->paste(util::str2wstr_utf8(text)); //-V522
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_container_add(lua::State* L) {
|
||||
auto docnode = getDocumentNode(L);
|
||||
auto node = dynamic_cast<Container*>(docnode.node.get());
|
||||
auto node = dynamic_cast<Container*>(docnode.node.get()); //FIXME: Potentional null pointer
|
||||
auto xmlsrc = lua::require_string(L, 2);
|
||||
try {
|
||||
auto subnode =
|
||||
guiutil::create(xmlsrc, docnode.document->getEnvironment());
|
||||
node->add(subnode);
|
||||
node->add(subnode); //-V522
|
||||
UINode::getIndices(subnode, docnode.document->getMapWriteable());
|
||||
} catch (const std::exception& err) {
|
||||
throw std::runtime_error(err.what());
|
||||
|
||||
@ -51,7 +51,7 @@ static int l_hud_open_block(lua::State* L) {
|
||||
}
|
||||
auto def = content->getIndices()->blocks.get(vox->id);
|
||||
auto assets = engine->getAssets();
|
||||
auto layout = assets->get<UiDocument>(def->uiLayout);
|
||||
auto layout = assets->get<UiDocument>(def->uiLayout);//FIXME: Potentional null pointer //-V522
|
||||
if (layout == nullptr) {
|
||||
throw std::runtime_error("block '" + def->name + "' has no ui layout");
|
||||
}
|
||||
|
||||
@ -76,8 +76,8 @@ const AABB* Chunks::isObstacleAt(float x, float y, float z) {
|
||||
return ∅
|
||||
}
|
||||
}
|
||||
const auto def = indices->blocks.get(v->id);
|
||||
if (def->obstacle) {
|
||||
const auto def = indices->blocks.get(v->id); //FIXME: Potentional null pointer
|
||||
if (def->obstacle) { //-V522
|
||||
glm::ivec3 offset {};
|
||||
if (v->state.segment) {
|
||||
glm::ivec3 point(ix, iy, iz);
|
||||
@ -99,19 +99,19 @@ const AABB* Chunks::isObstacleAt(float x, float y, float z) {
|
||||
bool Chunks::isSolidBlock(int32_t x, int32_t y, int32_t z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr) return false;
|
||||
return indices->blocks.get(v->id)->rt.solid;
|
||||
return indices->blocks.get(v->id)->rt.solid; //-V522
|
||||
}
|
||||
|
||||
bool Chunks::isReplaceableBlock(int32_t x, int32_t y, int32_t z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr) return false;
|
||||
return indices->blocks.get(v->id)->replaceable;
|
||||
return indices->blocks.get(v->id)->replaceable; //-V522
|
||||
}
|
||||
|
||||
bool Chunks::isObstacleBlock(int32_t x, int32_t y, int32_t z) {
|
||||
voxel* v = get(x, y, z);
|
||||
if (v == nullptr) return false;
|
||||
return indices->blocks.get(v->id)->obstacle;
|
||||
return indices->blocks.get(v->id)->obstacle; //-V522
|
||||
}
|
||||
|
||||
ubyte Chunks::getLight(int32_t x, int32_t y, int32_t z, int channel) {
|
||||
@ -255,8 +255,8 @@ bool Chunks::checkReplaceability(
|
||||
pos += rotation.axisY * sy;
|
||||
pos += rotation.axisZ * sz;
|
||||
if (auto vox = get(pos.x, pos.y, pos.z)) {
|
||||
auto target = indices->blocks.get(vox->id);
|
||||
if (!target->replaceable && vox->id != ignore) {
|
||||
auto target = indices->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!target->replaceable && vox->id != ignore) { //-V522
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -300,8 +300,8 @@ void Chunks::setRotationExtended(
|
||||
set(pos.x, pos.y, pos.z, def->rt.id, segState);
|
||||
} else {
|
||||
vox->state = segState;
|
||||
auto chunk = getChunkByVoxel(pos.x, pos.y, pos.z);
|
||||
chunk->setModifiedAndUnsaved();
|
||||
auto chunk = getChunkByVoxel(pos.x, pos.y, pos.z); //FIXME: Potentional null pointer
|
||||
chunk->setModifiedAndUnsaved(); //-V522
|
||||
segmentBlocks.emplace_back(pos);
|
||||
}
|
||||
}
|
||||
@ -333,16 +333,16 @@ void Chunks::setRotation(int32_t x, int32_t y, int32_t z, uint8_t index) {
|
||||
if (vox == nullptr) {
|
||||
return;
|
||||
}
|
||||
auto def = indices->blocks.get(vox->id);
|
||||
if (!def->rotatable || vox->state.rotation == index) {
|
||||
auto def = indices->blocks.get(vox->id); //FIXME: Potentional null pointer
|
||||
if (!def->rotatable || vox->state.rotation == index) { //-V522
|
||||
return;
|
||||
}
|
||||
if (def->rt.extended) {
|
||||
setRotationExtended(def, vox->state, {x, y, z}, index);
|
||||
} else {
|
||||
vox->state.rotation = index;
|
||||
auto chunk = getChunkByVoxel(x, y, z);
|
||||
chunk->setModifiedAndUnsaved();
|
||||
auto chunk = getChunkByVoxel(x, y, z); //FIXME: Potentional null pointer
|
||||
chunk->setModifiedAndUnsaved(); //-V522
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,8 +371,8 @@ void Chunks::set(
|
||||
|
||||
// block finalization
|
||||
voxel& vox = chunk->voxels[(y * CHUNK_D + lz) * CHUNK_W + lx];
|
||||
auto prevdef = indices->blocks.get(vox.id);
|
||||
if (prevdef->inventorySize == 0) {
|
||||
auto prevdef = indices->blocks.get(vox.id); //FIXME: Potentional null pointer
|
||||
if (prevdef->inventorySize == 0) { //-V522
|
||||
chunk->removeBlockInventory(lx, y, lz);
|
||||
}
|
||||
if (prevdef->rt.extended && !vox.state.segment) {
|
||||
@ -380,11 +380,11 @@ void Chunks::set(
|
||||
}
|
||||
|
||||
// block initialization
|
||||
auto newdef = indices->blocks.get(id);
|
||||
auto newdef = indices->blocks.get(id); //FIXME: Potentional null pointer
|
||||
vox.id = id;
|
||||
vox.state = state;
|
||||
chunk->setModifiedAndUnsaved();
|
||||
if (!state.segment && newdef->rt.extended) {
|
||||
if (!state.segment && newdef->rt.extended) { //-V522
|
||||
repairSegments(newdef, state, gx, y, gz);
|
||||
}
|
||||
|
||||
@ -452,8 +452,8 @@ voxel* Chunks::rayCast(
|
||||
if (voxel == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto def = indices->blocks.get(voxel->id);
|
||||
if (def->selectable) {
|
||||
const auto def = indices->blocks.get(voxel->id); //FIXME: Potentional null pointer
|
||||
if (def->selectable) { //-V522
|
||||
end.x = px + t * dx;
|
||||
end.y = py + t * dy;
|
||||
end.z = pz + t * dz;
|
||||
@ -579,8 +579,8 @@ glm::vec3 Chunks::rayCastToObstacle(
|
||||
while (t <= maxDist) {
|
||||
voxel* voxel = get(ix, iy, iz);
|
||||
if (voxel) {
|
||||
const auto def = indices->blocks.get(voxel->id);
|
||||
if (def->obstacle) {
|
||||
const auto def = indices->blocks.get(voxel->id); //FIXME: Potentional null pointer
|
||||
if (def->obstacle) { //-V522
|
||||
if (!def->rt.solid) {
|
||||
const std::vector<AABB>& hitboxes =
|
||||
def->rotatable ? def->rt.hitboxes[voxel->state.rotation]
|
||||
|
||||
@ -150,8 +150,8 @@ void ChunksStorage::getVoxels(VoxelsVolume* volume, bool backlight) const {
|
||||
light_t light = clights[cidx];
|
||||
if (backlight) {
|
||||
auto block =
|
||||
indices->blocks.get(voxels[vidx].id);
|
||||
if (block->lightPassing) {
|
||||
indices->blocks.get(voxels[vidx].id); //FIXME: Potentional null pointer
|
||||
if (block->lightPassing) { //-V522
|
||||
light = Lightmap::combine(
|
||||
min(15,
|
||||
Lightmap::extract(light, 0) + 1),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user