gui1: Display unit overlays and crowns in the Recall dialog preview pane
This incidentally would allow displaying overlays for other preview panes in the future (e.g. the main sidebar) since most of the required functionality was implemented on the unit_preview_pane base class.
This commit is contained in:
parent
7883f366df
commit
c7cacb1d5a
3 changed files with 26 additions and 2 deletions
|
@ -43,7 +43,8 @@ Version 1.11.7+dev:
|
|||
* Moved color cursors option to Advanced Preferences.
|
||||
* Always hide and disable color cursors option on Mac OS X since it's known
|
||||
to cause severe lags that render the cursor unusable.
|
||||
* Unit overlays are now displayed in the Recall dialog list and side panel.
|
||||
* Unit overlays are now displayed in the Recall dialog, both on the list
|
||||
and the description panel.
|
||||
* WML engine:
|
||||
* WML variable turn_number is set correctly (to 1) in prestart and start
|
||||
events. Previously, it retained its last value from the previous scenario
|
||||
|
|
|
@ -1029,7 +1029,8 @@ unit_preview_pane::details::details() :
|
|||
xp_color(),
|
||||
movement_left(0),
|
||||
total_movement(0),
|
||||
attacks()
|
||||
attacks(),
|
||||
overlays()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1115,6 +1116,18 @@ void unit_preview_pane::draw_contents()
|
|||
|
||||
sdl_blit(unit_image,NULL,screen,&rect);
|
||||
image_rect = rect;
|
||||
|
||||
if(!det.overlays.empty()) {
|
||||
BOOST_FOREACH(const std::string& overlay, det.overlays) {
|
||||
surface os = image::get_image(overlay);
|
||||
|
||||
if(os->w > rect.w || os->h > rect.h) {
|
||||
os = scale_surface(os, rect.w, rect.h, false);
|
||||
}
|
||||
|
||||
sdl_blit(os, NULL, screen, &rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Place the 'unit profile' button
|
||||
|
@ -1281,6 +1294,15 @@ const unit_preview_pane::details units_list_preview_pane::get_details() const
|
|||
det.total_movement= u.total_movement();
|
||||
|
||||
det.attacks = u.attacks();
|
||||
|
||||
if(u.can_recruit()) {
|
||||
det.overlays.push_back(unit::leader_crown());
|
||||
};
|
||||
|
||||
BOOST_FOREACH(const std::string& overlay, u.overlays()) {
|
||||
det.overlays.push_back(overlay);
|
||||
}
|
||||
|
||||
return det;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
std::string hp_color, xp_color;
|
||||
int movement_left, total_movement;
|
||||
std::vector<attack_type> attacks;
|
||||
std::vector<std::string> overlays;
|
||||
};
|
||||
|
||||
unit_preview_pane(const gui::filter_textbox *filter = NULL,
|
||||
|
|
Loading…
Add table
Reference in a new issue