📄 scriptengine.h
字号:
/*
* name: ScriptEngine.h
*
* desc: 脚本引擎
*
*/
#pragma once
#include "StdAfx.h"
class CScriptEngine
{/*
typedef DWORD (*SCRIPT_COMMAND_PROC) ( CGameMir&, CScriptEngine&, boost::wsmatch&, bool&);
typedef std::pair<boost::wregex,SCRIPT_COMMAND_PROC> sScriptCommand;
typedef std::vector<sScriptCommand> CommandList;
typedef bool (*SCRIPT_CONDITION_PROC)( CGameMir&, CScriptEngine&, boost::wsmatch& );
typedef std::pair<boost::wregex,SCRIPT_CONDITION_PROC> sScriptCondition;
typedef std::vector<sScriptCondition> ConditionList;
typedef std::pair<std::wstring,std::wstring> sScriptLine;
typedef std::vector<sScriptLine> sScript;
public://函数
CScriptEngine( CGameMir& );
~CScriptEngine( );
bool LoadFile( std::string strFileName );
void RegisterCommand( std::wstring, SCRIPT_COMMAND_PROC );
void RegisterCondition( std::wstring, SCRIPT_CONDITION_PROC );
bool Step( );
bool Jump( int line );
bool Jump( std::wstring label );
void Run( bool threadmode );
void Stop( ); // add by zdl. 2007-10-11
bool isRunning() const
{
return this->bRunning_;
}
private: //函数
//bool If(boost::smatch& m);
bool __do_If(std::wstring strCond, bool& ret)
{
boost::wsmatch m;
for(ConditionList::iterator cond=m_Conditions.begin();cond!=m_Conditions.end();cond++)
{
if (regex_match(strCond, m, cond->first))
{
ret = cond->second(m_Game,*this,m);
return true;
}
}
return false;
}
private://变量
sScript m_Scripts;
sScript::iterator m_ip;
CGameMir& m_Game;
bool m_LastResult;
CommandList m_Commands;
ConditionList m_Conditions;
static UINT ScriptRunThread( LPVOID pParam );
boost::wregex m_RegexIf;
boost::wregex m_RegexThen;
CRITICAL_SECTION m_RunSC;
private:
// add by zdl. 2007-10-11
bool bNotifyStop_;
bool bRunning_;
bool bThreadMode_;
CWinThread *pThread_;
// end of add
*/
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -