1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 13:23:55 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
mrcheko 2014-06-13 12:51:28 +04:00
commit ae552d4e85

View file

@ -167,11 +167,14 @@ namespace MWMechanics
const MWWorld::Class& actorClass = actor.getClass(); const MWWorld::Class& actorClass = actor.getClass();
MWBase::World* world = MWBase::Environment::get().getWorld(); MWBase::World* world = MWBase::Environment::get().getWorld();
if (!actorClass.isNpc() && target == world->getPlayerPtr() && if (!actorClass.isNpc() &&
(actorClass.canSwim(actor) && !actor.getClass().canWalk(actor) // 1. pure water creature and Player moved out of water // 1. pure water creature and Player moved out of water
&& !world->isSwimming(target)) ((target == world->getPlayerPtr() &&
|| (!actorClass.canSwim(actor) && world->isSwimming(target))) // 2. creature can't swim to Player actorClass.canSwim(actor) && !actor.getClass().canWalk(actor) && !world->isSwimming(target))
// 2. creature can't swim to target
|| (!actorClass.canSwim(actor) && world->isSwimming(target))))
{ {
if (target == world->getPlayerPtr())
actorClass.getCreatureStats(actor).setHostile(false); actorClass.getCreatureStats(actor).setHostile(false);
actorClass.getCreatureStats(actor).setAttackingOrSpell(false); actorClass.getCreatureStats(actor).setAttackingOrSpell(false);
return true; return true;
@ -246,7 +249,7 @@ namespace MWMechanics
const ESM::Weapon *weapon = NULL; const ESM::Weapon *weapon = NULL;
MWMechanics::WeaponType weaptype; MWMechanics::WeaponType weaptype;
float weapRange, weapSpeed = 1.0f; float weapRange;
actorClass.getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true); actorClass.getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true);
@ -275,7 +278,6 @@ namespace MWMechanics
// All other WeapTypes are actually weapons, so get<ESM::Weapon> is safe. // All other WeapTypes are actually weapons, so get<ESM::Weapon> is safe.
weapon = weaponSlot->get<ESM::Weapon>()->mBase; weapon = weaponSlot->get<ESM::Weapon>()->mBase;
weapRange = weapon->mData.mReach; weapRange = weapon->mData.mReach;
weapSpeed = weapon->mData.mSpeed;
} }
weapRange *= 100.0f; weapRange *= 100.0f;
} }