diff --git a/apps/openmw/mwphysics/stepper.cpp b/apps/openmw/mwphysics/stepper.cpp index 6c7e5223f3..4f5a27e538 100644 --- a/apps/openmw/mwphysics/stepper.cpp +++ b/apps/openmw/mwphysics/stepper.cpp @@ -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; } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index d921c0a20a..cced17688d 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -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()->mBase->mId << ": " << e.what(); + Log(Debug::Error) << "Failed to clear temporary container contents: " << e.what(); } } diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 5c08b22c48..f68990aa01 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -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) { diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index 57b211e97e..7ebfd710f9 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -361,14 +361,10 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr 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) {