|
|
|
@ -1860,24 +1860,19 @@ namespace MWMechanics
|
|
|
|
|
MWWorld::Ptr player = getPlayer();
|
|
|
|
|
const osg::Vec3f playerPos = player.getRefData().getPosition().asVec3();
|
|
|
|
|
bool hasHostiles = false; // need to know this to play Battle music
|
|
|
|
|
bool aiActive = MWBase::Environment::get().getMechanicsManager()->isAIActive();
|
|
|
|
|
|
|
|
|
|
if (aiActive)
|
|
|
|
|
for(PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
|
|
|
|
{
|
|
|
|
|
for(PtrActorMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
|
|
|
|
{
|
|
|
|
|
if (iter->first == player) continue;
|
|
|
|
|
if (iter->first == player) continue;
|
|
|
|
|
|
|
|
|
|
bool inProcessingRange = (playerPos - iter->first.getRefData().getPosition().asVec3()).length2() <= mActorsProcessingRange*mActorsProcessingRange;
|
|
|
|
|
if (inProcessingRange)
|
|
|
|
|
{
|
|
|
|
|
MWMechanics::CreatureStats& stats = iter->first.getClass().getCreatureStats(iter->first);
|
|
|
|
|
if (!stats.isDead() && stats.getAiSequence().isInCombat())
|
|
|
|
|
{
|
|
|
|
|
hasHostiles = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bool inProcessingRange = (playerPos - iter->first.getRefData().getPosition().asVec3()).length2() <= mActorsProcessingRange*mActorsProcessingRange;
|
|
|
|
|
if (!inProcessingRange) continue;
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = iter->first.getClass().getCreatureStats(iter->first);
|
|
|
|
|
if (!stats.isDead() && stats.getAiSequence().isInCombat())
|
|
|
|
|
{
|
|
|
|
|
hasHostiles = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|