The tooltip of the unit's displayed level...

...now shows the possible advancements in the selected language.
This commit is contained in:
Fabian Müller 2011-10-28 09:52:40 +00:00
parent de0ff4e926
commit f07e96ce44
3 changed files with 13 additions and 1 deletions

View file

@ -233,7 +233,7 @@ static config unit_level(unit* u)
std::ostringstream str, tooltip;
str << u->level();
tooltip << _("Level: ") << "<b>" << u->level() << "</b>\n";
const std::vector<std::string> &adv_to = u->advances_to();
const std::vector<std::string> &adv_to = u->advances_to_translated();
if (adv_to.empty())
tooltip << _("No advancement");
else

View file

@ -1017,6 +1017,17 @@ void unit::set_recruits(const std::vector<std::string>& recruits)
//ai::manager::raise_recruit_list_changed();
}
const std::vector<std::string> unit::advances_to_translated() const
{
std::vector<std::string> result;
foreach (std::string type_id, advances_to_)
{
const unit_type *type = unit_types.find(type_id);
result.push_back(type->type_name());
}
return result;
}
void unit::set_advances_to(const std::vector<std::string>& advances_to)
{
unit_types.check_types(advances_to);

View file

@ -77,6 +77,7 @@ public:
advance_to(cfg_, t, use_traits, state);
}
const std::vector<std::string>& advances_to() const { return advances_to_; }
const std::vector<std::string> advances_to_translated() const;
void set_advances_to(const std::vector<std::string>& advances_to);
/** The type id of the unit */