From 3478bc7650109f75866f01c4c834d15def90e8a9 Mon Sep 17 00:00:00 2001 From: sigatrev Date: Sat, 2 Aug 2014 18:09:52 -0500 Subject: [PATCH] added GetStylesForGame method --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 3 +++ src/GameManager.cpp | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index f6526dcfed..a06025a9f1 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -726,6 +726,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 69bd04a75e..0f9b57048b 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2189,6 +2189,9 @@ save yourself some time, copy this for undocumented things: Returns a table of all selectable games. + + Returns a table of all the styles for the that exist for game. + Sets the current game to Game. The second argument is optional, and if provided will determine which theme is loaded when the game changes. If the second argument is not provided, the default theme from the preferences for the new game type will be loaded.
If only the game changes, the screen specified by the Common::AfterGameChangeScreen metric will be loaded.
diff --git a/src/GameManager.cpp b/src/GameManager.cpp index 9006119391..65a65e9da4 100644 --- a/src/GameManager.cpp +++ b/src/GameManager.cpp @@ -3160,10 +3160,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 aStyles; + for( int s=0; pGame->m_apStyles[s]; ++s ) + { + Style *pStyle = const_cast