Changed GetStylesForGame to not traverse the list of styles twice.
This commit is contained in:
+3
-2
@@ -3169,12 +3169,13 @@ public:
|
|||||||
luaL_error(L, "GetStylesForGame: Invalid Game: '%s'", game_name.c_str());
|
luaL_error(L, "GetStylesForGame: Invalid Game: '%s'", game_name.c_str());
|
||||||
}
|
}
|
||||||
vector<Style*> aStyles;
|
vector<Style*> aStyles;
|
||||||
|
lua_createtable(L, 0, 0);
|
||||||
for( int s=0; pGame->m_apStyles[s]; ++s )
|
for( int s=0; pGame->m_apStyles[s]; ++s )
|
||||||
{
|
{
|
||||||
Style *pStyle = const_cast<Style *>( pGame->m_apStyles[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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user