Hack: store era addon id in mp game settings

This is so lobby games without the requisite era installed can display a name other than the
era's id, which isn't very nice to look at.

Note that I'm not sure if this is the best or cleanest way to handle this. At some point I'll
need to look more closely at the way addons configs are handled with regards to such games.
This commit is contained in:
Charles Dang 2016-10-02 02:57:41 +11:00
parent b9b0b0654a
commit d88f591eb5
3 changed files with 5 additions and 1 deletions

View file

@ -242,7 +242,7 @@ game_info::game_info(const config& game, const config& game_config, const std::v
addons_outcome = std::max(addons_outcome, result); // Elevate to most severe error level encountered so far
} else {
have_era = !game["require_era"].to_bool(true);
era = vgettext("Unknown era: $era_id", {{"era_id", game["mp_era"].str()}});
era = vgettext("Unknown era: $era_id", {{"era_id", game["mp_era_addon_id"].str()}});
era_short = make_short_name(era);
verified = false;

View file

@ -33,6 +33,7 @@ mp_game_settings::mp_game_settings() :
password(),
hash(),
mp_era(),
mp_era_addon_id(),
mp_scenario(),
mp_scenario_name(),
mp_campaign(),
@ -66,6 +67,7 @@ mp_game_settings::mp_game_settings(const config& cfg)
, password()
, hash(cfg["hash"].str())
, mp_era(cfg["mp_era"].str())
, mp_era_addon_id(cfg["mp_era_addon_id"].str())
, mp_scenario(cfg["mp_scenario"].str())
, mp_scenario_name(cfg["mp_scenario_name"].str())
, mp_campaign(cfg["mp_campaign"].str())
@ -107,6 +109,7 @@ config mp_game_settings::to_config() const
cfg["scenario"] = name;
cfg["hash"] = hash;
cfg["mp_era"] = mp_era;
cfg["mp_era_addon_id"] = mp_era_addon_id;
cfg["mp_scenario"] = mp_scenario;
cfg["mp_scenario_name"] = mp_scenario_name;
cfg["mp_campaign"] = mp_campaign;

View file

@ -37,6 +37,7 @@ struct mp_game_settings
std::string password;
std::string hash;
std::string mp_era;
std::string mp_era_addon_id;
std::string mp_scenario;
std::string mp_scenario_name;
std::string mp_campaign;