From 7de3afaa7d29502a653ab8a8f230e9fcf98f8cb6 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 7 Jul 2016 21:46:58 +0900 Subject: [PATCH] Cleanups --- apps/openmw/mwworld/actiontrap.cpp | 2 +- apps/openmw/mwworld/actiontrap.hpp | 2 +- apps/openmw/mwworld/worldimp.cpp | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwworld/actiontrap.cpp b/apps/openmw/mwworld/actiontrap.cpp index 991e05313..e9ec5fa5e 100644 --- a/apps/openmw/mwworld/actiontrap.cpp +++ b/apps/openmw/mwworld/actiontrap.cpp @@ -21,7 +21,7 @@ namespace MWWorld { MWMechanics::CastSpell cast(mTrapSource, mTrapSource); cast.mHitPosition = trapPosition; - cast.cast(mSpellId); + cast.cast(mSpellId); } else // actor activated object within range of trap { diff --git a/apps/openmw/mwworld/actiontrap.hpp b/apps/openmw/mwworld/actiontrap.hpp index 5fb76eb5d..6a0820381 100644 --- a/apps/openmw/mwworld/actiontrap.hpp +++ b/apps/openmw/mwworld/actiontrap.hpp @@ -13,7 +13,7 @@ namespace MWWorld std::string mSpellId; MWWorld::Ptr mTrapSource; - virtual void executeImp (const Ptr& actor, float distanceToObject = -1); + virtual void executeImp (const Ptr& actor, float distanceToObject); public: diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 3b53e8cac..05b060bce 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -150,7 +150,7 @@ namespace MWWorld mSky (true), mCells (mStore, mEsm), mGodMode(false), mScriptsEnabled(true), mContentFiles (contentFiles), mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript), - mStartCell (startCell), mDistanceToFacedObject(0), mTeleportEnabled(true), + mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true), mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0) { mPhysics = new MWPhysics::PhysicsSystem(resourceSystem, rootNode); @@ -1011,11 +1011,10 @@ namespace MWWorld MWWorld::Ptr World::getFacedObject() { MWWorld::Ptr facedObject; - float distanceToObject; if (MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->isConsoleMode()) - facedObject = getFacedObject(getMaxActivationDistance() * 50, distanceToObject, false); + facedObject = getFacedObject(getMaxActivationDistance() * 50, mDistanceToFacedObject, false); else { float telekinesisRangeBonus = @@ -1025,14 +1024,12 @@ namespace MWWorld float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus; - facedObject = getFacedObject(activationDistance, distanceToObject, true); + facedObject = getFacedObject(activationDistance, mDistanceToFacedObject, true); if (!facedObject.isEmpty() && !facedObject.getClass().allowTelekinesis(facedObject) - && distanceToObject > getMaxActivationDistance()) + && mDistanceToFacedObject > getMaxActivationDistance()) return 0; } - - mDistanceToFacedObject = distanceToObject; return facedObject; } @@ -1733,6 +1730,8 @@ namespace MWWorld facedObject = rayToObject.mHitObject; if (!facedObject.isEmpty()) distance = rayToObject.mRatio * maxDistance; + else + distance = -1; return facedObject; }