Fix an another portion of Coverity warnings

pull/593/head
Andrei Kortunov 4 years ago
parent 57b501ad13
commit 987b231fdd

@ -67,7 +67,7 @@ namespace MWPhysics
if(attempt == 1)
tracerDest = tracerPos + toMove;
else if (!firstIteration || !sDoExtraStairHacks) // first attempt failed and not on first movement solver iteration, can't retry -- or we have extra hacks disabled
else if (!sDoExtraStairHacks) // early out if we have extra hacks disabled
{
return false;
}

@ -81,7 +81,7 @@ MWWorld::ResolutionListener::~ResolutionListener()
}
catch(const std::exception& e)
{
Log(Debug::Error) << "Failed to clear temporary container contents of " << mStore.mPtr.get<ESM::Container>()->mBase->mId << ": " << e.what();
Log(Debug::Error) << "Failed to clear temporary container contents: " << e.what();
}
}

@ -703,7 +703,10 @@ namespace SceneUtil
{
public:
LightManagerStateAttribute()
: mLightManager(nullptr) {}
: mLightManager(nullptr)
, mInitLayout(false)
{
}
LightManagerStateAttribute(LightManager* lightManager)
: mLightManager(lightManager)
@ -720,7 +723,7 @@ namespace SceneUtil
}
LightManagerStateAttribute(const LightManagerStateAttribute& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
: osg::StateAttribute(copy,copyop), mLightManager(copy.mLightManager) {}
: osg::StateAttribute(copy,copyop), mLightManager(copy.mLightManager), mInitLayout(copy.mInitLayout) {}
int compare(const StateAttribute &sa) const override
{
@ -874,7 +877,7 @@ namespace SceneUtil
hasLoggedWarnings = true;
}
int targetLights = Settings::Manager::getInt("max lights", "Shaders");
int targetLights = std::clamp(Settings::Manager::getInt("max lights", "Shaders"), mMaxLightsLowerLimit, mMaxLightsUpperLimit);
if (!supportsUBO || !supportsGPU4 || lightingMethod == LightingMethod::PerObjectUniform)
initPerObjectUniform(targetLights);
@ -954,7 +957,8 @@ namespace SceneUtil
if (usingFFP())
return;
setMaxLights(std::clamp(Settings::Manager::getInt("max lights", "Shaders"), mMaxLightsLowerLimit, mMaxLightsUpperLimit));
int targetLights = std::clamp(Settings::Manager::getInt("max lights", "Shaders"), mMaxLightsLowerLimit, mMaxLightsUpperLimit);
setMaxLights(targetLights);
if (getLightingMethod() == LightingMethod::PerObjectUniform)
{
@ -1033,7 +1037,7 @@ namespace SceneUtil
auto* stateset = getOrCreateStateSet();
setLightingMethod(LightingMethod::PerObjectUniform);
setMaxLights(std::clamp(targetLights, mMaxLightsLowerLimit, mMaxLightsUpperLimit));
setMaxLights(targetLights);
// ensures sunlight element in our uniform array is updated when there are no point lights in scene
stateset->setAttributeAndModes(new LightStateAttributePerObjectUniform({}, this), osg::StateAttribute::ON);
@ -1043,7 +1047,7 @@ namespace SceneUtil
void LightManager::initSingleUBO(int targetLights)
{
setLightingMethod(LightingMethod::SingleUBO);
setMaxLights(std::clamp(targetLights, mMaxLightsLowerLimit, mMaxLightsUpperLimit));
setMaxLights(targetLights);
for (int i = 0; i < 2; ++i)
{

@ -361,14 +361,10 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
/// \brief Package mouse and mousewheel motions into a single event
MouseMotionEvent InputWrapper::_packageMouseMotion(const SDL_Event &evt)
{
MouseMotionEvent pack_evt;
MouseMotionEvent pack_evt = {};
pack_evt.x = mMouseX;
pack_evt.xrel = 0;
pack_evt.y = mMouseY;
pack_evt.yrel = 0;
pack_evt.z = mMouseZ;
pack_evt.zrel = 0;
pack_evt.timestamp = 0;
if(evt.type == SDL_MOUSEMOTION)
{

Loading…
Cancel
Save