MP Lobby: restored Era info to main game display

Includes some slight spacing tweaks.

(cherry-picked from commit b17e9fa9b1)
This commit is contained in:
Charles Dang 2018-05-05 12:02:16 +11:00
parent 5129b2c42a
commit e9bc7c9586
4 changed files with 17 additions and 7 deletions

View file

@ -69,6 +69,7 @@
* Improved reporting of network errors in the MP lobby (issue #3005).
* Ensure the chat widget remains the correct size even after a window resize.
* Custom MP game names are now capped at 50 characters.
* Restored Era info to main MP game display.
### WML engine
* Support formula= key in [variable] ConditionalWML
* Support to_location in [move_unit], taking a location ID

View file

@ -70,7 +70,7 @@
[column]
grow_factor = 1
border = "all"
border_size = 3
border_size = 5
horizontal_alignment = "left"
[label]
@ -85,8 +85,8 @@
[column]
grow_factor = 1
horizontal_grow = true
border = "left,right"
border_size = 3
border = "all"
border_size = 5
[label]
id = "scenario"

View file

@ -261,7 +261,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("$era_name (missing)", {{"era_name", game["mp_era_name"].str()}});
era = game["mp_era_name"].str();
era_short = make_short_name(era);
verified = false;

View file

@ -423,10 +423,15 @@ std::map<std::string, string_map> mp_lobby::make_game_row_data(const mp::game_in
color_string = (game.reloaded || game.started) ? font::YELLOW_COLOR : font::GOOD_COLOR;
}
const std::string scenario_text = VGETTEXT("$game_name (Era: $era_name)", {
{"game_name", game.scenario},
{"era_name", game.era}
});
item["label"] = game.vacant_slots > 0 ? colorize(game.name, font::GOOD_COLOR) : game.name;
data.emplace("name", item);
item["label"] = colorize("<i>" + game.scenario + "</i>", font::GRAY_COLOR);
item["label"] = colorize("<i>" + scenario_text + "</i>", font::GRAY_COLOR);
data.emplace("scenario", item);
item["label"] = colorize(game.status, color_string);
@ -447,9 +452,13 @@ void mp_lobby::adjust_game_row_contents(const mp::game_info& game, grid* grid, b
//
std::ostringstream ss;
ss << "<big>" << _("Era:") << "</big>\n" << game.era << "\n";
ss << "<big>" << _("Era:") << "</big>\n" << game.era;
ss << "\n<big>" << _("Modifications:") << "</big>\n";
if(!game.have_era) {
ss << " (" << _("era^missing") << ")";
}
ss << "\n\n<big>" << _("Modifications:") << "</big>\n";
std::vector<std::string> mods = utils::split(game.mod_info);