Skip to content

Commit

Permalink
MP Staging/MP Join Game: always draw leader sprite at 72x72 (fixes #1981
Browse files Browse the repository at this point in the history
)

This is also related to #1932. I fixed leader sprites being cropped in 41e6741,
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.
  • Loading branch information
Vultraz committed Feb 6, 2018
1 parent ba22daf commit 01105cc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
21 changes: 17 additions & 4 deletions data/gui/window/mp_join_game.cfg
Expand Up @@ -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]
Expand Down
22 changes: 18 additions & 4 deletions data/gui/window/mp_staging.cfg
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion src/gui/dialogs/multiplayer/mp_staging.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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()) {
Expand Down

1 comment on commit 01105cc

@CelticMinstrel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could've just used IPFs, couldn't you?

But whatever, if it works, it works.

Please sign in to comment.