gui2/game_load: Constrain leader sprites to 72x72 using image path functions

Fixes #3474.
This commit is contained in:
Iris Morelle 2018-08-17 15:44:40 -03:00
parent cf999f7365
commit 36cf8c8d70
3 changed files with 7 additions and 0 deletions

View file

@ -60,6 +60,7 @@
* MacOS: Fixed moving the mouse with a touchpad also scrolling GUI dialogs
* MacOS: Add build number to OS version report
* Fix layout of Preferences window with some localisations (such as Czech)
* Force leader sprites larger than 72x72 to be downscaled in Load Game (issue #3474).
### Miscellaneous and bug fixes
* Fix some minor problems in macOS package
* Fast Micro AI: Fix bug crashing the AI when units with chance-to-hit

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -18,6 +18,7 @@
#include "desktop/open.hpp"
#include "filesystem.hpp"
#include "formatter.hpp"
#include "formula/string_utils.hpp"
#include "gettext.hpp"
#include "game_config.hpp"
@ -172,6 +173,8 @@ void game_load::display_savegame(window& window)
leader_list.clear();
const std::string sprite_scale_mod = (formatter() << "~SCALE_INTO(" << game_config::tile_size << ',' << game_config::tile_size << ')').str();
for(const auto& leader : summary_.child_range("leader")) {
widget_data data;
widget_item item;
@ -192,6 +195,9 @@ void game_load::display_savegame(window& window)
if(leader_image.empty()) {
leader_image = "units/unknown-unit.png" + leader["leader_image_tc_modifier"].str();
} else {
// Scale down any sprites larger than 72x72
leader_image += sprite_scale_mod;
}
item["label"] = leader_image;