mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	- updated ERM library to c++11
This commit is contained in:
		| @@ -464,8 +464,8 @@ void ERMInterpreter::scanScripts() | ||||
| ERMInterpreter::ERMInterpreter() | ||||
| { | ||||
| 	erm = this; | ||||
| 	curFunc = NULL; | ||||
| 	curTrigger = NULL; | ||||
| 	curFunc = nullptr; | ||||
| 	curTrigger = nullptr; | ||||
| 	globalEnv = new Environment(); | ||||
| 	topDyn = globalEnv; | ||||
| } | ||||
| @@ -496,7 +496,7 @@ void ERMInterpreter::executeTrigger( VERMInterpreter::Trigger & trig, int funNum | ||||
| 		executeLine(lp); | ||||
| 	} | ||||
|  | ||||
| 	curFunc = NULL; | ||||
| 	curFunc = nullptr; | ||||
| } | ||||
|  | ||||
| bool ERMInterpreter::isATrigger( const ERM::TLine & line ) | ||||
| @@ -686,8 +686,8 @@ struct HE_BPerformer : StandardBodyOptionItemVisitor<HEPerformer> | ||||
| 	{} | ||||
| 	using StandardBodyOptionItemVisitor<HEPerformer>::operator(); | ||||
|  | ||||
| 	void operator()(TIexp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TVarpExp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TIexp const& cmp) const override; | ||||
| 	void operator()(TVarpExp const& cmp) const override; | ||||
| }; | ||||
|  | ||||
| template<int opcode> | ||||
| @@ -703,8 +703,8 @@ struct HE_CPerformer : StandardBodyOptionItemVisitor<HEPerformer> | ||||
| 	{} | ||||
| 	using StandardBodyOptionItemVisitor<HEPerformer>::operator(); | ||||
|  | ||||
| 	void operator()(TIexp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TVarpExp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TIexp const& cmp) const override; | ||||
| 	void operator()(TVarpExp const& cmp) const override; | ||||
| }; | ||||
|  | ||||
| template<int opcode> | ||||
| @@ -719,7 +719,7 @@ struct HEPerformer : StandardReceiverVisitor<const CGHeroInstance *> | ||||
| 	{} | ||||
| 	using StandardReceiverVisitor<const CGHeroInstance *>::operator(); | ||||
|  | ||||
| 	void operator()(TNormalBodyOption const& trig) const OVERRIDE | ||||
| 	void operator()(TNormalBodyOption const& trig) const override | ||||
| 	{ | ||||
| 		switch(trig.optionCode) | ||||
| 		{ | ||||
| @@ -780,7 +780,7 @@ struct IF_MPerformer : StandardBodyOptionItemVisitor<IFPerformer> | ||||
| 	explicit IF_MPerformer(IFPerformer & _owner) : StandardBodyOptionItemVisitor<IFPerformer>(_owner){} | ||||
| 	using StandardBodyOptionItemVisitor<IFPerformer>::operator(); | ||||
|  | ||||
| 	void operator()(TStringConstant const& cmp) const OVERRIDE; | ||||
| 	void operator()(TStringConstant const& cmp) const override; | ||||
| }; | ||||
|  | ||||
|  | ||||
| @@ -802,7 +802,7 @@ struct StringFormatter | ||||
| { | ||||
| 	int pos; | ||||
| 	int tokenLength; | ||||
| 	int percentPos; | ||||
| 	size_t percentPos; | ||||
| 	int charsToReplace; | ||||
| 	std::string &msg; | ||||
|  | ||||
| @@ -821,7 +821,7 @@ struct StringFormatter | ||||
| 	{ | ||||
| 		int toAdd = 0; | ||||
| 		int numStart = percentPos + 2; | ||||
| 		int numEnd = msg.find_first_not_of("1234567890", numStart); | ||||
| 		size_t numEnd = msg.find_first_not_of("1234567890", numStart); | ||||
|  | ||||
| 		if(numEnd == std::string::npos) | ||||
| 			toAdd = msg.size() - numStart; | ||||
| @@ -887,7 +887,7 @@ struct IFPerformer : StandardReceiverVisitor<TUnusedType> | ||||
| 	using StandardReceiverVisitor<TUnusedType>::operator(); | ||||
|  | ||||
|  | ||||
| 	void operator()(TNormalBodyOption const& trig) const OVERRIDE | ||||
| 	void operator()(TNormalBodyOption const& trig) const override | ||||
| 	{ | ||||
| 		std::string message; //to be shown | ||||
| 		switch(trig.optionCode) | ||||
| @@ -932,8 +932,8 @@ struct MA_PPerformer : StandardBodyOptionItemVisitor<MAPerformer> | ||||
| 	explicit MA_PPerformer(MAPerformer & _owner); | ||||
| 	using StandardBodyOptionItemVisitor<MAPerformer>::operator(); | ||||
|  | ||||
| 	void operator()(TIexp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TVarpExp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TIexp const& cmp) const override; | ||||
| 	void operator()(TVarpExp const& cmp) const override; | ||||
| }; | ||||
|  | ||||
| struct MAPerformer : StandardReceiverVisitor<TUnusedType> | ||||
| @@ -942,7 +942,7 @@ struct MAPerformer : StandardReceiverVisitor<TUnusedType> | ||||
| 	{} | ||||
| 	using StandardReceiverVisitor<TUnusedType>::operator(); | ||||
|  | ||||
| 	void operator()(TNormalBodyOption const& trig) const OVERRIDE | ||||
| 	void operator()(TNormalBodyOption const& trig) const override | ||||
| 	{ | ||||
| 		switch(trig.optionCode) | ||||
| 		{ | ||||
| @@ -981,8 +981,8 @@ struct MO_GPerformer : StandardBodyOptionItemVisitor<MOPerformer> | ||||
| 	{} | ||||
| 	using StandardBodyOptionItemVisitor<MOPerformer>::operator(); | ||||
|  | ||||
| 	void operator()(TVarpExp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TIexp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TVarpExp const& cmp) const override; | ||||
| 	void operator()(TIexp const& cmp) const override; | ||||
| }; | ||||
|  | ||||
| struct MOPerformer: StandardReceiverVisitor<int3> | ||||
| @@ -991,7 +991,7 @@ struct MOPerformer: StandardReceiverVisitor<int3> | ||||
| 	{} | ||||
| 	using StandardReceiverVisitor<int3>::operator(); | ||||
|  | ||||
| 	void operator()(TNormalBodyOption const& trig) const OVERRIDE | ||||
| 	void operator()(TNormalBodyOption const& trig) const override | ||||
| 	{ | ||||
| 		switch(trig.optionCode) | ||||
| 		{ | ||||
| @@ -1116,8 +1116,8 @@ struct VR_SPerformer : StandardBodyOptionItemVisitor<VRPerformer> | ||||
| 	explicit VR_SPerformer(VRPerformer & _owner); | ||||
| 	using StandardBodyOptionItemVisitor<VRPerformer>::operator(); | ||||
|  | ||||
| 	void operator()(TStringConstant const& cmp) const OVERRIDE; | ||||
| 	void operator()(TIexp const& cmp) const OVERRIDE; | ||||
| 	void operator()(TStringConstant const& cmp) const override; | ||||
| 	void operator()(TIexp const& cmp) const override; | ||||
| }; | ||||
|  | ||||
| struct VRPerformer : StandardReceiverVisitor<IexpValStr> | ||||
| @@ -1125,7 +1125,7 @@ struct VRPerformer : StandardReceiverVisitor<IexpValStr> | ||||
| 	VRPerformer(ERMInterpreter * _interpr, IexpValStr ident) : StandardReceiverVisitor<IexpValStr>(_interpr, ident) | ||||
| 	{} | ||||
|  | ||||
| 	void operator()(TVRLogic const& trig) const OVERRIDE | ||||
| 	void operator()(TVRLogic const& trig) const override | ||||
| 	{ | ||||
| 		int valr = interp->getIexp(trig.var).getInt(); | ||||
| 		switch (trig.opcode) | ||||
| @@ -1144,7 +1144,7 @@ struct VRPerformer : StandardReceiverVisitor<IexpValStr> | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| 	void operator()(TVRArithmetic const& trig) const OVERRIDE | ||||
| 	void operator()(TVRArithmetic const& trig) const override | ||||
| 	{ | ||||
| 		IexpValStr rhs = interp->getIexp(trig.rhs); | ||||
| 		switch (trig.opcode) | ||||
| @@ -1169,7 +1169,7 @@ struct VRPerformer : StandardReceiverVisitor<IexpValStr> | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| 	void operator()(TNormalBodyOption const& trig) const OVERRIDE | ||||
| 	void operator()(TNormalBodyOption const& trig) const override | ||||
| 	{ | ||||
| 		switch(trig.optionCode) | ||||
| 		{ | ||||
| @@ -1380,7 +1380,7 @@ struct ERMExpDispatch : boost::static_visitor<> | ||||
| 		} | ||||
| 		else if(trig.name == "HE") | ||||
| 		{ | ||||
| 			const CGHeroInstance * hero = NULL; | ||||
| 			const CGHeroInstance * hero = nullptr; | ||||
| 			if(trig.identifier.is_initialized()) | ||||
| 			{ | ||||
| 				ERM::Tidentifier tid = trig.identifier.get(); | ||||
| @@ -1754,11 +1754,11 @@ struct LVL3BodyOptionItemVisitor : StandardBodyOptionItemVisitor<IexpValStr> | ||||
| 	{} | ||||
| 	using StandardBodyOptionItemVisitor<IexpValStr>::operator(); | ||||
|  | ||||
| 	void operator()(TIexp const& cmp) const OVERRIDE | ||||
| 	void operator()(TIexp const& cmp) const override | ||||
| 	{ | ||||
| 		owner = erm->getIexp(cmp); | ||||
| 	} | ||||
| 	void operator()(TVarpExp const& cmp) const OVERRIDE | ||||
| 	void operator()(TVarpExp const& cmp) const override | ||||
| 	{ | ||||
| 		owner = erm->getIexp(cmp); | ||||
| 	} | ||||
| @@ -2717,7 +2717,7 @@ struct VEvaluator : boost::static_visitor<VOption> | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| VOption ERMInterpreter::eval( VOption line, Environment * env /*= NULL*/ ) | ||||
| VOption ERMInterpreter::eval( VOption line, Environment * env /*= nullptr*/ ) | ||||
| { | ||||
| // 	if(line.children.isNil()) | ||||
| // 		return; | ||||
| @@ -2729,7 +2729,7 @@ VOption ERMInterpreter::eval( VOption line, Environment * env /*= NULL*/ ) | ||||
|  | ||||
| } | ||||
|  | ||||
| VOptionList ERMInterpreter::evalEach( VermTreeIterator list, Environment * env /*= NULL*/ ) | ||||
| VOptionList ERMInterpreter::evalEach( VermTreeIterator list, Environment * env /*= nullptr*/ ) | ||||
| { | ||||
| 	VOptionList ret; | ||||
| 	for(int g=0; g<list.size(); ++g) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ namespace VERMInterpreter | ||||
| 	{ | ||||
| 		std::string problem; | ||||
| 	public: | ||||
| 		const char * what() const throw() OVERRIDE | ||||
| 		const char * what() const throw() override | ||||
| 		{ | ||||
| 			return problem.c_str(); | ||||
| 		} | ||||
| @@ -216,7 +216,7 @@ namespace VERMInterpreter | ||||
|  | ||||
| 		int realLineNum; | ||||
|  | ||||
| 		LinePointer() : file(NULL) | ||||
| 		LinePointer() : file(nullptr) | ||||
| 		{} | ||||
|  | ||||
| 		LinePointer(const FileInfo * finfo, int line, int _realLineNum) : file(finfo), lineNum(line), | ||||
| @@ -281,7 +281,7 @@ namespace VERMInterpreter | ||||
| 		LinePointer line; | ||||
| 		TriggerLocalVars ermLocalVars; | ||||
| 		Stack * stack; //where we are stuck at execution | ||||
| 		Trigger() : stack(NULL) | ||||
| 		Trigger() : stack(nullptr) | ||||
| 		{} | ||||
| 	}; | ||||
|  | ||||
| @@ -468,7 +468,7 @@ namespace VERMInterpreter | ||||
| 		Environment * parent; | ||||
|  | ||||
| 	public: | ||||
| 		Environment() : parent(NULL) | ||||
| 		Environment() : parent(nullptr) | ||||
| 		{} | ||||
| 		void setPatent(Environment * _parent); | ||||
| 		Environment * getPatent() const; | ||||
| @@ -503,7 +503,7 @@ namespace VERMInterpreter | ||||
| 	public: | ||||
| 		VermTreeIterator(VOptionList & _parent) : parent(&_parent), state(NORM), basePos(0) | ||||
| 		{} | ||||
| 		VermTreeIterator() : parent(NULL), state(NORM) | ||||
| 		VermTreeIterator() : parent(nullptr), state(NORM) | ||||
| 		{} | ||||
|  | ||||
| 		VermTreeIterator & operator=(const VOption & opt); | ||||
| @@ -818,8 +818,8 @@ class ERMInterpreter : public CScriptingModule | ||||
|  | ||||
| 	std::string processERMString(std::string ermstring); | ||||
|  | ||||
| 	VERMInterpreter::VOption eval( VERMInterpreter::VOption line, VERMInterpreter::Environment * env = NULL ); | ||||
| 	VERMInterpreter::VOptionList evalEach( VERMInterpreter::VermTreeIterator list, VERMInterpreter::Environment * env = NULL );  | ||||
| 	VERMInterpreter::VOption eval( VERMInterpreter::VOption line, VERMInterpreter::Environment * env = nullptr ); | ||||
| 	VERMInterpreter::VOptionList evalEach( VERMInterpreter::VermTreeIterator list, VERMInterpreter::Environment * env = nullptr ); | ||||
|  | ||||
| public: | ||||
| 	typedef std::map< int, std::vector<int> > TIDPattern; | ||||
| @@ -839,13 +839,13 @@ public: | ||||
| 	int getRealLine(const VERMInterpreter::LinePointer &lp); | ||||
|  | ||||
| 	//overload CScriptingModule | ||||
| 	virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start) OVERRIDE; | ||||
| 	virtual void init() OVERRIDE;//sets up environment etc. | ||||
| 	virtual void executeUserCommand(const std::string &cmd) OVERRIDE; | ||||
| 	virtual void giveInfoCB(CPrivilagedInfoCallback *cb) OVERRIDE; | ||||
| 	virtual void giveActionCB(IGameEventRealizer *cb) OVERRIDE; | ||||
| 	virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start) override; | ||||
| 	virtual void init() override;//sets up environment etc. | ||||
| 	virtual void executeUserCommand(const std::string &cmd) override; | ||||
| 	virtual void giveInfoCB(CPrivilagedInfoCallback *cb) override; | ||||
| 	virtual void giveActionCB(IGameEventRealizer *cb) override; | ||||
|  | ||||
| 	virtual void battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side) OVERRIDE; | ||||
| 	virtual void battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side) override; | ||||
|  | ||||
| 	const CGObjectInstance *getObjFrom(int3 pos); | ||||
| 	template <typename T> | ||||
|   | ||||
| @@ -1,10 +1,6 @@ | ||||
| #include "StdInc.h" | ||||
| #include "ERMParser.h" | ||||
|  | ||||
| //To make compilation with older boost versions possible | ||||
| //Don't know exact version - 1.46 works while 1.42 not | ||||
| #if BOOST_VERSION >= 104600 | ||||
|  | ||||
| /* | ||||
|  * ERMParser.cpp, part of VCMI engine | ||||
|  * | ||||
| @@ -67,7 +63,7 @@ std::string CERMPreprocessor::retreiveCommandLine() | ||||
| 		getline(line); //reading line | ||||
|  | ||||
|  | ||||
| 		int dash = line.find_first_of('^'); | ||||
| 		size_t dash = line.find_first_of('^'); | ||||
| 		bool inTheMiddle = openedBraces || openedString; | ||||
|  | ||||
| 		if(!inTheMiddle) | ||||
| @@ -547,10 +543,4 @@ void ERMParser::repairEncoding( char * str, int len ) const | ||||
| 	for(int g=0; g<len; ++g) | ||||
| 		if(str[g] & 0x80) | ||||
| 			str[g] = '|'; | ||||
| } | ||||
| #else | ||||
|  | ||||
| ERMParser::ERMParser(std::string file){} | ||||
| std::vector<LineInfo> ERMParser::parseFile() {std::vector<LineInfo> dummy; return dummy;} //compile fix | ||||
|  | ||||
| #endif | ||||
| } | ||||
		Reference in New Issue
	
	Block a user