mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Always consider an actor their own ally (bug #6313)
This commit is contained in:
parent
fa820434b6
commit
5d11238723
@ -9,6 +9,7 @@
|
|||||||
Bug #5714: Touch spells cast using ExplodeSpell don't always explode
|
Bug #5714: Touch spells cast using ExplodeSpell don't always explode
|
||||||
Bug #5849: Paralysis breaks landing
|
Bug #5849: Paralysis breaks landing
|
||||||
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
|
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
|
||||||
|
Bug #6313: Followers with high Fight can turn hostile
|
||||||
Bug #6427: Enemy health bar disappears before damaging effect ends
|
Bug #6427: Enemy health bar disappears before damaging effect ends
|
||||||
Bug #6645: Enemy block sounds align with animation instead of blocked hits
|
Bug #6645: Enemy block sounds align with animation instead of blocked hits
|
||||||
Bug #6661: Saved games that have no preview screenshot cause issues or crashes
|
Bug #6661: Saved games that have no preview screenshot cause issues or crashes
|
||||||
|
@ -563,7 +563,6 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
std::set<MWWorld::Ptr> allySet;
|
std::set<MWWorld::Ptr> allySet;
|
||||||
getActorsSidingWith(ptr, allySet);
|
getActorsSidingWith(ptr, allySet);
|
||||||
allySet.insert(ptr);
|
|
||||||
std::vector<MWWorld::Ptr> allies(allySet.begin(), allySet.end());
|
std::vector<MWWorld::Ptr> allies(allySet.begin(), allySet.end());
|
||||||
for (const auto& ally : allies)
|
for (const auto& ally : allies)
|
||||||
ally.getClass().getCreatureStats(ally).getAiSequence().stopCombat(targets);
|
ally.getClass().getCreatureStats(ally).getAiSequence().stopCombat(targets);
|
||||||
@ -646,7 +645,7 @@ namespace MWMechanics
|
|||||||
// Check that an ally of actor2 is also in combat with actor1
|
// Check that an ally of actor2 is also in combat with actor1
|
||||||
for (const MWWorld::Ptr& ally2 : allies2)
|
for (const MWWorld::Ptr& ally2 : allies2)
|
||||||
{
|
{
|
||||||
if (ally2.getClass().getCreatureStats(ally2).getAiSequence().isInCombat(actor1))
|
if (ally2 != actor2 && ally2.getClass().getCreatureStats(ally2).getAiSequence().isInCombat(actor1))
|
||||||
{
|
{
|
||||||
mechanicsManager->startCombat(actor1, actor2);
|
mechanicsManager->startCombat(actor1, actor2);
|
||||||
// Also have actor1's allies start combat
|
// Also have actor1's allies start combat
|
||||||
@ -676,7 +675,7 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
for (const MWWorld::Ptr& ally : allies1)
|
for (const MWWorld::Ptr& ally : allies1)
|
||||||
{
|
{
|
||||||
if (creatureStats2.getAiSequence().isInCombat(ally))
|
if (ally != actor1 && creatureStats2.getAiSequence().isInCombat(ally))
|
||||||
{
|
{
|
||||||
aggressive = true;
|
aggressive = true;
|
||||||
break;
|
break;
|
||||||
@ -2071,6 +2070,7 @@ namespace MWMechanics
|
|||||||
std::vector<MWWorld::Ptr> Actors::getActorsSidingWith(const MWWorld::Ptr& actorPtr, bool excludeInfighting) const
|
std::vector<MWWorld::Ptr> Actors::getActorsSidingWith(const MWWorld::Ptr& actorPtr, bool excludeInfighting) const
|
||||||
{
|
{
|
||||||
std::vector<MWWorld::Ptr> list;
|
std::vector<MWWorld::Ptr> list;
|
||||||
|
list.push_back(actorPtr);
|
||||||
for (const Actor& actor : mActors)
|
for (const Actor& actor : mActors)
|
||||||
{
|
{
|
||||||
const MWWorld::Ptr& iteratedActor = actor.getPtr();
|
const MWWorld::Ptr& iteratedActor = actor.getPtr();
|
||||||
@ -2147,7 +2147,7 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
auto followers = getActorsSidingWith(actor, excludeInfighting);
|
auto followers = getActorsSidingWith(actor, excludeInfighting);
|
||||||
for (const MWWorld::Ptr& follower : followers)
|
for (const MWWorld::Ptr& follower : followers)
|
||||||
if (out.insert(follower).second)
|
if (out.insert(follower).second && follower != actor)
|
||||||
getActorsSidingWith(follower, out, excludeInfighting);
|
getActorsSidingWith(follower, out, excludeInfighting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2161,13 +2161,15 @@ namespace MWMechanics
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (const MWWorld::Ptr& follower : getActorsSidingWith(actor, true))
|
for (const MWWorld::Ptr& follower : getActorsSidingWith(actor, true))
|
||||||
if (out.insert(follower).second)
|
if (out.insert(follower).second && follower != actor)
|
||||||
getActorsSidingWith(follower, out, cachedAllies);
|
getActorsSidingWith(follower, out, cachedAllies);
|
||||||
|
|
||||||
// Cache ptrs and their sets of allies
|
// Cache ptrs and their sets of allies
|
||||||
cachedAllies.insert(std::make_pair(actor, out));
|
cachedAllies.insert(std::make_pair(actor, out));
|
||||||
for (const MWWorld::Ptr& iter : out)
|
for (const MWWorld::Ptr& iter : out)
|
||||||
{
|
{
|
||||||
|
if (iter == actor)
|
||||||
|
continue;
|
||||||
search = cachedAllies.find(iter);
|
search = cachedAllies.find(iter);
|
||||||
if (search == cachedAllies.end())
|
if (search == cachedAllies.end())
|
||||||
cachedAllies.insert(std::make_pair(iter, out));
|
cachedAllies.insert(std::make_pair(iter, out));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user