Fix some issues, found by CoverityScan

pull/3024/head
Andrei Kortunov 4 years ago
parent 00503d86e1
commit 64ba81ecf2

@ -590,7 +590,9 @@ namespace MWMechanics
if (!actorState.isTurningToPlayer())
{
float angle = std::atan2(dir.x(), dir.y());
float from = dir.x();
float to = dir.y();
float angle = std::atan2(from, to);
actorState.setAngleToPlayer(angle);
float deltaAngle = Misc::normalizeAngle(angle - actor.getRefData().getPosition().rot[2]);
if (!mSmoothMovement || std::abs(deltaAngle) > osg::DegreesToRadians(60.f))
@ -1723,7 +1725,7 @@ namespace MWMechanics
shouldAvoidCollision = true;
else if (package->getTypeId() == AiPackageTypeId::Wander && giveWayWhenIdle)
{
if (!dynamic_cast<const AiWander*>(package.get())->isStationary())
if (!static_cast<const AiWander*>(package.get())->isStationary())
shouldAvoidCollision = true;
}
else if (package->getTypeId() == AiPackageTypeId::Combat || package->getTypeId() == AiPackageTypeId::Pursue)

@ -142,6 +142,7 @@ namespace MWPhysics
{
PhysicsTaskScheduler::PhysicsTaskScheduler(float physicsDt, std::shared_ptr<btCollisionWorld> collisionWorld)
: mPhysicsDt(physicsDt)
, mTimeAccum(0.f)
, mCollisionWorld(std::move(collisionWorld))
, mNumJobs(0)
, mRemainingSteps(0)

@ -66,6 +66,9 @@ namespace MWRender
mIsNearest(false),
mHeight(124.f),
mBaseCameraDistance(Settings::Manager::getFloat("third person camera distance", "Camera")),
mPitch(0.f),
mYaw(0.f),
mRoll(0.f),
mVanityToggleQueued(false),
mVanityToggleQueuedValue(false),
mViewModeToggleQueued(false),
@ -81,6 +84,9 @@ namespace MWRender
mDynamicCameraDistanceEnabled(false),
mShowCrosshairInThirdPersonMode(false),
mHeadBobbingEnabled(Settings::Manager::getBool("head bobbing", "Camera")),
mHeadBobbingOffset(0.f),
mHeadBobbingWeight(0.f),
mTotalMovement(0.f),
mDeferredRotation(osg::Vec3f()),
mDeferredRotationDisabled(false)
{

@ -74,8 +74,8 @@ namespace MWRender
bool mHeadBobbingEnabled;
float mHeadBobbingOffset;
float mHeadBobbingWeight = 0; // Value from 0 to 1 for smooth enabling/disabling.
float mTotalMovement = 0; // Needed for head bobbing.
float mHeadBobbingWeight; // Value from 0 to 1 for smooth enabling/disabling.
float mTotalMovement; // Needed for head bobbing.
void updateHeadBobbing(float duration);
void updateFocalPointOffset(float duration);

@ -65,6 +65,9 @@ namespace MWSound
, mUnderwaterSound(nullptr)
, mNearWaterSound(nullptr)
, mPlaybackPaused(false)
, mTimePassed(0.f)
, mLastCell(nullptr)
, mCurrentRegionSound(nullptr)
{
mBufferCacheMin = std::max(Settings::Manager::getInt("buffer cache min", "Sound"), 1);
mBufferCacheMax = std::max(Settings::Manager::getInt("buffer cache max", "Sound"), 1);

@ -116,9 +116,9 @@ namespace MWSound
RegionSoundSelector mRegionSoundSelector;
float mTimePassed = 0;
float mTimePassed;
const ESM::Cell *mLastCell = nullptr;
const ESM::Cell *mLastCell;
Sound* mCurrentRegionSound;

@ -331,9 +331,10 @@ namespace ESM
std::copy(land.mWnam, land.mWnam + LAND_GLOBAL_MAP_LOD_SIZE, mWnam);
}
Land& Land::operator= (Land land)
Land& Land::operator= (const Land& land)
{
swap (land);
Land tmp(land);
swap(tmp);
return *this;
}

@ -148,7 +148,7 @@ struct Land
Land (const Land& land);
Land& operator= (Land land);
Land& operator= (const Land& land);
void swap (Land& land);

Loading…
Cancel
Save