From cfa42fcdceb30e8016451532e7929a57fc5a419d Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 17 Mar 2013 15:44:19 +0000 Subject: (svn r25096) -Feature: Do descending sort order on population by default, and stabilize sort of equally populated towns. --- src/town_gui.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/town_gui.cpp b/src/town_gui.cpp index c93fa6583..d8ffc8262 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -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: -- cgit v1.2.3-54-g00ecf