1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwscript/cellextensions.cpp

43 lines
1.1 KiB
C++
Raw Normal View History

2010-07-03 10:12:13 +00:00
#include "cellextensions.hpp"
#include <components/compiler/extensions.hpp>
#include <components/interpreter/interpreter.hpp>
#include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp>
#include "interpretercontext.hpp"
namespace MWScript
{
namespace Cell
{
class OpCellChanged : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context
= static_cast<InterpreterContext&> (runtime.getContext());
runtime.push (context.cellChanged() ? 1 : 0);
}
};
const int opcodeCellChanged = 0x2000000;
void registerExtensions (Compiler::Extensions& extensions)
{
extensions.registerFunction ("cellchanged", 'l', "", opcodeCellChanged);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
{
interpreter.installSegment5 (opcodeCellChanged, new OpCellChanged);
}
}
}