From 808c905e1fcab71c558c779a23ab7fc6876fb089 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 18 Jun 2020 14:50:06 +0400 Subject: [PATCH] Initialize fields to avoid undefined behaviour --- apps/openmw/mwinput/controllermanager.cpp | 1 + apps/openmw/mwrender/objectpaging.hpp | 2 +- apps/openmw/mwscript/globalscripts.cpp | 2 ++ components/terrain/chunkmanager.cpp | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwinput/controllermanager.cpp b/apps/openmw/mwinput/controllermanager.cpp index 50a169c5cd..3b1f587ce7 100644 --- a/apps/openmw/mwinput/controllermanager.cpp +++ b/apps/openmw/mwinput/controllermanager.cpp @@ -36,6 +36,7 @@ namespace MWInput , mSneakToggleShortcutTimer(0.f) , mGamepadZoom(0) , mGamepadGuiCursorEnabled(true) + , mGuiCursorEnabled(true) , mJoystickLastUsed(false) , mSneakGamepadShortcut(false) , mGamepadPreviewMode(false) diff --git a/apps/openmw/mwrender/objectpaging.hpp b/apps/openmw/mwrender/objectpaging.hpp index c79dd6e066..9c2c54f655 100644 --- a/apps/openmw/mwrender/objectpaging.hpp +++ b/apps/openmw/mwrender/objectpaging.hpp @@ -80,7 +80,7 @@ namespace MWRender class RefnumMarker : public osg::Object { public: - RefnumMarker() : mNumVertices(0) {} + RefnumMarker() : mNumVertices(0) { mRefnum.unset(); } RefnumMarker(const RefnumMarker ©, osg::CopyOp co) : mRefnum(copy.mRefnum), mNumVertices(copy.mNumVertices) {} META_Object(MWRender, RefnumMarker) diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index 5dad9d6ece..a7865f0ae8 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -24,6 +24,7 @@ namespace { ESM::GlobalScript script; script.mTargetRef.unset(); + script.mRunning = false; if (!ptr.isEmpty()) { if (ptr.getCellRef().hasContentFile()) @@ -42,6 +43,7 @@ namespace ESM::GlobalScript script; script.mTargetId = pair.second; script.mTargetRef = pair.first; + script.mRunning = false; return script; } }; diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index 3c3bd0f9d5..87966b47cc 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -28,6 +28,7 @@ ChunkManager::ChunkManager(Storage *storage, Resource::SceneManager *sceneMgr, T , mSceneManager(sceneMgr) , mTextureManager(textureManager) , mCompositeMapRenderer(renderer) + , mNodeMask(0) , mCompositeMapSize(512) , mCompositeMapLevel(1.f) , mMaxCompGeometrySize(1.f)