summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-12-04 22:54:11 +0000
committerterkhen <terkhen@openttd.org>2010-12-04 22:54:11 +0000
commit77cb1b7e06edc8722cbe304d8ec624420d06017e (patch)
tree7fb06a3ff20ce58947027707354fadce393108b9 /src/industry_gui.cpp
parentfd2f1399d4d1f319cc313045e06dabb530cbe007 (diff)
downloadopenttd-77cb1b7e06edc8722cbe304d8ec624420d06017e.tar.xz
(svn r21389) -Feature: Use alphabetical order when sorting industries by type at the industry directory window.
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index f365c060a..dd9fce88e 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -1143,7 +1143,11 @@ protected:
/** Sort industries by type and name */
static int CDECL IndustryTypeSorter(const Industry * const *a, const Industry * const *b)
{
- int r = (*a)->type - (*b)->type;
+ int it_a = 0;
+ while (it_a != NUM_INDUSTRYTYPES && (*a)->type != _sorted_industry_types[it_a]) it_a++;
+ int it_b = 0;
+ while (it_b != NUM_INDUSTRYTYPES && (*b)->type != _sorted_industry_types[it_b]) it_b++;
+ int r = it_a - it_b;
return (r == 0) ? IndustryNameSorter(a, b) : r;
}