summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-03-28 12:29:41 +0000
committerterkhen <terkhen@openttd.org>2010-03-28 12:29:41 +0000
commit2b812ac2fa71d69adfead6d20c33c439b2c490ff (patch)
tree6e5d2151888acedbc27abc6419771f71a2f70d22
parent217a98e69b56d74b53d915d15bd73e000005935d (diff)
downloadopenttd-2b812ac2fa71d69adfead6d20c33c439b2c490ff.tar.xz
(svn r19522) -Feature: Sort industries alphabetically at the fund new industry window.
-rw-r--r--src/industry_gui.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 1bf565656..a7c7b207e 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -217,7 +217,8 @@ class BuildIndustryWindow : public Window {
* The tests performed after the enabled allow to load the industries
* In the same way they are inserted by grf (if any)
*/
- for (IndustryType ind = 0; ind < NUM_INDUSTRYTYPES; ind++) {
+ for (uint8 i = 0; i < NUM_INDUSTRYTYPES; i++) {
+ IndustryType ind = _sorted_industry_types[i];
const IndustrySpec *indsp = GetIndustrySpec(ind);
if (indsp->enabled) {
/* Rule is that editor mode loads all industries.
@@ -254,14 +255,16 @@ public:
this->selected_index = -1;
this->selected_type = INVALID_INDUSTRYTYPE;
- /* Initialize arrays */
- this->SetupArrays();
-
this->callback_timer = DAY_TICKS;
this->InitNested(&_build_industry_desc, 0);
}
+ virtual void OnInit()
+ {
+ this->SetupArrays();
+ }
+
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
switch (widget) {