gui2/game_load: Constrain leader sprites to 72x72 using image path functions
Fixes #3474.
(cherry-picked from commit 36cf8c8d70
)
This commit is contained in:
parent
f434c0c427
commit
0c0192c58d
3 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 16 KiB |
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue