1
0
Fork 0

(svn r25096) -Feature: Do descending sort order on population by default, and stabilize sort of equally populated towns.

release/1.4
alberth 2013-03-17 15:44:19 +00:00
parent d62ab47c74
commit cfa42fcdce
1 changed files with 5 additions and 2 deletions

View File

@ -682,10 +682,13 @@ private:
return strnatcmp(buf, buf_cache); // Sort by name (natural sorting).
}
/** Sort by population */
/** Sort by population (default descending, as big towns are of the most interest). */
static int CDECL TownPopulationSorter(const Town * const *a, const Town * const *b)
{
return (*a)->cache.population - (*b)->cache.population;
uint32 a_population = (*a)->cache.population;
uint32 b_population = (*b)->cache.population;
if (a_population == b_population) return TownDirectoryWindow::TownNameSorter(a, b);
return (a_population > b_population) ? -1 : 1;
}
public: