From ba71eefbaeaf91935f3b75e108f76525dcff8de1 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 16 Nov 2023 18:53:33 +0400 Subject: [PATCH] Fix GCC warnings --- apps/opencs/model/tools/mergestages.cpp | 4 ++-- apps/openmw/mwrender/ripples.cpp | 5 +++-- apps/openmw/mwworld/worldimp.cpp | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/opencs/model/tools/mergestages.cpp b/apps/opencs/model/tools/mergestages.cpp index 5a7fa6c1b9..c2ab74bcca 100644 --- a/apps/opencs/model/tools/mergestages.cpp +++ b/apps/opencs/model/tools/mergestages.cpp @@ -189,9 +189,9 @@ void CSMTools::FixLandsAndLandTexturesMergeStage::perform(int stage, CSMDoc::Mes CSMWorld::IdTable& ltexTable = dynamic_cast( *mState.mTarget->getData().getTableModel(CSMWorld::UniversalId::Type_LandTextures)); - const std::string& id = mState.mTarget->getData().getLand().getId(stage).getRefIdString(); + const auto& id = mState.mTarget->getData().getLand().getId(stage); - CSMWorld::TouchLandCommand cmd(landTable, ltexTable, id); + CSMWorld::TouchLandCommand cmd(landTable, ltexTable, id.getRefIdString()); cmd.redo(); // Get rid of base data diff --git a/apps/openmw/mwrender/ripples.cpp b/apps/openmw/mwrender/ripples.cpp index 191ff0e714..130e005729 100644 --- a/apps/openmw/mwrender/ripples.cpp +++ b/apps/openmw/mwrender/ripples.cpp @@ -128,10 +128,11 @@ namespace MWRender { size_t frameId = nv.getFrameStamp()->getFrameNumber() % 2; - const ESM::Position& player = MWMechanics::getPlayer().getRefData().getPosition(); + const auto& player = MWMechanics::getPlayer(); + const ESM::Position& playerPos = player.getRefData().getPosition(); mCurrentPlayerPos = osg::Vec2f( - std::floor(player.pos[0] / mWorldScaleFactor), std::floor(player.pos[1] / mWorldScaleFactor)); + std::floor(playerPos.pos[0] / mWorldScaleFactor), std::floor(playerPos.pos[1] / mWorldScaleFactor)); osg::Vec2f offset = mCurrentPlayerPos - mLastPlayerPos; mLastPlayerPos = mCurrentPlayerPos; mState[frameId].mPaused = mPaused; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 20e4122766..d945aa5848 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1737,13 +1737,14 @@ namespace MWWorld void World::updateSoundListener() { osg::Vec3f cameraPosition = mRendering->getCamera()->getPosition(); - const ESM::Position& refpos = getPlayerPtr().getRefData().getPosition(); + const auto& player = getPlayerPtr(); + const ESM::Position& refpos = player.getRefData().getPosition(); osg::Vec3f listenerPos; if (isFirstPerson()) listenerPos = cameraPosition; else - listenerPos = refpos.asVec3() + osg::Vec3f(0, 0, 1.85f * mPhysics->getHalfExtents(getPlayerPtr()).z()); + listenerPos = refpos.asVec3() + osg::Vec3f(0, 0, 1.85f * mPhysics->getHalfExtents(player).z()); osg::Quat listenerOrient = osg::Quat(refpos.rot[1], osg::Vec3f(0, -1, 0)) * osg::Quat(refpos.rot[0], osg::Vec3f(-1, 0, 0)) * osg::Quat(refpos.rot[2], osg::Vec3f(0, 0, -1)); @@ -1751,7 +1752,7 @@ namespace MWWorld osg::Vec3f forward = listenerOrient * osg::Vec3f(0, 1, 0); osg::Vec3f up = listenerOrient * osg::Vec3f(0, 0, 1); - bool underwater = isUnderwater(getPlayerPtr().getCell(), cameraPosition); + bool underwater = isUnderwater(player.getCell(), cameraPosition); MWBase::Environment::get().getSoundManager()->setListenerPosDir(listenerPos, forward, up, underwater); }