UI: Prefix tooltips with what kind of information they show

Also add a tooltip to vision because the label is truncated and there is
no other way for the player to get the vision value.
This commit is contained in:
josteph 2018-07-07 13:18:39 +00:00
parent e4cb8efc03
commit 97ca22e94b

View file

@ -229,8 +229,12 @@ static config unit_side(reports::context & rc, const unit* u)
std::stringstream text;
text << " " << u->side();
add_image(report, flag_icon + mods, u_team.side_name(), "");
add_text(report, text.str(), "", "");
std::ostringstream tooltip;
if (!u_team.side_name().empty()) {
tooltip << _("Side:") << " <b>" << u_team.side_name() << "</b>";
}
add_image(report, flag_icon + mods, tooltip.str(), "");
add_text(report, text.str(), tooltip.str(), "");
return report;
}
REPORT_GENERATOR(unit_side, rc)
@ -621,10 +625,12 @@ static config unit_vision(const unit* u)
if (!u) return config();
// TODO
std::ostringstream str;
std::ostringstream str, tooltip;
if (u->vision() != u->total_movement()) {
str << _("vision: ") << u->vision(); }
return text_report(str.str(), str.str());
str << _("vision:") << ' ' << u->vision();
tooltip << _("vision:") << ' ' << u->vision();
}
return text_report(str.str(), tooltip.str());
}
REPORT_GENERATOR(unit_vision, rc)
{
@ -1173,6 +1179,7 @@ static config tod_stats_at(reports::context & rc, const map_location& hex)
const map_location& tod_schedule_hex = (hex.valid() && !display::get_singleton()->shrouded(hex)) ? hex : map_location::null_location();
const std::vector<time_of_day>& schedule = rc.tod().times(tod_schedule_hex);
tooltip << _("Time of day schedule:") << " \n";
int current = rc.tod().get_current_time(tod_schedule_hex);
int i = 0;
for (const time_of_day& tod : schedule) {
@ -1221,7 +1228,7 @@ static config time_of_day_at(reports::context & rc, const map_location& mouseove
if (l != 0) {
liminal_color = (l > 0) ? "green" : "red";
}
tooltip << tod.name << '\n'
tooltip << _("Time of day:") << " <b>" << tod.name << "</b>\n"
<< _("Lawful units: ") << "<span foreground=\"" << lawful_color << "\">"
<< utils::signed_percent(b) << "</span>\n"
<< _("Neutral units: ") << utils::signed_percent(0) << '\n'