Units are now sorted by race and then by name in the help menu.
This commit is contained in:
parent
9e7bc12751
commit
fe36246b17
2 changed files with 17 additions and 2 deletions
|
@ -10,6 +10,7 @@ Trunk (1.1.3+svn):
|
|||
* Fixed a bug where the wrong ability description could be extracted from
|
||||
a unit type with multiple abilities. This was causing an incorrect
|
||||
description for Illuminate in Help.
|
||||
* Units are now sorted first by race and then by name.
|
||||
* WML engine
|
||||
* modify ranged animation timing, all animations (attack, defend, missile
|
||||
* leading_image is deprecated please use the new [leading_anim] animation
|
||||
|
|
18
src/help.cpp
18
src/help.cpp
|
@ -1310,8 +1310,18 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct unit_topic_less {
|
||||
bool operator() (std::pair<const unit_type*,topic> a,
|
||||
std::pair<const unit_type*,topic> b) {
|
||||
if (a.first->race() == b.first->race())
|
||||
return a.second.title < b.second.title;
|
||||
return a.first->race() < b.first->race();
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<topic> generate_unit_topics(const bool sort_generated)
|
||||
{
|
||||
std::vector<std::pair<const unit_type*,topic> > unit_topics;
|
||||
std::vector<topic> topics;
|
||||
if (game_info == NULL) {
|
||||
return topics;
|
||||
|
@ -1332,10 +1342,14 @@ std::vector<topic> generate_unit_topics(const bool sort_generated)
|
|||
} else {
|
||||
wassert(false);
|
||||
}
|
||||
topics.push_back(unit_topic);
|
||||
unit_topics.push_back(std::pair<const unit_type*,topic>(&type,unit_topic));
|
||||
}
|
||||
if (sort_generated)
|
||||
std::sort(topics.begin(), topics.end(), title_less());
|
||||
std::sort(unit_topics.begin(), unit_topics.end(), unit_topic_less());
|
||||
for(std::vector<std::pair<const unit_type*,topic> >::const_iterator i = unit_topics.begin();
|
||||
i != unit_topics.end(); i++) {
|
||||
topics.push_back((*i).second);
|
||||
}
|
||||
return topics;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue