mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: use std::sort in SaveHighScoreValueNetwork()
This commit is contained in:
parent
9388fa2aa1
commit
60da17418a
|
@ -79,9 +79,9 @@ int8 SaveHighScoreValue(const Company *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sort all companies given their performance */
|
/** Sort all companies given their performance */
|
||||||
static int CDECL HighScoreSorter(const Company * const *a, const Company * const *b)
|
static bool HighScoreSorter(const Company * const &a, const Company * const &b)
|
||||||
{
|
{
|
||||||
return (*b)->old_economy[0].performance_history - (*a)->old_economy[0].performance_history;
|
return b->old_economy[0].performance_history < a->old_economy[0].performance_history;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +98,7 @@ int8 SaveHighScoreValueNetwork()
|
||||||
/* Sort all active companies with the highest score first */
|
/* Sort all active companies with the highest score first */
|
||||||
FOR_ALL_COMPANIES(c) cl[count++] = c;
|
FOR_ALL_COMPANIES(c) cl[count++] = c;
|
||||||
|
|
||||||
QSortT(cl, count, &HighScoreSorter);
|
std::sort(std::begin(cl), std::begin(cl) + count, HighScoreSorter);
|
||||||
|
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
|
|
Loading…
Reference in New Issue