Skip to content

Commit

Permalink
MP Options Helper: skip any game, era, or mod with no [options] subtag
Browse files Browse the repository at this point in the history
Previously, these would still get included in the final options config and result in a [type] id = tag being saved
in prefs with no [option] tags. When loaded in the constructor, this would pollute the options_data_ map, which would
then in turn pollute the resulting config further, ad infinitum.
  • Loading branch information
Vultraz committed Oct 22, 2016
1 parent 2967fdb commit 6826e11
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gui/dialogs/multiplayer/mp_options_helper.cpp
Expand Up @@ -92,6 +92,13 @@ void tmp_options_helper::display_custom_options(std::string&& type, const config
// Needed since some compilers don't like passing just {}
static const std::map<std::string, string_map> empty_map;

// This ensures that any game, era, or mod with no options doesn't get an entry in the visible_options_
// vector and prevents invalid options from different games, era, or mods being created when the options
// config is created.
if(!cfg.has_child("options")) {
return;
}

visible_options_.push_back({type, cfg["id"]});
auto& data_map = options_data_[visible_options_.back()];

Expand Down

0 comments on commit 6826e11

Please sign in to comment.