allow Lua expressions in ActorCommand parameters
This commit is contained in:
@@ -624,7 +624,7 @@ void Actor::Command( CString sCommands )
|
||||
sCommands.MakeLower();
|
||||
|
||||
vector<ParsedCommand> vCommands;
|
||||
ParseCommands( sCommands, vCommands );
|
||||
ParseCommands( sCommands, vCommands );
|
||||
|
||||
for( unsigned i=0; i<vCommands.size(); i++ )
|
||||
this->HandleCommand( vCommands[i] );
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "LuaHelpers.h"
|
||||
|
||||
|
||||
void IncorrectActorParametersWarning( const ParsedCommand &command, int iMaxIndexAccessed )
|
||||
{
|
||||
@@ -12,13 +14,11 @@ void IncorrectActorParametersWarning( const ParsedCommand &command, int iMaxInde
|
||||
Dialog::OK( sError );
|
||||
}
|
||||
|
||||
void ParsedCommandToken::Set( const CString &sToken )
|
||||
void ParsedCommandToken::Set( const CString &sParam )
|
||||
{
|
||||
s = sToken;
|
||||
f = strtof( sToken, NULL );
|
||||
i = atoi( sToken );
|
||||
b = i != 0;
|
||||
bColorIsValid = c.FromString( sToken );
|
||||
s = sParam;
|
||||
f = Lua::RunExpressionF( sParam );
|
||||
bColorIsValid = c.FromString( sParam );
|
||||
}
|
||||
|
||||
void ParsedCommand::Set( const CString &sCommand )
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
|
||||
struct ParsedCommandToken
|
||||
{
|
||||
void Set( const CString &sToken ); // fill in all the different types
|
||||
void Set( const CString &sParam ); // fill in all the different types
|
||||
|
||||
CString s;
|
||||
float f;
|
||||
int i;
|
||||
bool b;
|
||||
RageColor c; // HTML-type color which is packed into one parameter
|
||||
bool bColorIsValid; // true if c is a valid HTML-type color
|
||||
// true if c is a valid HTML-type color. Otherwise, this value is the red component
|
||||
// and the next 3 params are the other components.
|
||||
bool bColorIsValid;
|
||||
|
||||
operator const CString () const { return s; };
|
||||
operator const float () const { return f; };
|
||||
operator const int () const { return i; };
|
||||
operator const bool () const { return b; };
|
||||
operator const int () const { return (int)f; };
|
||||
operator const bool () const { return ((int)f)!=0; };
|
||||
operator const RageColor () const { return c; };
|
||||
};
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ void ScreenSystemLayer::ReloadCreditsText()
|
||||
m_textMessage.SetName( "Message" );
|
||||
SET_XY_AND_ON_COMMAND( m_textMessage );
|
||||
|
||||
m_textStats.LoadFromFont( THEME->GetPathToF("ScreenSystemLayer stats") );
|
||||
m_textStats.LoadFromFont( THEME->GetPathToF("ScreenSystemLayer stats") );
|
||||
m_textStats.SetName( "Stats" );
|
||||
SET_XY_AND_ON_COMMAND( m_textStats );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user