summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-07-18 15:59:08 +0000
committerbelugas <belugas@openttd.org>2007-07-18 15:59:08 +0000
commit0fada7848073a2ce65d9abdbb1957a2406c8a5b2 (patch)
treee22e59b998e975f5fec0513851ee3f9a01db7e77
parentd8690139b4858bb2b8fe22fcbe6fe0be287efc0a (diff)
downloadopenttd-0fada7848073a2ce65d9abdbb1957a2406c8a5b2.tar.xz
(svn r10617) -Codechange: code style changes (removing an erroneous tab plus switch case alignment)
-Codechange: give enum values to widgets
-rw-r--r--src/industry_gui.cpp79
1 files changed, 44 insertions, 35 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index f58aa933a..000adaa12 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -233,7 +233,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
type = _industrydata.index[_industrydata.select];
SetWindowDirty(w);
- if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(type)->IsRawIndustry()) ||
+ if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(type)->IsRawIndustry()) ||
type == INVALID_INDUSTRYTYPE) {
/* Reset the button state if going to prospecting or "build many industries" */
RaiseWindowButtons(w);
@@ -573,6 +573,14 @@ void ShowIndustryViewWindow(int industry)
}
}
+enum {
+ DIRECTORY_INDU_SORTBYNAME = 3,
+ DIRECTORY_INDU_SORTBYTYPE,
+ DIRECTORY_INDU_SORTBYPROD,
+ DIRECTORY_INDU_SORTBYTRANSPORT,
+ DIRECTORY_INDU_SHOWINDU = 8,
+};
+
static const Widget _industry_directory_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 495, 0, 13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
@@ -752,40 +760,41 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
- case 3: {
- _industry_sort_order = _industry_sort_order == 0 ? 1 : 0;
- _industry_sort_dirty = true;
- SetWindowDirty(w);
- } break;
-
- case 4: {
- _industry_sort_order = _industry_sort_order == 2 ? 3 : 2;
- _industry_sort_dirty = true;
- SetWindowDirty(w);
- } break;
-
- case 5: {
- _industry_sort_order = _industry_sort_order == 4 ? 5 : 4;
- _industry_sort_dirty = true;
- SetWindowDirty(w);
- } break;
-
- case 6: {
- _industry_sort_order = _industry_sort_order == 6 ? 7 : 6;
- _industry_sort_dirty = true;
- SetWindowDirty(w);
- } break;
-
- case 8: {
- int y = (e->we.click.pt.y - 28) / 10;
- uint16 p;
-
- if (!IS_INT_INSIDE(y, 0, w->vscroll.cap)) return;
- p = y + w->vscroll.pos;
- if (p < _num_industry_sort) {
- ScrollMainWindowToTile(_industry_sort[p]->xy);
- }
- } break;
+ case DIRECTORY_INDU_SORTBYNAME: {
+ //byte current_sort = e->we.click.widget - DIRECTORY_INDU_SORTBYNAME;
+ _industry_sort_order = _industry_sort_order == 0 ? 1 : 0;
+ _industry_sort_dirty = true;
+ SetWindowDirty(w);
+ } break;
+
+ case DIRECTORY_INDU_SORTBYTYPE: {
+ _industry_sort_order = _industry_sort_order == 2 ? 3 : 2;
+ _industry_sort_dirty = true;
+ SetWindowDirty(w);
+ } break;
+
+ case DIRECTORY_INDU_SORTBYPROD: {
+ _industry_sort_order = _industry_sort_order == 4 ? 5 : 4;
+ _industry_sort_dirty = true;
+ SetWindowDirty(w);
+ } break;
+
+ case DIRECTORY_INDU_SORTBYTRANSPORT: {
+ _industry_sort_order = _industry_sort_order == 6 ? 7 : 6;
+ _industry_sort_dirty = true;
+ SetWindowDirty(w);
+ } break;
+
+ case DIRECTORY_INDU_SHOWINDU: {
+ int y = (e->we.click.pt.y - 28) / 10;
+ uint16 p;
+
+ if (!IS_INT_INSIDE(y, 0, w->vscroll.cap)) return;
+ p = y + w->vscroll.pos;
+ if (p < _num_industry_sort) {
+ ScrollMainWindowToTile(_industry_sort[p]->xy);
+ }
+ } break;
}
break;