1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

minor cleanup and silenced a warning

This commit is contained in:
Marc Zinnschlag 2014-05-26 10:14:24 +02:00
parent f0d0a31a19
commit 4aab4bae65

View File

@ -157,13 +157,16 @@ namespace MWMechanics
if(target.getClass().getCreatureStats(target).isDead())
return true;
if (!actor.getClass().isNpc() && target == MWBase::Environment::get().getWorld()->getPlayerPtr() &&
(actor.getClass().canSwim(actor) && !actor.getClass().canWalk(actor) // pure water creature
&& !MWBase::Environment::get().getWorld()->isSwimming(target)) // Player moved out of water
|| (!actor.getClass().canSwim(actor) && MWBase::Environment::get().getWorld()->isSwimming(target))) // creature can't swim to Player
const MWWorld::Class& actorClass = actor.getClass();
MWBase::World& world = *MWBase::Environment::get().getWorld();
if ((!actorClass.isNpc() && target == world.getPlayerPtr() &&
actorClass.canSwim(actor) && !actorClass.canWalk(actor) // pure water creature
&& !world.isSwimming(target)) // Player moved out of water
|| (!actorClass.canSwim(actor) && world.isSwimming(target))) // creature can't swim to Player
{
actor.getClass().getCreatureStats(actor).setHostile(false);
actor.getClass().getCreatureStats(actor).setAttackingOrSpell(false);
actorClass.getCreatureStats(actor).setHostile(false);
actorClass.getCreatureStats(actor).setAttackingOrSpell(false);
return true;
}