54 static std::string
unit_level_tooltip(
const int level,
const std::vector<std::string> &adv_to_types,
const std::vector<config> &adv_to_mods)
58 const bool has_advancements = !adv_to_types.empty() || !adv_to_mods.empty();
59 if(has_advancements) {
60 tooltip <<
_(
"Advancements:") <<
"\n<b>\t";
61 if(!adv_to_types.empty())
63 if(!adv_to_mods.empty()) {
64 if(!adv_to_types.empty())
66 std::vector<std::string> descriptions;
67 for(
const config& adv : adv_to_mods)
68 descriptions.push_back(adv[
"description"].str());
85 const auto mod_adv_iters =
type.modification_advancements();
86 const std::vector<config> mod_advancements(mod_adv_iters.begin(), mod_adv_iters.end());
A config object defines a single node in a WML file, with access to child nodes.
A single unit type that the player may recruit.
This class represents a single unit of a specific type.
static std::string _(const char *str)
int level() const
The current level of this unit.
std::vector< config > get_modification_advances() const
Gets any non-typed advanced options set by modifications.
const advances_to_t & advances_to() const
Gets the possible types this unit can advance to on level-up.
const std::vector< std::string > advances_to_translated() const
Gets the names of the possible types this unit can advance to on level-up.
std::string tooltip
Shown when hovering over an entry in the filter's drop-down list.
color_t red_to_green(double val, bool for_text)
Return a color corresponding to the value val red for val=0.0 to green for val=100....
static std::string unit_level_tooltip(const int level, const std::vector< std::string > &adv_to_types, const std::vector< config > &adv_to_mods)
bool will_certainly_advance(const unit_map::iterator &u)
Encapsulates the logic for deciding whether an iterator u points to a unit that can advance.
std::string resistance_color(const int resistance)
Maps resistance <= -60 (resistance value <= -60%) to intense red.
int number_of_possible_advances(const unit &u)
Determines the total number of available advancements (of any kind) for a given unit.
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::string to_hex_string() const
Returns the stored color in rrggbb hex format.