This commit is contained in:
Jonathan Payne
2014-08-05 15:43:57 -07:00
12 changed files with 161 additions and 26 deletions
+20 -3
View File
@@ -3159,12 +3159,28 @@ public:
return 1;
}
static int GetStylesForGame( T* p, lua_State *L )
{
RString game_name= SArg(1);
const Game *pGame = p->StringToGame(game_name);
if(!pGame)
{
luaL_error(L, "GetStylesForGame: Invalid Game: '%s'", game_name.c_str());
}
vector<Style*> aStyles;
lua_createtable(L, 0, 0);
for( int s=0; pGame->m_apStyles[s]; ++s )
{
Style *pStyle = const_cast<Style *>( pGame->m_apStyles[s] );
pStyle->PushSelf(L);
lua_rawseti(L, -2, s+1);
}
return 1;
}
static int GetEnabledGames( T* p, lua_State *L )
{
vector<const Game*> aGames;
GAMEMAN->GetEnabledGames( aGames );
p->GetEnabledGames( aGames );
vector<RString> vsGames;
FOREACH( const Game*, aGames, g )
{
@@ -3201,6 +3217,7 @@ public:
ADD_METHOD( StepsTypeToLocalizedString );
ADD_METHOD( GetFirstStepsTypeForGame );
ADD_METHOD( IsGameEnabled );
ADD_METHOD( GetStylesForGame );
ADD_METHOD( GetEnabledGames );
ADD_METHOD( SetGame );
};