Skip to content

Commit

Permalink
eras_list initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Feb 20, 2014
1 parent a626090 commit c0985f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/scripting/lua.cpp
Expand Up @@ -1520,6 +1520,12 @@ static int impl_game_config_get(lua_State *L)
if(game_state_.classification().campaign_type=="multiplayer") {
return_cfgref_attrib("mp_settings", game_state_.mp_settings().to_config());
return_cfgref_attrib("era", resources::config_manager->game_config().find_child("era","id",game_state_.mp_settings().mp_era));

std::vector<std::string> eras_list;
for(config::const_child_itors its = resources::config_manager->game_config().child_range("era"); its.first != its.second; ++its.first) {
eras_list.push_back((*its.first)["id"]);
}
return_vector_string_attrib("eras", eras_list);
} //^ finds the era with name matching mp_era, and creates a lua reference from the config of that era.
return 0;
}
Expand Down

0 comments on commit c0985f0

Please sign in to comment.