summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/town_gui.cpp7
1 files 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: