gui2: indicate that unit cannot advance
(cherry-picked from commit 7cf478e8d9
)
This commit is contained in:
parent
317ef288c5
commit
1c57944c87
4 changed files with 30 additions and 9 deletions
|
@ -124,8 +124,13 @@ void unit_list::pre_show(window& window)
|
|||
row_data.emplace("unit_level", column);
|
||||
|
||||
std::stringstream exp_str;
|
||||
exp_str << font::span_color(unit->xp_color()) << unit->experience() << "/"
|
||||
<< (unit->can_advance() ? std::to_string(unit->max_experience()) : font::unicode_en_dash) << "</span>";
|
||||
exp_str << font::span_color(unit->xp_color());
|
||||
if(unit->can_advance()) {
|
||||
exp_str << unit->experience() << "/" << unit->max_experience();
|
||||
} else {
|
||||
exp_str << font::unicode_en_dash;
|
||||
}
|
||||
exp_str << "</span>";
|
||||
|
||||
column["label"] = exp_str.str();
|
||||
row_data.emplace("unit_experience", column);
|
||||
|
|
|
@ -204,8 +204,13 @@ void unit_recall::pre_show(window& window)
|
|||
row_data.emplace("unit_level", column);
|
||||
|
||||
std::stringstream exp_str;
|
||||
exp_str << font::span_color(unit->xp_color()) << unit->experience() << "/"
|
||||
<< (unit->can_advance() ? std::to_string(unit->max_experience()) : font::unicode_en_dash) << "</span>";
|
||||
exp_str << font::span_color(unit->xp_color());
|
||||
if(unit->can_advance()) {
|
||||
exp_str << unit->experience() << "/" << unit->max_experience();
|
||||
} else {
|
||||
exp_str << font::unicode_en_dash;
|
||||
}
|
||||
exp_str << "</span>";
|
||||
|
||||
column["label"] = exp_str.str();
|
||||
row_data.emplace("unit_experience", column);
|
||||
|
|
|
@ -458,8 +458,13 @@ void unit_preview_pane::set_displayed_unit(const unit& u)
|
|||
str << font::span_color(u.hp_color())
|
||||
<< _("HP: ") << u.hitpoints() << "/" << u.max_hitpoints() << "</span>" << "\n";
|
||||
|
||||
str << font::span_color(u.xp_color())
|
||||
<< _("XP: ") << u.experience() << "/" << u.max_experience() << "</span>";
|
||||
str << font::span_color(u.xp_color()) << _("XP: ");
|
||||
if(u.can_advance()) {
|
||||
str << u.experience() << "/" << u.max_experience();
|
||||
} else {
|
||||
str << font::unicode_en_dash;
|
||||
}
|
||||
str << "</span>";
|
||||
|
||||
label_details_->set_label(str.str());
|
||||
label_details_->set_use_markup(true);
|
||||
|
@ -467,6 +472,7 @@ void unit_preview_pane::set_displayed_unit(const unit& u)
|
|||
|
||||
if(tree_details_) {
|
||||
tree_details_->clear();
|
||||
const std::string unit_xp = u.can_advance() ? (formatter() << u.experience() << "/" << u.max_experience()).str() : font::unicode_en_dash;
|
||||
tree_details_->add_node("hp_xp_mp", {
|
||||
{ "hp",{
|
||||
{ "label", (formatter() << "<small>" << font::span_color(u.hp_color()) << "<b>" << _("HP: ") << "</b>" << u.hitpoints() << "/" << u.max_hitpoints() << "</span>" << " | </small>").str() },
|
||||
|
@ -474,7 +480,7 @@ void unit_preview_pane::set_displayed_unit(const unit& u)
|
|||
{ "tooltip", get_hp_tooltip(u.get_base_resistances(), [&u](const std::string& dt, bool is_attacker) { return u.resistance_against(dt, is_attacker, u.get_location()); }) }
|
||||
} },
|
||||
{ "xp",{
|
||||
{ "label", (formatter() << "<small>" << font::span_color(u.xp_color()) << "<b>" << _("XP: ") << "</b>" << u.experience() << "/" << u.max_experience() << "</span>" << " | </small>").str() },
|
||||
{ "label", (formatter() << "<small>" << font::span_color(u.xp_color()) << "<b>" << _("XP: ") << "</b>" << unit_xp << "</span>" << " | </small>").str() },
|
||||
{ "use_markup", "true" },
|
||||
{ "tooltip", (formatter() << _("Experience Modifier: ") << unit_experience_accelerator::get_acceleration() << '%').str() }
|
||||
} },
|
||||
|
|
|
@ -463,8 +463,13 @@ static config unit_xp(const unit* u)
|
|||
{
|
||||
if (!u) return config();
|
||||
std::ostringstream str, tooltip;
|
||||
str << span_color(u->xp_color()) << u->experience()
|
||||
<< '/' << u->max_experience() << naps;
|
||||
str << span_color(u->xp_color());
|
||||
if(u->can_advance()) {
|
||||
str << u->experience() << '/' << u->max_experience();
|
||||
} else {
|
||||
str << font::unicode_en_dash;
|
||||
}
|
||||
str << naps;
|
||||
|
||||
int exp_mod = unit_experience_accelerator::get_acceleration();
|
||||
tooltip << _("Experience Modifier: ") << exp_mod << '%';
|
||||
|
|
Loading…
Add table
Reference in a new issue