MP Staging/MP Join Game: always draw leader sprite at 72x72 (fixes #1981)

This is also related to #1932. I fixed leader sprites being cropped in 41e674128f,
and that made sprites in MP Staging always scale to 72x72. However, large sprites like the
Fire Dragon's still drew at full size in MP Join Game since the damn tree nodes are being
recreated when new changes come in (a separate issue I need to fix). This change fixes the
size of leader sprites in both dialogs to 72x72 regardless of sprite size, so we're saved
any similar issues cropping up in the future even once I do fix the excessive node recreation
in MP Join Game.
This commit is contained in:
Charles Dang 2018-02-07 03:07:31 +11:00
parent ba22daf029
commit 01105cc924
3 changed files with 37 additions and 9 deletions

View file

@ -76,11 +76,24 @@
border = "all"
border_size = 5
[image]
[drawing]
id = "leader_image"
definition = "scaled_to_size"
linked_group = "leader_images"
[/image]
definition = "default"
width = 72
height = 72
[draw]
[image]
name = "(text)"
w = "(min(image_original_width, 72))"
h = "(min(image_original_height, 72))"
{GUI_CENTERED_IMAGE}
[/image]
[/draw]
[/drawing]
[/column]
[column]

View file

@ -88,11 +88,25 @@
border = "all"
border_size = 5
[image]
[drawing]
id = "leader_image"
definition = "scaled_to_size"
linked_group = "leader_images"
[/image]
definition = "default"
width = 72
height = 72
[draw]
[image]
name = "(text)"
w = "(min(image_original_width, 72))"
h = "(min(image_original_height, 72))"
{GUI_CENTERED_IMAGE}
[/image]
[/draw]
[/drawing]
[/column]
[column]

View file

@ -24,6 +24,7 @@
#include "gui/dialogs/multiplayer/faction_select.hpp"
#include "gui/widgets/button.hpp"
#include "gui/widgets/chatbox.hpp"
#include "gui/widgets/drawing.hpp"
#include "gui/widgets/menu_button.hpp"
#include "gui/widgets/image.hpp"
#ifdef GUI2_EXPERIMENTAL_LISTBOX
@ -423,7 +424,7 @@ void mp_staging::update_leader_display(ng::side_engine_ptr side, grid& row_grid)
current_leader = type.type_name();
}
find_widget<image>(&row_grid, "leader_image", false).set_label(new_image);
find_widget<drawing>(&row_grid, "leader_image", false).set_label(new_image);
// Faction and leader
if(!side->cfg()["name"].empty()) {