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());
98 std::stringstream str;
100 if(unit_recall_cost < 0) {
101 unit_recall_cost = team_recall_cost;
104 if(unit_recall_cost > team_recall_cost) {
106 }
else if(unit_recall_cost == team_recall_cost) {
107 str <<
markup::img(
"themes/gold.png") << unit_recall_cost;
108 }
else if(unit_recall_cost < team_recall_cost) {
126 }
else if(
level < 1) {
128 }
else if(
level == 1) {
129 return std::to_string(
level);
130 }
else if(
level == 2) {
132 }
else if(
level == 3) {
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.
const color_t YELLOW_COLOR
const color_t GREEN_COLOR
const color_t INACTIVE_COLOR
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 img(const std::string &src, const std::string &align, bool floating)
Generates a Help markup tag corresponding to an image.
std::string bold(Args &&... data)
Applies bold Pango markup to the input.
std::string span_color(const color_t &color, Args &&... data)
Applies Pango markup to the input specifying its display color.
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.
std::string format_level_string(const int level, bool recallable)
std::string format_cost_string(int unit_recall_cost, const int team_recall_cost)
std::string maybe_inactive(const std::string &str, bool active)
int number_of_possible_advances(const unit &u)
Determines the total number of available advancements (of any kind) for a given unit.
std::string format_movement_string(const int moves_left, const int moves_max)
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
The basic class for representing 8-bit RGB or RGBA colour values.
std::string to_hex_string() const
Returns the stored color in rrggbb hex format.