add "text," command so that elements can look up their text
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
void GameCommand::Init()
|
void GameCommand::Init()
|
||||||
{
|
{
|
||||||
m_sName = "";
|
m_sName = "";
|
||||||
|
m_sText = "";
|
||||||
m_bInvalid = true;
|
m_bInvalid = true;
|
||||||
m_iIndex = -1;
|
m_iIndex = -1;
|
||||||
m_pGame = NULL;
|
m_pGame = NULL;
|
||||||
@@ -214,6 +215,11 @@ void GameCommand::LoadOne( const Command& cmd )
|
|||||||
m_sName = sValue;
|
m_sName = sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if( sName == "text" )
|
||||||
|
{
|
||||||
|
m_sText = sValue;
|
||||||
|
}
|
||||||
|
|
||||||
else if( sName == "mod" )
|
else if( sName == "mod" )
|
||||||
{
|
{
|
||||||
if( m_sModifiers != "" )
|
if( m_sModifiers != "" )
|
||||||
@@ -1104,10 +1110,16 @@ class LunaGameCommand: public Luna<GameCommand>
|
|||||||
public:
|
public:
|
||||||
LunaGameCommand() { LUA->Register( Register ); }
|
LunaGameCommand() { LUA->Register( Register ); }
|
||||||
|
|
||||||
|
static int GetName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sName ); return 1; }
|
||||||
|
static int GetText( T* p, lua_State *L ) { lua_pushstring(L, p->m_sText ); return 1; }
|
||||||
|
static int GetIndex( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iIndex ); return 1; }
|
||||||
static int GetProfileID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sProfileID ); return 1; }
|
static int GetProfileID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sProfileID ); return 1; }
|
||||||
|
|
||||||
static void Register(lua_State *L)
|
static void Register(lua_State *L)
|
||||||
{
|
{
|
||||||
|
ADD_METHOD( GetName )
|
||||||
|
ADD_METHOD( GetText )
|
||||||
|
ADD_METHOD( GetIndex )
|
||||||
ADD_METHOD( GetProfileID )
|
ADD_METHOD( GetProfileID )
|
||||||
|
|
||||||
Luna<T>::Register( L );
|
Luna<T>::Register( L );
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ public:
|
|||||||
// so that we know the order of commands when it comes time to Apply.
|
// so that we know the order of commands when it comes time to Apply.
|
||||||
Commands m_Commands;
|
Commands m_Commands;
|
||||||
|
|
||||||
CString m_sName; // display name
|
CString m_sName; // choice name
|
||||||
|
CString m_sText; // display text
|
||||||
bool m_bInvalid;
|
bool m_bInvalid;
|
||||||
CString m_sInvalidReason;
|
CString m_sInvalidReason;
|
||||||
int m_iIndex;
|
int m_iIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user