Skip to content

Commit

Permalink
Merge branch 'warningfixes' into 'master'
Browse files Browse the repository at this point in the history
Fix warnings

See merge request OpenMW/openmw!3587
  • Loading branch information
jvoisin committed Nov 17, 2023
2 parents 13deb0f + ba71eef commit 2150e4c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions apps/opencs/model/tools/mergestages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ void CSMTools::FixLandsAndLandTexturesMergeStage::perform(int stage, CSMDoc::Mes
CSMWorld::IdTable& ltexTable = dynamic_cast<CSMWorld::IdTable&>(
*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
Expand Down
5 changes: 3 additions & 2 deletions apps/openmw/mwrender/ripples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions apps/openmw/mwworld/worldimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1737,21 +1737,22 @@ 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));

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);
}
Expand Down
4 changes: 2 additions & 2 deletions components/nif/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ namespace Nif
if (!hasPresenceFlags || nif->get<bool>())
nif->readVector(mVertexMap, numVertices);
if (!hasPresenceFlags || nif->get<bool>())
nif->readVector(mWeights, numVertices * bonesPerVertex);
nif->readVector(mWeights, static_cast<size_t>(numVertices) * bonesPerVertex);
std::vector<unsigned short> stripLengths;
nif->readVector(stripLengths, numStrips);
if (!hasPresenceFlags || nif->get<bool>())
Expand All @@ -428,7 +428,7 @@ namespace Nif
nif->readVector(mTriangles, numTriangles * 3);
}
if (nif->get<uint8_t>() != 0)
nif->readVector(mBoneIndices, numVertices * bonesPerVertex);
nif->readVector(mBoneIndices, static_cast<size_t>(numVertices) * bonesPerVertex);
if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO3)
{
nif->read(mLODLevel);
Expand Down

0 comments on commit 2150e4c

Please sign in to comment.