You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
15 years ago
|
#ifndef INTERPRETER_SCRIPTOPCODES_H_INCLUDED
|
||
|
#define INTERPRETER_SCRIPTOPCODES_H_INCLUDED
|
||
|
|
||
|
#include "opcodes.hpp"
|
||
|
#include "runtime.hpp"
|
||
|
#include "context.hpp"
|
||
|
|
||
|
namespace Interpreter
|
||
|
{
|
||
|
class OpScriptRunning : public Opcode0
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
virtual void execute (Runtime& runtime)
|
||
|
{
|
||
|
std::string name = runtime.getStringLiteral (runtime[0]);
|
||
|
runtime[0] = runtime.getContext().isScriptRunning (name);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
class OpStartScript : public Opcode0
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
virtual void execute (Runtime& runtime)
|
||
|
{
|
||
|
std::string name = runtime.getStringLiteral (runtime[0]);
|
||
|
runtime.pop();
|
||
|
runtime.getContext().startScript (name);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
class OpStopScript : public Opcode0
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
virtual void execute (Runtime& runtime)
|
||
|
{
|
||
|
std::string name = runtime.getStringLiteral (runtime[0]);
|
||
|
runtime.pop();
|
||
|
runtime.getContext().stopScript (name);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|