Skip to content

Commit

Permalink
Fix bug #22650: nontranslatable strings displayed in tooltips for ter…
Browse files Browse the repository at this point in the history
…rain 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.
  • Loading branch information
LovCAPONE committed Sep 26, 2014
1 parent 6043745 commit eb9fe51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions src/reports.cpp
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit eb9fe51

Please sign in to comment.