mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 20:18:17 +00:00
Fix traits in help
This commit is contained in:
parent
51ebabae4d
commit
7dbf17f3fe
@ -640,7 +640,7 @@ std::vector<topic> generate_trait_topics(const bool sort_generated)
|
||||
const unit_type &type = i.second;
|
||||
if (description_type(type) == FULL_DESCRIPTION) {
|
||||
config::const_child_itors traits = type.possible_traits();
|
||||
if (traits.first != traits.second && type.num_traits() > 0) {
|
||||
if (traits.first != traits.second) {
|
||||
for (const config & trait : traits) {
|
||||
const std::string trait_id = trait["id"];
|
||||
trait_list.insert(std::make_pair(trait_id, trait));
|
||||
|
@ -392,7 +392,7 @@ std::string unit_topic_generator::operator()() const {
|
||||
// Print the possible traits of the unit, cross-reference them
|
||||
// to their respective topics.
|
||||
config::const_child_itors traits = type_.possible_traits();
|
||||
if (traits.first != traits.second && type_.num_traits() > 0) {
|
||||
if (traits.first != traits.second) {
|
||||
std::vector<trait_data> must_have_traits;
|
||||
std::vector<trait_data> random_traits;
|
||||
|
||||
@ -404,7 +404,7 @@ std::string unit_topic_generator::operator()() const {
|
||||
}
|
||||
|
||||
bool line1 = !must_have_traits.empty();
|
||||
bool line2 = !random_traits.empty() && type_.num_traits() - must_have_traits.size() > 0;
|
||||
bool line2 = !random_traits.empty() && type_.num_traits() > must_have_traits.size();
|
||||
|
||||
if (line1) {
|
||||
std::string traits_label = _("Traits");
|
||||
|
@ -209,12 +209,6 @@ void unit_type::build_full(const movement_type_map &mv_types,
|
||||
}
|
||||
}
|
||||
|
||||
// Insert any traits that are just for this unit type
|
||||
for (const config &trait : cfg_.child_range("trait"))
|
||||
{
|
||||
possible_traits_.add_child("trait", trait);
|
||||
}
|
||||
|
||||
zoc_ = cfg_["zoc"].to_bool(level_ > 0);
|
||||
|
||||
const config::attribute_value & alpha_blend = cfg_["alpha"];
|
||||
@ -340,6 +334,12 @@ void unit_type::build_help_index(const movement_type_map &mv_types,
|
||||
{
|
||||
possible_traits_.add_child("trait", t);
|
||||
}
|
||||
// Insert any traits that are just for this unit type
|
||||
for (const config &trait : cfg_.child_range("trait"))
|
||||
{
|
||||
possible_traits_.add_child("trait", trait);
|
||||
}
|
||||
|
||||
for (const config &var_cfg : cfg_.child_range("variation"))
|
||||
{
|
||||
const std::string& var_id = var_cfg["variation_id"].empty() ?
|
||||
|
Loading…
x
Reference in New Issue
Block a user