1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-17 10:21:11 +00:00

Make search for allies in actorAttacked recursive

This commit is contained in:
Capostrophic 2018-08-14 15:41:34 +03:00
parent 7029ed0e8d
commit 75bd6e1d28

View File

@ -1,6 +1,7 @@
#include "mechanicsmanagerimp.hpp" #include "mechanicsmanagerimp.hpp"
#include <limits.h> #include <limits.h>
#include <set>
#include <components/misc/rng.hpp> #include <components/misc/rng.hpp>
@ -1445,11 +1446,12 @@ namespace MWMechanics
if (target == getPlayer() || !attacker.getClass().isActor()) if (target == getPlayer() || !attacker.getClass().isActor())
return false; return false;
std::list<MWWorld::Ptr> followersAttacker = getActorsSidingWith(attacker); std::set<MWWorld::Ptr> followersAttacker;
getActorsSidingWith(attacker, followersAttacker);
MWMechanics::CreatureStats& statsTarget = target.getClass().getCreatureStats(target); MWMechanics::CreatureStats& statsTarget = target.getClass().getCreatureStats(target);
if (std::find(followersAttacker.begin(), followersAttacker.end(), target) != followersAttacker.end()) if (followersAttacker.find(target) != followersAttacker.end())
{ {
statsTarget.friendlyHit(); statsTarget.friendlyHit();