forked from mirror/openmw-tes3mp
merged CompilerScriptContext into base class
This commit is contained in:
parent
5174679864
commit
530caac39b
4 changed files with 24 additions and 25 deletions
|
@ -43,7 +43,6 @@ set(GAMESCRIPT_HEADER
|
|||
apps/openmw/mwscript/locals.hpp
|
||||
apps/openmw/mwscript/scriptmanager.hpp
|
||||
apps/openmw/mwscript/compilercontext.hpp
|
||||
apps/openmw/mwscript/compilercontextscript.hpp
|
||||
apps/openmw/mwscript/interpretercontext.hpp
|
||||
apps/openmw/mwscript/cellextensions.hpp
|
||||
apps/openmw/mwscript/extensions.hpp)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "mwinput/inputmanager.hpp"
|
||||
|
||||
#include "mwscript/scriptmanager.hpp"
|
||||
#include "mwscript/compilercontextscript.hpp"
|
||||
#include "mwscript/compilercontext.hpp"
|
||||
#include "mwscript/interpretercontext.hpp"
|
||||
#include "mwscript/extensions.hpp"
|
||||
|
||||
|
@ -173,7 +173,7 @@ void OMW::Engine::go()
|
|||
|
||||
MWScript::registerExtensions (mExtensions);
|
||||
|
||||
mScriptContext = new MWScript::CompilerContextScript;
|
||||
mScriptContext = new MWScript::CompilerContext (MWScript::CompilerContext::Type_Full);
|
||||
mScriptContext->setExtensions (&mExtensions);
|
||||
|
||||
mScriptManager = new MWScript::ScriptManager (mWorld->getStore(), mVerboseScripts,
|
||||
|
|
|
@ -7,6 +7,28 @@ namespace MWScript
|
|||
{
|
||||
class CompilerContext : public Compiler::Context
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type
|
||||
{
|
||||
Type_Full, // global, local, targetted
|
||||
Type_Dialgoue,
|
||||
Type_Console
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Type mType;
|
||||
|
||||
public:
|
||||
|
||||
CompilerContext (Type type) : mType (type) {}
|
||||
|
||||
// Is the compiler allowed to declare local variables?
|
||||
virtual bool canDeclareLocals() const
|
||||
{
|
||||
return mType==Type_Full;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef GAME_SCRIPT_COMPILERCONTEXTSCRIPT_H
|
||||
#define GAME_SCRIPT_COMPILERCONTEXTSCRIPT_H
|
||||
|
||||
#include "compilercontext.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
/// Context for local scripts, global scripts and targetted scripts
|
||||
|
||||
class CompilerContextScript : public CompilerContext
|
||||
{
|
||||
public:
|
||||
|
||||
// Is the compiler allowed to declare local variables?
|
||||
virtual bool canDeclareLocals() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue