Merge branch 'master' into jgrpp

# Conflicts:
#	src/core/alloc_type.hpp
#	src/group_gui.cpp
#	src/newgrf.cpp
#	src/saveload/economy_sl.cpp
#	src/saveload/map_sl.cpp
#	src/station_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-04-16 18:03:08 +01:00
57 changed files with 524 additions and 635 deletions

View File

@@ -559,29 +559,6 @@ public:
}
}
/** Sort the groups by their name */
static int CDECL GroupNameSorter(const Group * const *a, const Group * const *b)
{
static const Group *last_group[2] = { nullptr, nullptr };
static char last_name[2][64] = { "", "" };
if (*a != last_group[0]) {
last_group[0] = *a;
SetDParam(0, (*a)->index);
GetString(last_name[0], STR_GROUP_NAME, lastof(last_name[0]));
}
if (*b != last_group[1]) {
last_group[1] = *b;
SetDParam(0, (*b)->index);
GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1]));
}
int r = strnatcmp(last_name[0], last_name[1]); // Sort by name (natural sorting).
if (r == 0) return (*a)->index - (*b)->index;
return r;
}
void BuildGroupList(Owner owner)
{
if (!this->groups.NeedRebuild()) return;
@@ -599,6 +576,7 @@ public:
}
list.ForceResort();
extern bool GroupNameSorter(const Group * const &a, const Group * const &b);
list.Sort(&GroupNameSorter);
AddParents(&list, INVALID_GROUP, 0);