Backport 2008-05-02T01:16:17Z!shadowm@wesnoth.org (does not mess with translations, sirs)

This commit is contained in:
Ignacio R. Morelle 2008-05-02 01:19:46 +00:00
parent 1f610505a7
commit 953a610a2e

View file

@ -550,15 +550,20 @@ void save_preview_pane::draw_contents()
str << "\n";
if(campaign_type == "scenario") {
const config* campaign = game_config_->find_child("campaign","id",summary["campaign"]);
const std::string campaign_id = summary["campaign"];
const config* campaign = campaign_id.empty() ? NULL : game_config_->find_child("campaign", "id", campaign_id);
utils::string_map symbols;
if (campaign != NULL) {
utils::string_map symbols;
symbols["campaign_name"] = (*campaign)["name"];
//!@todo FIXME: this is a superfluous manner of making the string,
//! however, I'll keep it in 1.4 for the sake of not breaking existing translations
str << vgettext("Campaign: $campaign_name", symbols);
} else {
str << _("#(Invalid)");
// Fallback to nontranslatable campaign id.
symbols["campaign_name"] = "(" + campaign_id + ")";
}
str << vgettext("Campaign: $campaign_name", symbols);
// Display internal id for debug purposes if we didn't above
if (game_config::debug && (campaign != NULL)) {
str << '\n' << "(" << campaign_id << ")";
}
} else if(campaign_type == "multiplayer") {
str << _("Multiplayer");