1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:23:52 +00:00

Teleport indirect followers as well when using a door (Fixes #1974)

This commit is contained in:
scrawl 2014-10-05 15:04:56 +02:00
parent ff11745429
commit 8dd410fe96
2 changed files with 22 additions and 2 deletions

View file

@ -1447,6 +1447,8 @@ namespace MWMechanics
continue; continue;
if (followTarget == actor) if (followTarget == actor)
list.push_back(iter->first); list.push_back(iter->first);
else
break;
} }
else if ((*it)->getTypeId() != MWMechanics::AiPackage::TypeIdCombat) else if ((*it)->getTypeId() != MWMechanics::AiPackage::TypeIdCombat)
break; break;

View file

@ -5,6 +5,23 @@
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "player.hpp" #include "player.hpp"
namespace
{
void getFollowers (const MWWorld::Ptr& actor, std::set<MWWorld::Ptr>& out)
{
std::list<MWWorld::Ptr> followers = MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor);
for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
{
if (out.insert(*it).second)
{
getFollowers(*it, out);
}
}
}
}
namespace MWWorld namespace MWWorld
{ {
ActionTeleport::ActionTeleport (const std::string& cellName, ActionTeleport::ActionTeleport (const std::string& cellName,
@ -16,8 +33,9 @@ namespace MWWorld
void ActionTeleport::executeImp (const Ptr& actor) void ActionTeleport::executeImp (const Ptr& actor)
{ {
//find any NPC that is following the actor and teleport him too //find any NPC that is following the actor and teleport him too
std::list<MWWorld::Ptr> followers = MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor); std::set<MWWorld::Ptr> followers;
for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it) getFollowers(actor, followers);
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
{ {
teleport(*it); teleport(*it);
} }