Changed GetStylesForGame to not traverse the list of styles twice.

This commit is contained in:
Kyzentun
2014-08-02 19:34:39 -06:00
parent e907454943
commit f58f111cfd
+3 -2
View File
@@ -3169,12 +3169,13 @@ public:
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] );
aStyles.push_back( pStyle );
pStyle->PushSelf(L);
lua_rawseti(L, -2, s);
}
LuaHelpers::CreateTableFromArray<Style*>( aStyles, L );
return 1;
}