cleanup, pass pn to lua function
This commit is contained in:
@@ -39,7 +39,7 @@ void GameCommand::Init()
|
|||||||
m_sModifiers = "";
|
m_sModifiers = "";
|
||||||
m_sAnnouncer = "";
|
m_sAnnouncer = "";
|
||||||
m_sScreen = "";
|
m_sScreen = "";
|
||||||
m_sLuaFunction = "";
|
m_LuaFunction.Unset();
|
||||||
m_pSong = NULL;
|
m_pSong = NULL;
|
||||||
m_pSteps = NULL;
|
m_pSteps = NULL;
|
||||||
m_pCourse = NULL;
|
m_pCourse = NULL;
|
||||||
@@ -213,7 +213,7 @@ void GameCommand::Load( int iIndex, const Commands& cmds )
|
|||||||
|
|
||||||
else if( sName == "lua" )
|
else if( sName == "lua" )
|
||||||
{
|
{
|
||||||
m_sLuaFunction = sValue;
|
m_LuaFunction.SetFromExpression( sValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sName == "screen" )
|
else if( sName == "screen" )
|
||||||
@@ -628,8 +628,17 @@ 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 != "" )
|
if( m_LuaFunction.IsSet() )
|
||||||
LUA->RunScript( m_sLuaFunction, "in", 0 );
|
{
|
||||||
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
|
{
|
||||||
|
m_LuaFunction.PushSelf( LUA->L );
|
||||||
|
ASSERT( !lua_isnil(LUA->L, -1) );
|
||||||
|
|
||||||
|
lua_pushnumber( LUA->L, *pn ); // 1st parameter
|
||||||
|
lua_call( LUA->L, 1, 0 ); // call function with 1 argument and 0 results
|
||||||
|
}
|
||||||
|
}
|
||||||
if( m_sScreen != "" )
|
if( m_sScreen != "" )
|
||||||
SCREENMAN->SetNewScreen( m_sScreen );
|
SCREENMAN->SetNewScreen( m_sScreen );
|
||||||
if( m_pSong )
|
if( m_pSong )
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "Difficulty.h"
|
#include "Difficulty.h"
|
||||||
|
#include "LuaReference.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class Song;
|
class Song;
|
||||||
@@ -47,7 +48,7 @@ public:
|
|||||||
CString m_sAnnouncer;
|
CString m_sAnnouncer;
|
||||||
CString m_sModifiers;
|
CString m_sModifiers;
|
||||||
CString m_sScreen;
|
CString m_sScreen;
|
||||||
CString m_sLuaFunction;
|
LuaExpression m_LuaFunction;
|
||||||
Song* m_pSong;
|
Song* m_pSong;
|
||||||
Steps* m_pSteps;
|
Steps* m_pSteps;
|
||||||
Course* m_pCourse;
|
Course* m_pCourse;
|
||||||
|
|||||||
Reference in New Issue
Block a user