The tooltip of the unit's displayed level...
...now shows the possible advancements in the selected language.
This commit is contained in:
parent
de0ff4e926
commit
f07e96ce44
3 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
11
src/unit.cpp
11
src/unit.cpp
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue