Merge pull request #108 from OpenMW/master

Add OpenMW changes up to 20 Nov, part 3
coverity_scan^2
David Cernat 8 years ago committed by GitHub
commit 1feec58ed2

@ -551,7 +551,7 @@ namespace MWBase
/// Resets all actors in the current active cells to their original location within that cell. /// Resets all actors in the current active cells to their original location within that cell.
virtual void resetActors() = 0; virtual void resetActors() = 0;
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) = 0; virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const = 0;
/// Return a vector aiming the actor's weapon towards a target. /// Return a vector aiming the actor's weapon towards a target.
/// @note The length of the vector is the distance between actor and target. /// @note The length of the vector is the distance between actor and target.

@ -11,6 +11,7 @@
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwworld/player.hpp"
#include "../mwmechanics/spellcasting.hpp" #include "../mwmechanics/spellcasting.hpp"
#include "../mwmechanics/spells.hpp" #include "../mwmechanics/spells.hpp"
@ -122,8 +123,15 @@ namespace MWGui
const ESM::Spell* spell = const ESM::Spell* spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId); MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
if (spell->mData.mFlags & ESM::Spell::F_Always MWWorld::Ptr player = MWMechanics::getPlayer();
|| spell->mData.mType == ESM::Spell::ST_Power) std::string raceId = player.get<ESM::NPC>()->mBase->mRace;
const std::string& signId =
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceId);
const ESM::BirthSign* birthsign = MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find(signId);
// can't delete racial spells, birthsign spells or powers
if (race->mPowers.exists(spell->mId) || birthsign->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power)
{ {
MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}");
} }

@ -117,6 +117,7 @@ RippleSimulation::~RippleSimulation()
void RippleSimulation::update(float dt) void RippleSimulation::update(float dt)
{ {
const MWBase::World* world = MWBase::Environment::get().getWorld();
for (std::vector<Emitter>::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it) for (std::vector<Emitter>::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it)
{ {
if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayerPtr()) if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayerPtr())
@ -128,10 +129,8 @@ void RippleSimulation::update(float dt)
osg::Vec3f currentPos (it->mPtr.getRefData().getPosition().asVec3()); osg::Vec3f currentPos (it->mPtr.getRefData().getPosition().asVec3());
if ( (currentPos - it->mLastEmitPosition).length() > 10 bool shouldEmit = ( world->isUnderwater (it->mPtr.getCell(), it->mPtr.getRefData().getPosition().asVec3()) && !world->isSubmerged(it->mPtr) ) || world->isWalkingOnWater(it->mPtr);
// Only emit when close to the water surface, not above it and not too deep in the water if ( shouldEmit && (currentPos - it->mLastEmitPosition).length() > 10 )
&& MWBase::Environment::get().getWorld ()->isUnderwater (it->mPtr.getCell(), it->mPtr.getRefData().getPosition().asVec3())
&& !MWBase::Environment::get().getWorld()->isSubmerged(it->mPtr))
{ {
it->mLastEmitPosition = currentPos; it->mLastEmitPosition = currentPos;

@ -3380,7 +3380,7 @@ namespace MWWorld
} }
} }
bool World::isWalkingOnWater(const ConstPtr &actor) bool World::isWalkingOnWater(const ConstPtr &actor) const
{ {
const MWPhysics::Actor* physicActor = mPhysics->getActor(actor); const MWPhysics::Actor* physicActor = mPhysics->getActor(actor);
if (physicActor && physicActor->isWalkingOnWater()) if (physicActor && physicActor->isWalkingOnWater())

@ -654,7 +654,7 @@ namespace MWWorld
/// Resets all actors in the current active cells to their original location within that cell. /// Resets all actors in the current active cells to their original location within that cell.
virtual void resetActors(); virtual void resetActors();
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor); virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const;
/// Return a vector aiming the actor's weapon towards a target. /// Return a vector aiming the actor's weapon towards a target.
/// @note The length of the vector is the distance between actor and target. /// @note The length of the vector is the distance between actor and target.

Loading…
Cancel
Save