55 static std::string
unit_level_tooltip(
const int level,
const std::vector<std::string> &adv_to_types,
const std::vector<config> &adv_to_mods)
59 const bool has_advancements = !adv_to_types.empty() || !adv_to_mods.empty();
60 if(has_advancements) {
61 tooltip <<
_(
"Advancements:") <<
"\n\t";
62 if(!adv_to_types.empty())
64 if(!adv_to_mods.empty()) {
65 if(!adv_to_types.empty())
67 std::vector<std::string> descriptions;
68 for(
const config& adv : adv_to_mods)
69 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....
std::string bold(Args &&... data)
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.