allow calling Lua from GameCommand

This commit is contained in:
Glenn Maynard
2005-02-22 01:50:44 +00:00
parent baf8ef940e
commit efeabffb8e
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -39,6 +39,7 @@ void GameCommand::Init()
m_sModifiers = ""; m_sModifiers = "";
m_sAnnouncer = ""; m_sAnnouncer = "";
m_sScreen = ""; m_sScreen = "";
m_sLuaFunction = "";
m_pSong = NULL; m_pSong = NULL;
m_pSteps = NULL; m_pSteps = NULL;
m_pCourse = NULL; m_pCourse = NULL;
@@ -210,6 +211,11 @@ void GameCommand::Load( int iIndex, const Commands& cmds )
m_sModifiers += sValue; m_sModifiers += sValue;
} }
else if( sName == "lua" )
{
m_sLuaFunction = sValue;
}
else if( sName == "screen" ) else if( sName == "screen" )
{ {
m_sScreen = sValue; m_sScreen = sValue;
@@ -622,6 +628,8 @@ void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const
if( m_sModifiers != "" ) if( m_sModifiers != "" )
FOREACH_CONST( PlayerNumber, vpns, pn ) FOREACH_CONST( PlayerNumber, vpns, pn )
GAMESTATE->ApplyModifiers( *pn, m_sModifiers ); GAMESTATE->ApplyModifiers( *pn, m_sModifiers );
if( m_sLuaFunction != "" )
LUA->RunScript( m_sLuaFunction, "in", 0 );
if( m_sScreen != "" ) if( m_sScreen != "" )
SCREENMAN->SetNewScreen( m_sScreen ); SCREENMAN->SetNewScreen( m_sScreen );
if( m_pSong ) if( m_pSong )
+1
View File
@@ -47,6 +47,7 @@ public:
CString m_sAnnouncer; CString m_sAnnouncer;
CString m_sModifiers; CString m_sModifiers;
CString m_sScreen; CString m_sScreen;
CString m_sLuaFunction;
Song* m_pSong; Song* m_pSong;
Steps* m_pSteps; Steps* m_pSteps;
Course* m_pCourse; Course* m_pCourse;