Now no longer need to handle this exception here as it is handled by the dispatcher in the OpenEngine submodule

actorid
Jacob Essex 13 years ago
parent 9aac625000
commit 3779aaba62

@ -408,45 +408,36 @@ void OMW::Engine::go()
void OMW::Engine::activate() void OMW::Engine::activate()
{ {
// TODO: This is only a workaround. The input dispatcher should catch any exceptions thrown inside std::string handle = mEnvironment.mWorld->getFacedHandle();
// the input handling functions. Looks like this will require an OpenEngine modification.
try
{
std::string handle = mEnvironment.mWorld->getFacedHandle();
if (handle.empty()) if (handle.empty())
return; return;
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle); MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
if (ptr.isEmpty()) if (ptr.isEmpty())
return; return;
MWScript::InterpreterContext interpreterContext (mEnvironment, MWScript::InterpreterContext interpreterContext (mEnvironment,
&ptr.getRefData().getLocals(), ptr); &ptr.getRefData().getLocals(), ptr);
boost::shared_ptr<MWWorld::Action> action = boost::shared_ptr<MWWorld::Action> action =
MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(), MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(),
mEnvironment); mEnvironment);
interpreterContext.activate (ptr, action); interpreterContext.activate (ptr, action);
std::string script = MWWorld::Class::get (ptr).getScript (ptr); std::string script = MWWorld::Class::get (ptr).getScript (ptr);
if (!script.empty()) if (!script.empty())
{ {
mEnvironment.mWorld->getLocalScripts().setIgnore (ptr); mEnvironment.mWorld->getLocalScripts().setIgnore (ptr);
mScriptManager->run (script, interpreterContext); mScriptManager->run (script, interpreterContext);
}
if (!interpreterContext.hasActivationBeenHandled())
{
interpreterContext.executeActivation();
}
} }
catch (const std::exception& e)
if (!interpreterContext.hasActivationBeenHandled())
{ {
std::cerr << "Activation failed: " << e.what() << std::endl; interpreterContext.executeActivation();
} }
} }

Loading…
Cancel
Save