From eb9fe515f0314e88d673ade2e1b3948e3cc9596a Mon Sep 17 00:00:00 2001 From: LovCAPONE Date: Fri, 26 Sep 2014 02:09:45 -0400 Subject: [PATCH] Fix bug #22650: nontranslatable strings displayed in tooltips for terrain icons The string for the tooltip of the terrain icon was the underlying terrain id (same string as the one used to retreive the image). "gamemap::get_terrain_string" method is used as string for the tooltip in order to have a correct translatable string. --- changelog | 1 + src/reports.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index 37f9ee6e6369..5dc24f30a396 100644 --- a/changelog +++ b/changelog @@ -325,6 +325,7 @@ Version 1.13.0-dev: * Fix bug #22643: Cannot compile with boost 1.56 * Fix issue where the chatlog for a replayed game could not be opened in single player. The chatlog can now always be opened. + * Fix bug #22650: nontranslatable strings displayed in tooltips for terrain icons Version 1.11.11: * Add-ons server: diff --git a/src/reports.cpp b/src/reports.cpp index a251502d000a..102813727850 100644 --- a/src/reports.cpp +++ b/src/reports.cpp @@ -1338,10 +1338,11 @@ REPORT_GENERATOR(income, rc) } namespace { -void blit_tced_icon(config &cfg, const std::string &terrain_id, const std::string &icon_image, bool high_res) { +void blit_tced_icon(config &cfg, const std::string &terrain_id, const std::string &icon_image, bool high_res, + const std::string &terrain_name) { const std::string tc_base = high_res ? "images/buttons/icon-base-32.png" : "images/buttons/icon-base-16.png"; const std::string terrain_image = "terrain/" + icon_image + (high_res ? "_30.png" : ".png"); - add_image(cfg, tc_base + "~RC(magenta>" + terrain_id + ")~BLIT(" + terrain_image + ")", terrain_id); + add_image(cfg, tc_base + "~RC(magenta>" + terrain_id + ")~BLIT(" + terrain_image + ")", terrain_name); } } @@ -1383,10 +1384,11 @@ REPORT_GENERATOR(terrain_info, rc) if (underlying_terrain == t_translation::OFF_MAP_USER) continue; const std::string& terrain_id = map.get_terrain_info(underlying_terrain).id(); + const std::string& terrain_name = map.get_terrain_string(underlying_terrain); const std::string& terrain_icon = map.get_terrain_info(underlying_terrain).icon_image(); if (terrain_icon.empty()) continue; - blit_tced_icon(cfg, terrain_id, terrain_icon, high_res); + blit_tced_icon(cfg, terrain_id, terrain_icon, high_res, terrain_name); } return cfg; }