Skip to content

Commit

Permalink
gui2/game_load: Constrain leader sprites to 72x72 using image path fu…
Browse files Browse the repository at this point in the history
…nctions

Fixes #3474.

(cherry-picked from commit 36cf8c8)
  • Loading branch information
irydacea committed Oct 7, 2018
1 parent f434c0c commit 0c0192c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -57,6 +57,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
Expand Down
Binary file modified data/core/images/units/monsters/fire-dragon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/gui/dialogs/game_load.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -174,6 +175,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")) {
std::map<std::string, string_map> data;
string_map item;
Expand All @@ -194,6 +197,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;
Expand Down

0 comments on commit 0c0192c

Please sign in to comment.