add "text," command so that elements can look up their text

This commit is contained in:
Chris Danford
2005-07-14 20:13:14 +00:00
parent 30598db3bf
commit 015e72253b
2 changed files with 15 additions and 2 deletions
+13 -1
View File
@@ -31,6 +31,7 @@
void GameCommand::Init()
{
m_sName = "";
m_sText = "";
m_bInvalid = true;
m_iIndex = -1;
m_pGame = NULL;
@@ -214,6 +215,11 @@ void GameCommand::LoadOne( const Command& cmd )
m_sName = sValue;
}
else if( sName == "text" )
{
m_sText = sValue;
}
else if( sName == "mod" )
{
if( m_sModifiers != "" )
@@ -1104,10 +1110,16 @@ class LunaGameCommand: public Luna<GameCommand>
public:
LunaGameCommand() { LUA->Register( Register ); }
static int GetProfileID( T* p, lua_State *L ) { lua_pushstring(L, p->m_sProfileID ); return 1; }
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 void Register(lua_State *L)
{
ADD_METHOD( GetName )
ADD_METHOD( GetText )
ADD_METHOD( GetIndex )
ADD_METHOD( GetProfileID )
Luna<T>::Register( L );
+2 -1
View File
@@ -44,7 +44,8 @@ public:
// so that we know the order of commands when it comes time to Apply.
Commands m_Commands;
CString m_sName; // display name
CString m_sName; // choice name
CString m_sText; // display text
bool m_bInvalid;
CString m_sInvalidReason;
int m_iIndex;