From 64cd1396ac0fcd9f18143dbdf142379b907a4e1f Mon Sep 17 00:00:00 2001 From: dteviot Date: Fri, 9 Jan 2015 22:17:53 +1300 Subject: [PATCH] Fixed minor issues. 1. Renamed "hightRatio" to "heightRatio". 2. Replaced magic numbers with named constants. --- apps/openmw/mwworld/worldimp.cpp | 10 ++++++---- apps/openmw/mwworld/worldimp.hpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index b99b4ff24..f9642226b 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1978,7 +1978,8 @@ namespace MWWorld bool World::isSubmerged(const MWWorld::Ptr &object) const { - return isUnderwater(object, 1.85f); + const float neckDeep = 1.85f; + return isUnderwater(object, neckDeep); } bool @@ -1992,11 +1993,12 @@ namespace MWWorld bool World::isWading(const MWWorld::Ptr &object) const { - return isUnderwater(object, 0.5f); + const float kneeDeep = 0.5f; + return isUnderwater(object, kneeDeep); } bool - World::isUnderwater(const MWWorld::Ptr &object, const float hightRatio) const + World::isUnderwater(const MWWorld::Ptr &object, const float heightRatio) const { const float *fpos = object.getRefData().getPosition().pos; Ogre::Vector3 pos(fpos[0], fpos[1], fpos[2]); @@ -2004,7 +2006,7 @@ namespace MWWorld const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(object.getRefData().getHandle()); if (actor) { - pos.z += hightRatio*actor->getHalfExtents().z; + pos.z += heightRatio*actor->getHalfExtents().z; } return isUnderwater(object.getCell(), pos); diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 708a9abc3..dfaa9f789 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -139,7 +139,7 @@ namespace MWWorld void loadContentFiles(const Files::Collections& fileCollections, const std::vector& content, ContentLoader& contentLoader); - bool isUnderwater(const MWWorld::Ptr &object, const float hightRatio) const; + bool isUnderwater(const MWWorld::Ptr &object, const float heightRatio) const; ///< helper function for implementing isSwimming(), isSubmerged(), isWading() bool mTeleportEnabled;