1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 10:23:56 +00:00

removed the attempt to unify activation and use scripts which was incorrect

This commit is contained in:
scrawl 2012-05-15 20:51:19 +02:00
parent 71de10cb7e
commit ca4fa21d64
4 changed files with 19 additions and 34 deletions

View file

@ -437,11 +437,25 @@ void OMW::Engine::activate()
return;
}
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
boost::shared_ptr<MWWorld::Action> action =
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
// execute action and script
MWBase::Environment::get().getWorld()->executeActionScript(ptr, action);
interpreterContext.activate (ptr, action);
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
if (!script.empty())
{
MWBase::Environment::get().getWorld()->getLocalScripts().setIgnore (ptr);
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
}
if (!interpreterContext.hasActivationBeenHandled())
{
interpreterContext.executeActivation();
}
}
void OMW::Engine::screenshot()

View file

@ -153,8 +153,9 @@ namespace MWGui
std::cout << "Item can't be equipped" << std::endl;
// execute action and script
MWBase::Environment::get().getWorld()->executeActionScript(ptr, action);
action->execute();
/// \todo scripts
// this is necessary for books/scrolls: if they are already in the player's inventory,
// the "Take" button should not be visible.

View file

@ -17,13 +17,6 @@
#include "../mwgui/window_manager.hpp"
#include "../mwscript/scriptmanager.hpp"
#include "../mwscript/compilercontext.hpp"
#include "../mwscript/interpretercontext.hpp"
#include "../mwscript/extensions.hpp"
#include "../mwscript/globalscripts.hpp"
#include "ptr.hpp"
#include "class.hpp"
#include "player.hpp"
@ -1025,24 +1018,4 @@ namespace MWWorld
mWorldScene->insertObject(object, cell);
}
void World::executeActionScript(MWWorld::Ptr ptr, boost::shared_ptr<Action> action)
{
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
action->execute();
// execute script
interpreterContext.activate (ptr, action);
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
if (!script.empty())
{
getLocalScripts().setIgnore (ptr);
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
}
if (!interpreterContext.hasActivationBeenHandled())
{
interpreterContext.executeActivation();
}
}
}

View file

@ -274,9 +274,6 @@ namespace MWWorld
bool canPlaceObject(float cursorX, float cursorY);
///< @return true if it is possible to place on object at specified cursor location
void executeActionScript(MWWorld::Ptr ptr, boost::shared_ptr<Action> action);
///< execute the activation script of an object (when activating the object with space, or when activating it via the inventory)
};
}