2011-04-06 23:30:59 +03:00
|
|
|
/*
|
|
|
|
* ERMInterpreter.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ERMParser.h"
|
|
|
|
#include "ERMScriptModule.h"
|
2011-04-06 23:30:59 +03:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
class ERMInterpreter;
|
|
|
|
|
2011-04-10 19:39:34 +03:00
|
|
|
namespace VERMInterpreter
|
|
|
|
{
|
|
|
|
using namespace ERM;
|
|
|
|
|
|
|
|
//different exceptions that can be thrown during interpreting
|
|
|
|
class EInterpreterProblem : public std::exception
|
|
|
|
{
|
|
|
|
std::string problem;
|
|
|
|
public:
|
2013-06-26 17:25:23 +03:00
|
|
|
const char * what() const throw() override
|
2011-04-10 19:39:34 +03:00
|
|
|
{
|
|
|
|
return problem.c_str();
|
|
|
|
}
|
2011-04-16 20:39:38 +03:00
|
|
|
~EInterpreterProblem() throw()
|
|
|
|
{}
|
2011-04-10 19:39:34 +03:00
|
|
|
EInterpreterProblem(const std::string & problemDesc) : problem(problemDesc)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ESymbolNotFound : public EInterpreterProblem
|
|
|
|
{
|
|
|
|
ESymbolNotFound(const std::string & sym) :
|
|
|
|
EInterpreterProblem(std::string("Symbol \"") + sym + std::string("\" not found!"))
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EInvalidTrigger : public EInterpreterProblem
|
|
|
|
{
|
|
|
|
EInvalidTrigger(const std::string & sym) :
|
|
|
|
EInterpreterProblem(std::string("Trigger \"") + sym + std::string("\" is invalid!"))
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2011-04-16 20:39:38 +03:00
|
|
|
struct EUsageOfUndefinedMacro : public EInterpreterProblem
|
|
|
|
{
|
|
|
|
EUsageOfUndefinedMacro(const std::string & macro) :
|
|
|
|
EInterpreterProblem(std::string("Macro ") + macro + " is undefined")
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2011-04-17 20:51:48 +03:00
|
|
|
struct EIexpProblem : public EInterpreterProblem
|
2011-04-16 20:39:38 +03:00
|
|
|
{
|
2011-04-17 20:51:48 +03:00
|
|
|
EIexpProblem(const std::string & desc) :
|
2011-04-16 20:39:38 +03:00
|
|
|
EInterpreterProblem(desc)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2011-04-21 23:06:42 +03:00
|
|
|
struct ELineProblem : public EInterpreterProblem
|
|
|
|
{
|
|
|
|
ELineProblem(const std::string & desc) :
|
|
|
|
EInterpreterProblem(desc)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2011-04-22 23:33:34 +03:00
|
|
|
struct EExecutionError : public EInterpreterProblem
|
|
|
|
{
|
|
|
|
EExecutionError(const std::string & desc) :
|
|
|
|
EInterpreterProblem(desc)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
//internal interpreter error related to execution
|
|
|
|
struct EInterpreterError : public EExecutionError
|
|
|
|
{
|
|
|
|
EInterpreterError(const std::string & desc) :
|
|
|
|
EExecutionError(desc)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
//wrong script
|
|
|
|
struct EScriptExecError : public EExecutionError
|
|
|
|
{
|
|
|
|
EScriptExecError(const std::string & desc) :
|
|
|
|
EExecutionError(desc)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2011-06-04 21:16:32 +03:00
|
|
|
//wrong script
|
|
|
|
struct EVermScriptExecError : public EScriptExecError
|
2011-04-10 19:39:34 +03:00
|
|
|
{
|
2011-06-04 21:16:32 +03:00
|
|
|
EVermScriptExecError(const std::string & desc) :
|
|
|
|
EScriptExecError(desc)
|
|
|
|
{}
|
2011-04-10 19:39:34 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// All numeric variables are integer variables and have a range of -2147483647...+2147483647
|
|
|
|
// c stores game active day number //indirect variable
|
|
|
|
// d current value //not an actual variable but a modifier
|
|
|
|
// e1..e100 Function floating point variables //local
|
|
|
|
// e-1..e-100 Trigger local floating point variables //local
|
|
|
|
// 'f'..'t' Standard variables ('quick variables') //global
|
|
|
|
// v1..v1000 Standard variables //global
|
|
|
|
// w1..w100 Hero variables
|
|
|
|
// w101..w200 Hero variables
|
|
|
|
// x1..x16 Function parameters //local
|
|
|
|
// y1..y100 Function local variables //local
|
|
|
|
// y-1..y-100 Trigger-based local integer variables //local
|
|
|
|
// z1..z1000 String variables //global
|
|
|
|
// z-1..z-10 Function local string variables //local
|
|
|
|
|
|
|
|
|
|
|
|
struct TriggerType
|
|
|
|
{
|
|
|
|
//the same order of trigger types in this enum and in validTriggers array is obligatory!
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
enum ETrigType
|
|
|
|
{
|
|
|
|
AE, BA, BF, BG, BR, CM, CO, FU, GE, GM, HE, HL, HM, IP, LE, MF, MG, MM, MR, MW, OB, PI, SN, TH, TM
|
|
|
|
};
|
|
|
|
|
|
|
|
ETrigType type;
|
|
|
|
|
2011-04-10 19:39:34 +03:00
|
|
|
static ETrigType convertTrigger(const std::string & trig)
|
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
static const std::string validTriggers[] =
|
|
|
|
{
|
|
|
|
"AE", "BA", "BF", "BG", "BR", "CM", "CO", "FU",
|
2011-04-10 19:39:34 +03:00
|
|
|
"GE", "GM", "HE", "HL", "HM", "IP", "LE", "MF", "MG", "MM", "MR", "MW", "OB", "PI", "SN",
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
"TH", "TM"
|
|
|
|
};
|
2011-04-10 19:39:34 +03:00
|
|
|
|
2023-09-25 21:26:23 +02:00
|
|
|
for(int i=0; i<std::size(validTriggers); ++i)
|
2011-04-10 19:39:34 +03:00
|
|
|
{
|
|
|
|
if(validTriggers[i] == trig)
|
|
|
|
return static_cast<ETrigType>(i);
|
|
|
|
}
|
|
|
|
throw EInvalidTrigger(trig);
|
|
|
|
}
|
|
|
|
|
2011-04-16 20:39:38 +03:00
|
|
|
bool operator<(const TriggerType & t2) const
|
|
|
|
{
|
|
|
|
return type < t2.type;
|
|
|
|
}
|
|
|
|
|
2011-04-10 19:39:34 +03:00
|
|
|
TriggerType(const std::string & sym)
|
|
|
|
{
|
|
|
|
type = convertTrigger(sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LinePointer
|
|
|
|
{
|
|
|
|
int lineNum;
|
2011-05-11 22:53:55 +03:00
|
|
|
int realLineNum;
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
int fileLength;
|
2011-05-11 22:53:55 +03:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
LinePointer()
|
|
|
|
: fileLength(-1)
|
2011-04-16 20:39:38 +03:00
|
|
|
{}
|
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
LinePointer(int _fileLength, int line, int _realLineNum)
|
|
|
|
: fileLength(_fileLength),
|
|
|
|
lineNum(line),
|
2011-05-11 22:53:55 +03:00
|
|
|
realLineNum(_realLineNum)
|
2011-04-10 19:39:34 +03:00
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator<(const LinePointer & rhs) const
|
|
|
|
{
|
|
|
|
return lineNum < rhs.lineNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const LinePointer & rhs) const
|
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
return lineNum != rhs.lineNum;
|
2011-04-10 19:39:34 +03:00
|
|
|
}
|
|
|
|
LinePointer & operator++()
|
|
|
|
{
|
|
|
|
++lineNum;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
bool isValid() const
|
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
return fileLength > 0 && lineNum < fileLength;
|
2011-04-10 19:39:34 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Trigger
|
|
|
|
{
|
|
|
|
LinePointer line;
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
Trigger()
|
2011-04-16 20:39:38 +03:00
|
|
|
{}
|
2011-04-10 19:39:34 +03:00
|
|
|
};
|
|
|
|
|
2011-05-29 21:16:49 +03:00
|
|
|
|
|
|
|
//verm goodies
|
|
|
|
struct VSymbol
|
|
|
|
{
|
|
|
|
std::string text;
|
|
|
|
VSymbol(const std::string & txt) : text(txt)
|
|
|
|
{}
|
|
|
|
};
|
2011-06-04 21:16:32 +03:00
|
|
|
|
|
|
|
struct VNode;
|
|
|
|
struct VOptionList;
|
2011-05-29 21:16:49 +03:00
|
|
|
|
|
|
|
struct VNIL
|
|
|
|
{};
|
|
|
|
|
2011-06-04 21:16:32 +03:00
|
|
|
|
2023-04-15 03:33:00 +02:00
|
|
|
typedef std::variant<char, double, int, std::string> TLiteral;
|
2011-06-04 21:16:32 +03:00
|
|
|
|
2023-04-15 03:33:00 +02:00
|
|
|
typedef std::variant<VNIL, boost::recursive_wrapper<VNode>, VSymbol, TLiteral, ERM::Tcommand> VOption; //options in v-expression, VNIl should be the default
|
2011-05-29 21:16:49 +03:00
|
|
|
|
2011-06-04 21:16:32 +03:00
|
|
|
template<typename T, typename SecType>
|
|
|
|
T& getAs(SecType & opt)
|
|
|
|
{
|
|
|
|
if(opt.type() == typeid(T))
|
2023-04-15 03:33:00 +02:00
|
|
|
return std::get<T>(opt);
|
2011-06-04 21:16:32 +03:00
|
|
|
else
|
|
|
|
throw EVermScriptExecError("Wrong type!");
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T, typename SecType>
|
2011-06-10 15:49:31 +03:00
|
|
|
bool isA(const SecType & opt)
|
2011-06-04 21:16:32 +03:00
|
|
|
{
|
|
|
|
if(opt.type() == typeid(T))
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-05-29 21:16:49 +03:00
|
|
|
struct VermTreeIterator
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
friend struct VOptionList;
|
2011-06-11 21:10:15 +03:00
|
|
|
VOptionList * parent;
|
|
|
|
enum Estate {NORM, CAR} state;
|
2011-06-04 21:16:32 +03:00
|
|
|
int basePos; //car/cdr offset
|
2011-05-29 21:16:49 +03:00
|
|
|
public:
|
2011-06-15 04:36:36 +03:00
|
|
|
VermTreeIterator(VOptionList & _parent) : parent(&_parent), state(NORM), basePos(0)
|
2011-06-11 21:10:15 +03:00
|
|
|
{}
|
2013-06-26 17:25:23 +03:00
|
|
|
VermTreeIterator() : parent(nullptr), state(NORM)
|
2011-05-29 21:16:49 +03:00
|
|
|
{}
|
|
|
|
|
|
|
|
VermTreeIterator & operator=(const VOption & opt);
|
|
|
|
VermTreeIterator & operator=(const std::vector<VOption> & opt);
|
|
|
|
VermTreeIterator & operator=(const VOptionList & opt);
|
2011-06-04 21:16:32 +03:00
|
|
|
VOption & getAsItem();
|
2011-06-11 21:10:15 +03:00
|
|
|
VOptionList getAsList();
|
2011-06-04 21:16:32 +03:00
|
|
|
size_t size() const;
|
2011-06-11 21:10:15 +03:00
|
|
|
|
|
|
|
VermTreeIterator& operator=(const VermTreeIterator & rhs)
|
|
|
|
{
|
|
|
|
if(this == &rhs)
|
|
|
|
{
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
parent = rhs.parent;
|
|
|
|
state = rhs.state;
|
|
|
|
basePos = rhs.basePos;
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
2011-05-29 21:16:49 +03:00
|
|
|
};
|
|
|
|
|
2011-06-04 21:16:32 +03:00
|
|
|
struct VOptionList : public std::vector<VOption>
|
2011-05-29 21:16:49 +03:00
|
|
|
{
|
2011-06-04 21:16:32 +03:00
|
|
|
private:
|
|
|
|
friend struct VermTreeIterator;
|
|
|
|
public:
|
|
|
|
VermTreeIterator car();
|
|
|
|
VermTreeIterator cdr();
|
2011-06-11 21:10:15 +03:00
|
|
|
};
|
|
|
|
|
2011-05-29 21:16:49 +03:00
|
|
|
struct VNode
|
|
|
|
{
|
|
|
|
private:
|
2011-06-18 21:24:56 +03:00
|
|
|
void processModifierList(const std::vector<TVModifier> & modifierList, bool asSymbol);
|
2011-05-29 21:16:49 +03:00
|
|
|
public:
|
|
|
|
VOptionList children;
|
|
|
|
VNode( const ERM::TVExp & exp);
|
|
|
|
VNode( const VOptionList & cdren );
|
|
|
|
VNode( const ERM::TSymbol & sym ); //only in case sym has modifiers!
|
|
|
|
VNode( const VOption & first, const VOptionList & rest); //merges given arguments into [a, rest];
|
|
|
|
void setVnode( const VOption & first, const VOptionList & rest);
|
|
|
|
};
|
2011-04-10 19:39:34 +03:00
|
|
|
}
|
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
class ERMInterpreter
|
2011-04-06 23:30:59 +03:00
|
|
|
{
|
2011-05-16 15:11:00 +03:00
|
|
|
/*not so*/ public:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
|
2011-04-10 19:39:34 +03:00
|
|
|
std::map<VERMInterpreter::LinePointer, ERM::TLine> scripts;
|
|
|
|
|
2011-04-21 23:06:42 +03:00
|
|
|
typedef std::map<VERMInterpreter::TriggerType, std::vector<VERMInterpreter::Trigger> > TtriggerListType;
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
TtriggerListType triggers;
|
|
|
|
TtriggerListType postTriggers;
|
|
|
|
std::vector<VERMInterpreter::LinePointer> instructions;
|
|
|
|
|
2011-04-10 19:39:34 +03:00
|
|
|
static bool isCMDATrigger(const ERM::Tcommand & cmd);
|
|
|
|
static bool isATrigger(const ERM::TLine & line);
|
|
|
|
static ERM::EVOtions getExpType(const ERM::TVOption & opt);
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
ERM::TLine & retrieveLine(const VERMInterpreter::LinePointer & linePtr);
|
|
|
|
static ERM::TTriggerBase & retrieveTrigger(ERM::TLine & line);
|
2011-04-06 23:30:59 +03:00
|
|
|
public:
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
vstd::CLoggerBase * logger;
|
|
|
|
|
|
|
|
ERMInterpreter(vstd::CLoggerBase * logger_);
|
|
|
|
virtual ~ERMInterpreter();
|
2011-06-20 14:41:04 +03:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
std::string loadScript(const std::string & name, const std::string & source);
|
2011-04-11 01:06:05 +03:00
|
|
|
};
|