forked from mirror/openmw-tes3mp
Fixed minor issues.
1. Renamed "hightRatio" to "heightRatio". 2. Replaced magic numbers with named constants.
This commit is contained in:
parent
7fe2f86d06
commit
64cd1396ac
2 changed files with 7 additions and 5 deletions
|
@ -1978,7 +1978,8 @@ namespace MWWorld
|
||||||
|
|
||||||
bool World::isSubmerged(const MWWorld::Ptr &object) const
|
bool World::isSubmerged(const MWWorld::Ptr &object) const
|
||||||
{
|
{
|
||||||
return isUnderwater(object, 1.85f);
|
const float neckDeep = 1.85f;
|
||||||
|
return isUnderwater(object, neckDeep);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1992,11 +1993,12 @@ namespace MWWorld
|
||||||
bool
|
bool
|
||||||
World::isWading(const MWWorld::Ptr &object) const
|
World::isWading(const MWWorld::Ptr &object) const
|
||||||
{
|
{
|
||||||
return isUnderwater(object, 0.5f);
|
const float kneeDeep = 0.5f;
|
||||||
|
return isUnderwater(object, kneeDeep);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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;
|
const float *fpos = object.getRefData().getPosition().pos;
|
||||||
Ogre::Vector3 pos(fpos[0], fpos[1], fpos[2]);
|
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());
|
const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(object.getRefData().getHandle());
|
||||||
if (actor)
|
if (actor)
|
||||||
{
|
{
|
||||||
pos.z += hightRatio*actor->getHalfExtents().z;
|
pos.z += heightRatio*actor->getHalfExtents().z;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isUnderwater(object.getCell(), pos);
|
return isUnderwater(object.getCell(), pos);
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace MWWorld
|
||||||
void loadContentFiles(const Files::Collections& fileCollections,
|
void loadContentFiles(const Files::Collections& fileCollections,
|
||||||
const std::vector<std::string>& content, ContentLoader& contentLoader);
|
const std::vector<std::string>& 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()
|
///< helper function for implementing isSwimming(), isSubmerged(), isWading()
|
||||||
|
|
||||||
bool mTeleportEnabled;
|
bool mTeleportEnabled;
|
||||||
|
|
Loading…
Reference in a new issue