diff --git a/apps/essimporter/converter.cpp b/apps/essimporter/converter.cpp index 0d5b391112..3c08084ca9 100644 --- a/apps/essimporter/converter.cpp +++ b/apps/essimporter/converter.cpp @@ -68,7 +68,7 @@ namespace { if (isIndexedRefId(indexedRefId)) { - int refIndex; + int refIndex = 0; std::string refId; splitIndexedRefId(indexedRefId, refIndex, refId); @@ -320,6 +320,8 @@ namespace ESSImport esm.startRecord(ESM::REC_CSTA); ESM::CellState csta; csta.mHasFogOfWar = 0; + csta.mLastRespawn.mDay = 0; + csta.mLastRespawn.mHour = 0; csta.mId = esmcell.getCellId(); csta.mId.save(esm); // TODO csta.mLastRespawn; @@ -352,7 +354,7 @@ namespace ESSImport } else { - int refIndex; + int refIndex = 0; splitIndexedRefId(cellref.mIndexedRefId, refIndex, out.mRefID); std::string idLower = Misc::StringUtils::lowerCase(out.mRefID); @@ -490,6 +492,7 @@ namespace ESSImport out.mSpellId = it->mSPDT.mId.toString(); out.mSpeed = pnam.mSpeed * 0.001f; // not sure where this factor comes from + out.mSlot = 0; esm.startRecord(ESM::REC_MPRJ); out.save(esm); diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index 577185b8d9..f0c74a7333 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -368,6 +368,7 @@ namespace ESSImport profile.mInGameTime.mGameHour = context.mHour; profile.mInGameTime.mMonth = context.mMonth; profile.mInGameTime.mYear = context.mYear; + profile.mTimePlayed = 0; profile.mPlayerCell = header.mGameData.mCurrentCell.toString(); if (context.mPlayerBase.mClass == "NEWCLASSID_CHARGEN") profile.mPlayerClassName = context.mCustomPlayerClassName; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 0b7b73693c..48a668c8cf 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -21,6 +21,7 @@ void CSMDoc::Document::addGmsts() ESM::GameSetting gmst; gmst.mId = CSMWorld::DefaultGmsts::Floats[i]; gmst.mValue.setType (ESM::VT_Float); + gmst.mRecordFlags = 0; gmst.mValue.setFloat (CSMWorld::DefaultGmsts::FloatsDefaultValues[i]); getData().getGmsts().add (gmst); } @@ -30,6 +31,7 @@ void CSMDoc::Document::addGmsts() ESM::GameSetting gmst; gmst.mId = CSMWorld::DefaultGmsts::Ints[i]; gmst.mValue.setType (ESM::VT_Int); + gmst.mRecordFlags = 0; gmst.mValue.setInteger (CSMWorld::DefaultGmsts::IntsDefaultValues[i]); getData().getGmsts().add (gmst); } @@ -39,6 +41,7 @@ void CSMDoc::Document::addGmsts() ESM::GameSetting gmst; gmst.mId = CSMWorld::DefaultGmsts::Strings[i]; gmst.mValue.setType (ESM::VT_String); + gmst.mRecordFlags = 0; gmst.mValue.setString (""); getData().getGmsts().add (gmst); } @@ -164,6 +167,7 @@ void CSMDoc::Document::createBase() { ESM::Global record; record.mId = sGlobals[i]; + record.mRecordFlags = 0; record.mValue.setType (i==2 ? ESM::VT_Float : ESM::VT_Long); if (i==0 || i==1) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 939316fa60..247900f407 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -1032,6 +1032,7 @@ void CSMWorld::Data::loadFallbackEntries() ESM::Static newMarker; newMarker.mId = marker.first; newMarker.mModel = marker.second; + newMarker.mRecordFlags = 0; auto record = std::make_unique>(); record->mBase = newMarker; record->mState = CSMWorld::RecordBase::State_BaseOnly; @@ -1046,6 +1047,7 @@ void CSMWorld::Data::loadFallbackEntries() ESM::Door newMarker; newMarker.mId = marker.first; newMarker.mModel = marker.second; + newMarker.mRecordFlags = 0; auto record = std::make_unique>(); record->mBase = newMarker; record->mState = CSMWorld::RecordBase::State_BaseOnly; diff --git a/apps/opencs/model/world/refidadapterimp.hpp b/apps/opencs/model/world/refidadapterimp.hpp index 0cfde25569..99ce882688 100644 --- a/apps/opencs/model/world/refidadapterimp.hpp +++ b/apps/opencs/model/world/refidadapterimp.hpp @@ -27,7 +27,10 @@ namespace CSMWorld const RefIdColumn *mType; const RefIdColumn *mBlocked; - BaseColumns () : mBlocked(nullptr) {} + BaseColumns () : mId(nullptr) + , mModified(nullptr) + , mType(nullptr) + , mBlocked(nullptr) {} }; /// \brief Base adapter for all refereceable record types diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 49aa4e9e7a..215b2e10c5 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -459,6 +459,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager) , mScriptBlacklistUse (true) , mNewGame (false) , mCfgMgr(configurationManager) + , mGlMaxTextureImageUnits(0) { SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); // We use only gamepads diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 0c84e0ce7a..5d8fb898fc 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -1047,7 +1047,7 @@ public: for (ActiveTextFormats::iterator i = mActiveTextFormats.begin (); i != mActiveTextFormats.end (); ++i) { - if (mNode != nullptr) + if (mNode != nullptr && i->second != nullptr) i->second->destroyDrawItem (mNode); i->second.reset(); } diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index ed5a5e12d1..5300f00106 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -494,6 +494,7 @@ namespace MWGui klass.mDescription = mCreateClassDialog->getDescription(); klass.mData.mSpecialization = mCreateClassDialog->getSpecializationId(); klass.mData.mIsPlayable = 0x1; + klass.mRecordFlags = 0; std::vector attributes = mCreateClassDialog->getFavoriteAttributes(); assert(attributes.size() == 2); diff --git a/apps/openmw/mwrender/pingpongcull.cpp b/apps/openmw/mwrender/pingpongcull.cpp index 035f0c3011..ad1e7ab940 100644 --- a/apps/openmw/mwrender/pingpongcull.cpp +++ b/apps/openmw/mwrender/pingpongcull.cpp @@ -56,7 +56,7 @@ namespace MWRender postProcessor->getStateUpdater()->setEyePos(cv->getEyePoint()); postProcessor->getStateUpdater()->setEyeVec(cv->getLookVectorLocal()); - if (!postProcessor || !postProcessor->getFbo(PostProcessor::FBO_Primary, frameId)) + if (!postProcessor->getFbo(PostProcessor::FBO_Primary, frameId)) { renderStage->setMultisampleResolveFramebufferObject(nullptr); renderStage->setFrameBufferObject(nullptr); diff --git a/apps/openmw/mwrender/postprocessor.cpp b/apps/openmw/mwrender/postprocessor.cpp index 2a046cb1ac..8e5947ba89 100644 --- a/apps/openmw/mwrender/postprocessor.cpp +++ b/apps/openmw/mwrender/postprocessor.cpp @@ -238,7 +238,7 @@ namespace MWRender } mGLSLVersion = ext->glslLanguageVersion * 100; - mUBO = ext && ext->isUniformBufferObjectSupported && mGLSLVersion >= 330; + mUBO = ext->isUniformBufferObjectSupported && mGLSLVersion >= 330; mStateUpdater = new fx::StateUpdater(mUBO); if (!Stereo::getStereo() && !SceneUtil::AutoDepth::isReversed() && !mSoftParticles && !mUsePostProcessing) diff --git a/apps/openmw/mwworld/magiceffects.cpp b/apps/openmw/mwworld/magiceffects.cpp index 44c4061832..a99862d489 100644 --- a/apps/openmw/mwworld/magiceffects.cpp +++ b/apps/openmw/mwworld/magiceffects.cpp @@ -62,6 +62,7 @@ namespace MWWorld else params.mType = ESM::ActiveSpells::Type_Permanent; params.mWorsenings = -1; + params.mNextWorsening = ESM::TimeStamp(); int effectIndex = 0; for(const auto& enam : spell->mEffects.mList) { @@ -131,6 +132,7 @@ namespace MWWorld params.mCasterActorId = creatureStats.mActorId; params.mType = ESM::ActiveSpells::Type_Enchantment; params.mWorsenings = -1; + params.mNextWorsening = ESM::TimeStamp(); for(std::size_t effectIndex = 0; effectIndex < oldMagnitudes.size() && effectIndex < enchantment->mEffects.mList.size(); ++effectIndex) { const auto& enam = enchantment->mEffects.mList[effectIndex]; diff --git a/apps/openmw/mwworld/manualref.cpp b/apps/openmw/mwworld/manualref.cpp index 42771bc72c..b809a81b3e 100644 --- a/apps/openmw/mwworld/manualref.cpp +++ b/apps/openmw/mwworld/manualref.cpp @@ -11,17 +11,8 @@ namespace const T* base = list.find(name); ESM::CellRef cellRef; - cellRef.mRefNum.unset(); + cellRef.blank(); cellRef.mRefID = name; - cellRef.mScale = 1; - cellRef.mFactionRank = 0; - cellRef.mChargeInt = -1; - cellRef.mChargeIntRemainder = 0.0f; - cellRef.mGoldValue = 1; - cellRef.mEnchantmentCharge = -1; - cellRef.mTeleport = false; - cellRef.mLockLevel = 0; - cellRef.mReferenceBlocked = 0; MWWorld::LiveCellRef ref(cellRef, base); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 5a6a5ce864..66e2dfa69c 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -490,6 +490,7 @@ namespace MWWorld ESM::Global record; record.mId = params.first; record.mValue = params.second; + record.mRecordFlags = 0; mStore.insertStatic(record); } } @@ -509,6 +510,7 @@ namespace MWWorld ESM::Static record; record.mId = params.first; record.mModel = params.second; + record.mRecordFlags = 0; mStore.insertStatic(record); } } @@ -523,6 +525,7 @@ namespace MWWorld ESM::Door record; record.mId = params.first; record.mModel = params.second; + record.mRecordFlags = 0; mStore.insertStatic(record); } } diff --git a/components/detournavigator/asyncnavmeshupdater.cpp b/components/detournavigator/asyncnavmeshupdater.cpp index ee6cf453b8..b3d6d4151c 100644 --- a/components/detournavigator/asyncnavmeshupdater.cpp +++ b/components/detournavigator/asyncnavmeshupdater.cpp @@ -511,6 +511,8 @@ namespace DetourNavigator const auto offMeshConnections = mOffMeshConnectionsManager.get().get(job.mChangedTile); const PreparedNavMeshData* preparedNavMeshDataPtr = cachedNavMeshData ? &cachedNavMeshData.get() : preparedNavMeshData.get(); + assert (preparedNavMeshDataPtr != nullptr); + const UpdateNavMeshStatus status = navMeshCacheItem.lock()->updateTile(job.mChangedTile, std::move(cachedNavMeshData), makeNavMeshTileData(*preparedNavMeshDataPtr, offMeshConnections, job.mAgentBounds, job.mChangedTile, mSettings.get().mRecast)); diff --git a/components/esm3/loadcont.hpp b/components/esm3/loadcont.hpp index 3fbb180d1b..0a28a89015 100644 --- a/components/esm3/loadcont.hpp +++ b/components/esm3/loadcont.hpp @@ -19,7 +19,7 @@ class ESMWriter; struct ContItem { - int mCount; + int mCount{0}; std::string mItem; }; diff --git a/components/esm4/loadland.cpp b/components/esm4/loadland.cpp index 4cbbfd69eb..40e9d95c58 100644 --- a/components/esm4/loadland.cpp +++ b/components/esm4/loadland.cpp @@ -104,7 +104,7 @@ void ESM4::Land::load(ESM4::Reader& reader) BTXT base; if (reader.getExact(base)) { - assert(base.quadrant < 4 && base.quadrant >= 0 && "base texture quadrant index error"); + assert(base.quadrant < 4 && "base texture quadrant index error"); reader.adjustFormId(base.formId); mTextures[base.quadrant].base = std::move(base); @@ -126,8 +126,7 @@ void ESM4::Land::load(ESM4::Reader& reader) } reader.get(layer.texture); reader.adjustFormId(layer.texture.formId); - assert(layer.texture.quadrant < 4 && layer.texture.quadrant >= 0 - && "additional texture quadrant index error"); + assert(layer.texture.quadrant < 4 && "additional texture quadrant index error"); #if 0 FormId txt = layer.texture.formId; std::map::iterator lb = uniqueTextures.lower_bound(txt); diff --git a/components/esm4/reader.cpp b/components/esm4/reader.cpp index 19649c4fa6..72421711af 100644 --- a/components/esm4/reader.cpp +++ b/components/esm4/reader.cpp @@ -56,11 +56,13 @@ namespace ESM4 { ReaderContext::ReaderContext() : modIndex(0), recHeaderSize(sizeof(RecordHeader)), - filePos(0), recordRead(0), currWorld(0), currCell(0), cellGridValid(false) + filePos(0), fileRead(0), recordRead(0), currWorld(0), currCell(0), cellGridValid(false) { currCellGrid.cellId = 0; currCellGrid.grid.x = 0; currCellGrid.grid.y = 0; + subRecordHeader.typeId = 0; + subRecordHeader.dataSize = 0; } Reader::Reader(Files::IStreamPtr&& esmStream, const std::string& filename) diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index c3dead2962..7f659e10ea 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -80,14 +80,17 @@ boost::filesystem::path LinuxPath::getGlobalConfigPath() const boost::filesystem::path LinuxPath::getLocalPath() const { boost::filesystem::path localPath("./"); - std::string binPath(pathconf(".", _PC_PATH_MAX), '\0'); const char *statusPaths[] = {"/proc/self/exe", "/proc/self/file", "/proc/curproc/exe", "/proc/curproc/file"}; for(const char *path : statusPaths) { - if (readlink(path, &binPath[0], binPath.size()) != -1) + boost::filesystem::path statusPath(path); + if (!boost::filesystem::exists(statusPath)) continue; + + statusPath = boost::filesystem::read_symlink(statusPath); + if (!boost::filesystem::is_empty(statusPath)) { - localPath = boost::filesystem::path(binPath).parent_path() / "/"; + localPath = statusPath.parent_path() / "/"; break; } } diff --git a/components/fx/pass.hpp b/components/fx/pass.hpp index 1b8ea165e6..7f2e643c8c 100644 --- a/components/fx/pass.hpp +++ b/components/fx/pass.hpp @@ -67,7 +67,6 @@ namespace fx std::string mName; bool mLegacyGLSL; bool mUBO; - bool mSupportsNormals; std::array mRenderTargets; diff --git a/components/fx/widgets.hpp b/components/fx/widgets.hpp index f787b910c8..67f7883a67 100644 --- a/components/fx/widgets.hpp +++ b/components/fx/widgets.hpp @@ -66,8 +66,8 @@ namespace fx void initialiseOverride() override; void notifyMouseButtonClick(MyGUI::Widget* sender); - MyGUI::Button* mCheckbutton; - MyGUI::Widget* mFill; + MyGUI::Button* mCheckbutton{nullptr}; + MyGUI::Widget* mFill{nullptr}; }; template @@ -236,11 +236,11 @@ namespace fx increment(uniform->mStep); } - MyGUI::Button* mButtonDecrease; - MyGUI::Button* mButtonIncrease; - MyGUI::Widget* mDragger; - MyGUI::Widget* mFill; - MyGUI::TextBox* mValueLabel; + MyGUI::Button* mButtonDecrease{nullptr}; + MyGUI::Button* mButtonIncrease{nullptr}; + MyGUI::Widget* mDragger{nullptr}; + MyGUI::Widget* mFill{nullptr}; + MyGUI::TextBox* mValueLabel{nullptr}; T mValue; int mLastPointerX; @@ -271,9 +271,9 @@ namespace fx void initialiseOverride() override; - Gui::AutoSizedButton* mReset; - Gui::AutoSizedTextBox* mLabel; - MyGUI::Widget* mClient; + Gui::AutoSizedButton* mReset{nullptr}; + Gui::AutoSizedTextBox* mLabel{nullptr}; + MyGUI::Widget* mClient{nullptr}; std::vector mBases; }; } diff --git a/components/lua_ui/textedit.hpp b/components/lua_ui/textedit.hpp index c2f7f6340c..a9b8de1621 100644 --- a/components/lua_ui/textedit.hpp +++ b/components/lua_ui/textedit.hpp @@ -23,8 +23,8 @@ namespace LuaUi void textChange(MyGUI::EditBox*); MyGUI::EditBox* mEditBox = nullptr; - bool mMultiline; - bool mAutoSize; + bool mMultiline{false}; + bool mAutoSize{false}; }; } diff --git a/components/lua_ui/widget.cpp b/components/lua_ui/widget.cpp index 5a747a79d9..e3f45d90dd 100644 --- a/components/lua_ui/widget.cpp +++ b/components/lua_ui/widget.cpp @@ -160,7 +160,7 @@ namespace LuaUi sol::object WidgetExtension::keyEvent(MyGUI::KeyCode code) const { - SDL_Keysym keySym; + auto keySym = SDL_Keysym(); keySym.sym = SDLUtil::myGuiKeyToSdl(code); keySym.scancode = SDL_GetScancodeFromKey(keySym.sym); keySym.mod = SDL_GetModState();