Catch exceptions in AiSequence::execute

This commit is contained in:
scrawl 2017-02-11 13:39:26 +01:00
parent 5a12407436
commit 03a10f217a

View file

@ -1,6 +1,7 @@
#include "aisequence.hpp" #include "aisequence.hpp"
#include <limits> #include <limits>
#include <iostream>
#include <components/esm/aisequence.hpp> #include <components/esm/aisequence.hpp>
@ -229,6 +230,8 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
} }
} }
try
{
if (package->execute (actor,characterController,state,duration)) if (package->execute (actor,characterController,state,duration))
{ {
// Put repeating noncombat AI packages on the end of the stack so they can be used again // Put repeating noncombat AI packages on the end of the stack so they can be used again
@ -251,6 +254,11 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
mDone = false; mDone = false;
} }
} }
catch (std::exception& e)
{
std::cerr << "Error during AiSequence::execute: " << e.what() << std::endl;
}
}
} }
void AiSequence::clear() void AiSequence::clear()