Fix priority bug in AiSequence::stack (Fixes #1959)

deque
scrawl 10 years ago
parent c826de49a5
commit ee8b85aa2c

@ -260,14 +260,13 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end(); ++it) for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end(); ++it)
{ {
if(mPackages.front()->getPriority() <= package.getPriority()) if((*it)->getPriority() <= package.getPriority())
{ {
mPackages.insert(it,package.clone()); mPackages.insert(it,package.clone());
return; return;
} }
} }
if(mPackages.empty())
mPackages.push_front (package.clone()); mPackages.push_front (package.clone());
} }

Loading…
Cancel
Save