FLG Manager: sort leader list alphabetically, with Random first

This commit is contained in:
Charles Dang 2016-08-30 03:41:43 +11:00
parent 404f698a55
commit af30309687
2 changed files with 6 additions and 6 deletions

View file

@ -492,6 +492,11 @@ void flg_manager::update_choosable_leaders()
choosable_leaders_.push_back(default_leader_type_);
}
}
// Sort alphabetically, but with the 'random' option always first
std::sort(choosable_leaders_.begin() + 1, choosable_leaders_.end(), [](const std::string& str1, const std::string& str2) {
return str1 < str2;
});
}
void flg_manager::update_choosable_genders()

View file

@ -138,11 +138,6 @@ void tfaction_select::on_faction_select(twindow& window)
}
}
// TODO: this breaks ordering within the FLG manager
//std::sort(leaders.begin(), leaders.end(), [](const config& cfg1, const config& cfg2) {
// return cfg1["label"].str() < cfg2["label"].str();
//});
tmenu_button& leader_dropdown = find_widget<tmenu_button>(&window, "leader_menu", false);
leader_dropdown.set_values(leaders, flg_manager_.current_leader_index());
@ -172,7 +167,7 @@ void tfaction_select::on_leader_select(twindow& window)
return std::find(genders.begin(), genders.end(), gender) != genders.end();
};
// TODO: should we decouple this from the dlg manager and instead just check the unit type directly?
// TODO: should we decouple this from the flg manager and instead just check the unit type directly?
find_widget<ttoggle_button>(&window, "gender_male", false).set_active(gender_available(unit_race::s_male));
find_widget<ttoggle_button>(&window, "gender_female", false).set_active(gender_available(unit_race::s_female));