Fix for some coverity defects

openmw-35
scrawl 10 years ago
parent edbac30a57
commit 6b2df95167

@ -2107,6 +2107,9 @@ namespace MWWorld
Ogre::Vector3 playerPos(refdata.getPosition().pos); Ogre::Vector3 playerPos(refdata.getPosition().pos);
const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle()); const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle());
if (!physactor)
return 0; // shouldn't happen
if((!physactor->getOnGround()&&physactor->getCollisionMode()) || isUnderwater(currentCell, playerPos) || isWalkingOnWater(player)) if((!physactor->getOnGround()&&physactor->getCollisionMode()) || isUnderwater(currentCell, playerPos) || isWalkingOnWater(player))
return 2; return 2;
if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) ||
@ -2326,9 +2329,15 @@ namespace MWWorld
if (!targetActor.getRefData().getBaseNode() || !targetActor.getRefData().getBaseNode()) if (!targetActor.getRefData().getBaseNode() || !targetActor.getRefData().getBaseNode())
return false; // not in active cell return false; // not in active cell
Ogre::Vector3 halfExt1 = mPhysEngine->getCharacter(actor.getRefData().getHandle())->getHalfExtents(); OEngine::Physic::PhysicActor* actor1 = mPhysEngine->getCharacter(actor.getRefData().getHandle());
OEngine::Physic::PhysicActor* actor2 = mPhysEngine->getCharacter(targetActor.getRefData().getHandle());
if (!actor1 || !actor2)
return false;
Ogre::Vector3 halfExt1 = actor1->getHalfExtents();
const float* pos1 = actor.getRefData().getPosition().pos; const float* pos1 = actor.getRefData().getPosition().pos;
Ogre::Vector3 halfExt2 = mPhysEngine->getCharacter(targetActor.getRefData().getHandle())->getHalfExtents(); Ogre::Vector3 halfExt2 = actor2->getHalfExtents();
const float* pos2 = targetActor.getRefData().getPosition().pos; const float* pos2 = targetActor.getRefData().getPosition().pos;
btVector3 from(pos1[0],pos1[1],pos1[2]+halfExt1.z*2*0.9); // eye level btVector3 from(pos1[0],pos1[1],pos1[2]+halfExt1.z*2*0.9); // eye level

@ -36,6 +36,9 @@ namespace ICS
, mDetectingBindingControl(NULL) , mDetectingBindingControl(NULL)
, mLog(log) , mLog(log)
, mXmouseAxisBinded(false), mYmouseAxisBinded(false) , mXmouseAxisBinded(false), mYmouseAxisBinded(false)
, mClientHeight(1)
, mClientWidth(1)
, mDetectingBindingDirection(Control::STOP)
{ {
ICS_LOG(" - Creating InputControlSystem - "); ICS_LOG(" - Creating InputControlSystem - ");

Loading…
Cancel
Save