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

deque
scrawl 10 years ago
parent ff11745429
commit 8dd410fe96

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

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

Loading…
Cancel
Save