41 bool delay_advancements = std::find(active_mods.begin(), active_mods.end(),
"delay_advancements") != active_mods.end();
52 return std::string(
"#FF0000");
55 return std::string(
"#FFFF00");
58 return std::string(
"#FFFFFF");
60 return std::string(
"#00FF00");
63 std::string
unit_level_tooltip(
const int level,
const std::vector<std::string> &adv_to_types,
const std::vector<config> &adv_to_mods)
65 std::ostringstream tooltip;
66 tooltip <<
_(
"Level: ") <<
"<b>" << level <<
"</b>\n";
67 const bool has_advancements = !adv_to_types.empty() || !adv_to_mods.empty();
68 if(has_advancements) {
69 tooltip <<
_(
"Advancements:") <<
"\n<b>\t";
70 if(!adv_to_types.empty())
72 if(!adv_to_mods.empty()) {
73 if(!adv_to_types.empty())
75 std::vector<std::string> descriptions;
76 for(
const config& adv : adv_to_mods)
77 descriptions.push_back(adv[
"description"].str());
82 tooltip <<
_(
"No advancement");
95 const std::vector<config> mod_advancements(mod_adv_iters.begin(), mod_adv_iters.end());
play_controller * controller
saved_game & get_saved_game()
This class represents a single unit of a specific type.
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
const std::vector< std::string > & advances_to() const
A vector of unit_type ids that this unit_type can advance to.
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...
static std::string _(const char *str)
A single unit type that the player may recruit.
std::vector< std::string > active_mods
const std::vector< std::string > advances_to_translated() const
Gets the names of the possible types this unit can advance to on level-up.
int level() const
The current level of this unit.
config::const_child_itors modification_advancements() const
Returns two iterators pointing to a range of AMLA configs.
std::string resistance_color(const int resistance)
int number_of_possible_advances(const unit &u)
Determines the total number of available advancements (of any kind) for a given unit.
game_classification & classification()
std::vector< config > get_modification_advances() const
Gets any non-typed advanced options set by modifications.
std::string unit_level_tooltip(const int level, const std::vector< std::string > &adv_to_types, const std::vector< config > &adv_to_mods)
A config object defines a single node in a WML file, with access to child nodes.
const advances_to_t & advances_to() const
Gets the possible types this unit can advance to on level-up.