From 3779aaba62c207e6229690121d66576f0931ef13 Mon Sep 17 00:00:00 2001 From: Jacob Essex Date: Wed, 9 Nov 2011 23:12:10 +0000 Subject: [PATCH 1/3] Now no longer need to handle this exception here as it is handled by the dispatcher in the OpenEngine submodule --- apps/openmw/engine.cpp | 63 ++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index bdcaf627bb..7fa98f8e2c 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -408,45 +408,36 @@ void OMW::Engine::go() void OMW::Engine::activate() { - // TODO: This is only a workaround. The input dispatcher should catch any exceptions thrown inside - // the input handling functions. Looks like this will require an OpenEngine modification. - try + std::string handle = mEnvironment.mWorld->getFacedHandle(); + + if (handle.empty()) + return; + + MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle); + + if (ptr.isEmpty()) + return; + + MWScript::InterpreterContext interpreterContext (mEnvironment, + &ptr.getRefData().getLocals(), ptr); + + boost::shared_ptr action = + MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(), + mEnvironment); + + interpreterContext.activate (ptr, action); + + std::string script = MWWorld::Class::get (ptr).getScript (ptr); + + if (!script.empty()) { - std::string handle = mEnvironment.mWorld->getFacedHandle(); - - if (handle.empty()) - return; - - MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle); - - if (ptr.isEmpty()) - return; - - MWScript::InterpreterContext interpreterContext (mEnvironment, - &ptr.getRefData().getLocals(), ptr); - - boost::shared_ptr action = - MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(), - mEnvironment); - - interpreterContext.activate (ptr, action); - - std::string script = MWWorld::Class::get (ptr).getScript (ptr); - - if (!script.empty()) - { - mEnvironment.mWorld->getLocalScripts().setIgnore (ptr); - mScriptManager->run (script, interpreterContext); - } - - if (!interpreterContext.hasActivationBeenHandled()) - { - interpreterContext.executeActivation(); - } + mEnvironment.mWorld->getLocalScripts().setIgnore (ptr); + mScriptManager->run (script, interpreterContext); } - catch (const std::exception& e) + + if (!interpreterContext.hasActivationBeenHandled()) { - std::cerr << "Activation failed: " << e.what() << std::endl; + interpreterContext.executeActivation(); } } From 7a1799d5294a1a10952b15801082c4e5552b38b4 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 10 Nov 2011 08:32:13 +0100 Subject: [PATCH 2/3] submodule update --- libs/openengine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/openengine b/libs/openengine index 26b9d0fdc3..2f5eca9d87 160000 --- a/libs/openengine +++ b/libs/openengine @@ -1 +1 @@ -Subproject commit 26b9d0fdc374fac648f6293e1d4a4abdc2c20c19 +Subproject commit 2f5eca9d878526bdd9dce93ece7f42093b481545 From 746c3dc297ee983332c4dccfcf2936b51d15c17a Mon Sep 17 00:00:00 2001 From: Jacob Essex Date: Fri, 11 Nov 2011 11:25:01 +0000 Subject: [PATCH 3/3] Added some minor documentation --- apps/openmw/mwworld/refdata.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwworld/refdata.hpp b/apps/openmw/mwworld/refdata.hpp index 615081e7e1..419bb2663b 100644 --- a/apps/openmw/mwworld/refdata.hpp +++ b/apps/openmw/mwworld/refdata.hpp @@ -44,6 +44,9 @@ namespace MWWorld ESM::Position mPosition; public: + /// @param cr Used to copy constant data such as position into this class where it can + /// be altered without effecting the original data. This makes it possible + /// to reset the position as the orignal data is still held in the CellRef RefData(const ESMS::CellRef& cr) : mHasLocals (false), mEnabled (true), mCount (1), mPosition(cr.pos) {}