author | peter1138 |
Fri, 20 Oct 2006 11:53:29 +0000 | |
changeset 4896 | f86350aaaaa5 |
parent 4848 | 45f848b46222 |
child 4912 | 0f51b47cb983 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1786
diff
changeset
|
4 |
#include "openttd.h" |
1299
39c06aba09aa
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1287
diff
changeset
|
5 |
#include "debug.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
6 |
#include "functions.h" |
1309
4403a69da4f8
(svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)
tron
parents:
1299
diff
changeset
|
7 |
#include "strings.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
222
diff
changeset
|
8 |
#include "table/strings.h" |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
9 |
#include "table/sprites.h" |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
534
diff
changeset
|
10 |
#include "map.h" |
1386
0de4f8541aea
(svn r1890) Begin to clean up the edit box: Remove one global variable and split the combined edit/original buffer into two
tron
parents:
1309
diff
changeset
|
11 |
#include "gui.h" |
0 | 12 |
#include "window.h" |
13 |
#include "gfx.h" |
|
14 |
#include "command.h" |
|
15 |
#include "viewport.h" |
|
16 |
#include "industry.h" |
|
17 |
#include "town.h" |
|
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2084
diff
changeset
|
18 |
#include "variables.h" |
0 | 19 |
|
1786
7cfd46c3fcc4
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1666
diff
changeset
|
20 |
/* Present in table/build_industry.h" */ |
7cfd46c3fcc4
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1666
diff
changeset
|
21 |
extern const byte _build_industry_types[4][12]; |
0 | 22 |
extern const byte _industry_type_costs[37]; |
23 |
||
1004 | 24 |
static void UpdateIndustryProduction(Industry *i); |
25 |
||
0 | 26 |
static void BuildIndustryWndProc(Window *w, WindowEvent *e) |
27 |
{ |
|
2951 | 28 |
switch (e->event) { |
0 | 29 |
case WE_PAINT: |
30 |
DrawWindowWidgets(w); |
|
31 |
if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) { |
|
1786
7cfd46c3fcc4
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1666
diff
changeset
|
32 |
int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1]; |
0 | 33 |
|
3689
50a3fd4ba752
(svn r4614) CodeChange : Cleanup of industry_cmd (Step-4).
belugas
parents:
3107
diff
changeset
|
34 |
SetDParam(0, (_price.build_industry >> 5) * GetIndustrySpec(ind_type)->cost_multiplier); |
0 | 35 |
DrawStringCentered(85, w->height - 21, STR_482F_COST, 0); |
36 |
} |
|
37 |
break; |
|
38 |
||
39 |
case WE_CLICK: { |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
40 |
int wid = e->we.click.widget; |
0 | 41 |
if (wid >= 3) { |
1914
2b4b3c3a95b4
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
42 |
if (HandlePlacePushButton(w, wid, SPR_CURSOR_INDUSTRY, 1, NULL)) |
0 | 43 |
WP(w,def_d).data_1 = wid - 3; |
44 |
} |
|
45 |
} break; |
|
46 |
||
47 |
case WE_PLACE_OBJ: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
48 |
if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY))) |
0 | 49 |
ResetObjectToPlace(); |
50 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
51 |
|
0 | 52 |
case WE_ABORT_PLACE_OBJ: |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4634
diff
changeset
|
53 |
RaiseWindowButtons(w); |
0 | 54 |
break; |
55 |
} |
|
56 |
} |
|
57 |
||
58 |
static const Widget _build_industry_land0_widgets[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
59 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
60 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
61 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
62 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
63 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
64 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
65 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
66 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
67 |
{ WIDGETS_END}, |
0 | 68 |
}; |
69 |
||
70 |
static const Widget _build_industry_land1_widgets[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
71 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
72 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
73 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
74 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
75 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
76 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
77 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
78 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
79 |
{ WIDGETS_END}, |
0 | 80 |
}; |
81 |
||
82 |
static const Widget _build_industry_land2_widgets[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
83 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
84 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
85 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
86 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
87 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
88 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
89 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
90 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
91 |
{ WIDGETS_END}, |
0 | 92 |
}; |
93 |
||
94 |
static const Widget _build_industry_land3_widgets[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
95 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
96 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
97 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
98 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
99 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
100 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
101 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
102 |
{ WIDGETS_END}, |
0 | 103 |
}; |
104 |
||
105 |
static const Widget _build_industry_land0_widgets_extra[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
106 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
107 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
108 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 187, 0x0, STR_NULL}, |
0 | 109 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
110 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
111 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
112 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
113 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
114 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL}, |
0 | 115 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
116 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 84, 95, STR_0240_COAL_MINE, STR_CONSTRUCT_COAL_MINE_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
117 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 97, 108, STR_0243_FOREST, STR_CONSTRUCT_FOREST_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
118 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 110, 121, STR_0245_OIL_RIG, STR_CONSTRUCT_OIL_RIG_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
119 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 123, 134, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
120 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 136, 147, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
121 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 149, 160, STR_0249_IRON_ORE_MINE, STR_CONSTRUCT_IRON_ORE_MINE_TIP}, |
0 | 122 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
123 |
{ WIDGETS_END}, |
0 | 124 |
}; |
125 |
||
126 |
static const Widget _build_industry_land1_widgets_extra[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
127 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
128 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
129 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 174, 0x0, STR_NULL}, |
0 | 130 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
131 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
132 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
133 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
134 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
135 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS}, |
0 | 136 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
137 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 84, 95, STR_0240_COAL_MINE, STR_CONSTRUCT_COAL_MINE_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
138 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 97, 108, STR_0243_FOREST, STR_CONSTRUCT_FOREST_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
139 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 110, 121, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
140 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 123, 134, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
141 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 136, 147, STR_024F_GOLD_MINE, STR_CONSTRUCT_GOLD_MINE_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
142 |
{ WIDGETS_END}, |
0 | 143 |
}; |
144 |
||
145 |
static const Widget _build_industry_land2_widgets_extra[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
146 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
147 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
148 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 200, 0x0, STR_NULL}, |
0 | 149 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
150 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
151 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024D_FOOD_PROCESSING_PLANT, STR_026F_CONSTRUCT_FOOD_PROCESSING}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
152 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
153 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
154 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN}, |
0 | 155 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
156 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 84, 95, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
157 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 97, 108, STR_0255_DIAMOND_MINE, STR_CONSTRUCT_DIAMOND_MINE_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
158 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 110, 121, STR_0256_COPPER_ORE_MINE, STR_CONSTRUCT_COPPER_ORE_MINE_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
159 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 123, 134, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
160 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 136, 147, STR_0251_FRUIT_PLANTATION, STR_CONSTRUCT_FRUIT_PLANTATION_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
161 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 149, 160, STR_0252_RUBBER_PLANTATION, STR_CONSTRUCT_RUBBER_PLANTATION_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
162 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 162, 173, STR_0253_WATER_SUPPLY, STR_CONSTRUCT_WATER_SUPPLY_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
163 |
{ WIDGETS_END}, |
0 | 164 |
}; |
165 |
||
166 |
static const Widget _build_industry_land3_widgets_extra[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
167 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
168 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
169 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 187, 0x0, STR_NULL}, |
0 | 170 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
171 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
172 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
173 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
174 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY}, |
0 | 175 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
176 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 71, 82, STR_0257_COTTON_CANDY_FOREST, STR_CONSTRUCT_COTTON_CANDY_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
177 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 84, 95, STR_0259_BATTERY_FARM, STR_CONSTRUCT_BATTERY_FARM_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
178 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 97, 108, STR_025A_COLA_WELLS, STR_CONSTRUCT_COLA_WELLS_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
179 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 110, 121, STR_025D_PLASTIC_FOUNTAINS, STR_CONSTRUCT_PLASTIC_FOUNTAINS_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
180 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 123, 134, STR_025F_BUBBLE_GENERATOR, STR_CONSTRUCT_BUBBLE_GENERATOR_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
181 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 136, 147, STR_0260_TOFFEE_QUARRY, STR_CONSTRUCT_TOFFEE_QUARRY_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
182 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 149, 160, STR_0261_SUGAR_MINE, STR_CONSTRUCT_SUGAR_MINE_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
183 |
{ WIDGETS_END}, |
0 | 184 |
}; |
185 |
||
186 |
||
187 |
static const WindowDesc _build_industry_land0_desc = { |
|
188 |
-1, -1, 170, 116, |
|
189 |
WC_BUILD_INDUSTRY,0, |
|
190 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
191 |
_build_industry_land0_widgets, |
|
192 |
BuildIndustryWndProc |
|
193 |
}; |
|
194 |
||
195 |
static const WindowDesc _build_industry_land1_desc = { |
|
196 |
-1, -1, 170, 116, |
|
197 |
WC_BUILD_INDUSTRY,0, |
|
198 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
199 |
_build_industry_land1_widgets, |
|
200 |
BuildIndustryWndProc |
|
201 |
}; |
|
202 |
||
203 |
static const WindowDesc _build_industry_land2_desc = { |
|
204 |
-1, -1, 170, 116, |
|
205 |
WC_BUILD_INDUSTRY,0, |
|
206 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
207 |
_build_industry_land2_widgets, |
|
208 |
BuildIndustryWndProc |
|
209 |
}; |
|
210 |
||
211 |
static const WindowDesc _build_industry_land3_desc = { |
|
212 |
-1, -1, 170, 116, |
|
213 |
WC_BUILD_INDUSTRY,0, |
|
214 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
215 |
_build_industry_land3_widgets, |
|
216 |
BuildIndustryWndProc |
|
217 |
}; |
|
218 |
||
219 |
static const WindowDesc _build_industry_land0_desc_extra = { |
|
220 |
-1, -1, 170, 188, |
|
221 |
WC_BUILD_INDUSTRY,0, |
|
222 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
223 |
_build_industry_land0_widgets_extra, |
|
224 |
BuildIndustryWndProc |
|
225 |
}; |
|
226 |
||
227 |
static const WindowDesc _build_industry_land1_desc_extra = { |
|
228 |
-1, -1, 170, 175, |
|
229 |
WC_BUILD_INDUSTRY,0, |
|
230 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
231 |
_build_industry_land1_widgets_extra, |
|
232 |
BuildIndustryWndProc |
|
233 |
}; |
|
234 |
||
235 |
static const WindowDesc _build_industry_land2_desc_extra = { |
|
236 |
-1, -1, 170, 201, |
|
237 |
WC_BUILD_INDUSTRY,0, |
|
238 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
239 |
_build_industry_land2_widgets_extra, |
|
240 |
BuildIndustryWndProc |
|
241 |
}; |
|
242 |
||
243 |
static const WindowDesc _build_industry_land3_desc_extra = { |
|
244 |
-1, -1, 170, 188, |
|
245 |
WC_BUILD_INDUSTRY,0, |
|
246 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
247 |
_build_industry_land3_widgets_extra, |
|
248 |
BuildIndustryWndProc |
|
249 |
}; |
|
250 |
||
251 |
static const WindowDesc * const _industry_window_desc[2][4] = { |
|
252 |
{ |
|
253 |
&_build_industry_land0_desc, |
|
254 |
&_build_industry_land1_desc, |
|
255 |
&_build_industry_land2_desc, |
|
256 |
&_build_industry_land3_desc, |
|
257 |
}, |
|
258 |
{ |
|
259 |
&_build_industry_land0_desc_extra, |
|
260 |
&_build_industry_land1_desc_extra, |
|
261 |
&_build_industry_land2_desc_extra, |
|
262 |
&_build_industry_land3_desc_extra, |
|
263 |
}, |
|
264 |
}; |
|
265 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1019
diff
changeset
|
266 |
void ShowBuildIndustryWindow(void) |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
267 |
{ |
4848
45f848b46222
(svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
Darkvater
parents:
4719
diff
changeset
|
268 |
if (_current_player == PLAYER_SPECTATOR) return; |
1786
7cfd46c3fcc4
(svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
Darkvater
parents:
1666
diff
changeset
|
269 |
AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0); |
0 | 270 |
} |
271 |
||
4211
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
272 |
static inline bool isProductionMinimum(const Industry *i, int pt) { |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
273 |
return i->production_rate[pt] == 1; |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
274 |
} |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
275 |
|
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
276 |
static inline bool isProductionMaximum(const Industry *i, int pt) { |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
277 |
return i->production_rate[pt] == 255; |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
278 |
} |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
279 |
|
4194
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
280 |
static inline bool IsProductionAlterable(const Industry *i) |
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
281 |
{ |
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
282 |
return ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) && |
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
283 |
(i->accepts_cargo[0] == CT_INVALID || i->accepts_cargo[0] == CT_VALUABLES)); |
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
284 |
} |
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
285 |
|
0 | 286 |
static void IndustryViewWndProc(Window *w, WindowEvent *e) |
287 |
{ |
|
1004 | 288 |
// WP(w,vp2_d).data_1 is for the editbox line |
289 |
// WP(w,vp2_d).data_2 is for the clickline |
|
290 |
// WP(w,vp2_d).data_3 is for the click pos (left or right) |
|
0 | 291 |
|
2951 | 292 |
switch (e->event) { |
1004 | 293 |
case WE_PAINT: { |
4171 | 294 |
const Industry *i = GetIndustry(w->window_number); |
2557 | 295 |
|
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
296 |
SetDParam(0, w->window_number); |
0 | 297 |
DrawWindowWidgets(w); |
298 |
||
1004 | 299 |
if (i->accepts_cargo[0] != CT_INVALID) { |
2989 | 300 |
StringID str; |
301 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
302 |
SetDParam(0, _cargoc.names_s[i->accepts_cargo[0]]); |
0 | 303 |
str = STR_4827_REQUIRES; |
1004 | 304 |
if (i->accepts_cargo[1] != CT_INVALID) { |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
305 |
SetDParam(1, _cargoc.names_s[i->accepts_cargo[1]]); |
2989 | 306 |
str = STR_4828_REQUIRES; |
1004 | 307 |
if (i->accepts_cargo[2] != CT_INVALID) { |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
308 |
SetDParam(2, _cargoc.names_s[i->accepts_cargo[2]]); |
2989 | 309 |
str = STR_4829_REQUIRES; |
0 | 310 |
} |
311 |
} |
|
312 |
DrawString(2, 107, str, 0); |
|
313 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
314 |
|
1004 | 315 |
if (i->produced_cargo[0] != CT_INVALID) { |
0 | 316 |
DrawString(2, 117, STR_482A_PRODUCTION_LAST_MONTH, 0); |
317 |
||
4896
f86350aaaaa5
(svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents:
4848
diff
changeset
|
318 |
SetDParam(0, i->produced_cargo[0]); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
319 |
SetDParam(1, i->total_production[0]); |
2063
ae866a12f2df
(svn r2572) - Codechange: [string] Changed string system so it's not as dependent on decode_parameters
ludde
parents:
1981
diff
changeset
|
320 |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
321 |
SetDParam(2, i->pct_transported[0] * 100 >> 8); |
4194
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
322 |
DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 127, STR_482B_TRANSPORTED, 0); |
1004 | 323 |
// Let's put out those buttons.. |
4211
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
324 |
if (IsProductionAlterable(i)) { |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
325 |
DrawArrowButtons(5, 127, 3, (WP(w,vp2_d).data_2 == 1) ? WP(w,vp2_d).data_3 : 0, |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
326 |
!isProductionMinimum(i, 0), !isProductionMaximum(i, 0)); |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
327 |
} |
0 | 328 |
|
1004 | 329 |
if (i->produced_cargo[1] != CT_INVALID) { |
4896
f86350aaaaa5
(svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents:
4848
diff
changeset
|
330 |
SetDParam(0, i->produced_cargo[1]); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
331 |
SetDParam(1, i->total_production[1]); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
332 |
SetDParam(2, i->pct_transported[1] * 100 >> 8); |
4194
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
333 |
DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 137, STR_482B_TRANSPORTED, 0); |
1004 | 334 |
// Let's put out those buttons.. |
4211
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
335 |
if (IsProductionAlterable(i)) { |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
336 |
DrawArrowButtons(5, 137, 3, (WP(w,vp2_d).data_2 == 2) ? WP(w,vp2_d).data_3 : 0, |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
337 |
!isProductionMinimum(i, 1), !isProductionMaximum(i, 1)); |
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
338 |
} |
0 | 339 |
} |
340 |
} |
|
341 |
||
342 |
DrawWindowViewport(w); |
|
1004 | 343 |
} |
0 | 344 |
break; |
345 |
||
1004 | 346 |
case WE_CLICK: { |
347 |
Industry *i; |
|
348 |
||
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
349 |
switch (e->we.click.widget) { |
1004 | 350 |
case 5: { |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
351 |
int line, x; |
1004 | 352 |
|
353 |
i = GetIndustry(w->window_number); |
|
354 |
||
1176
cc9d8618620d
(svn r1678) Added cheat option for setting production of raw-material product industries in game
miham
parents:
1093
diff
changeset
|
355 |
// We should work if needed.. |
4194
7df740c3b712
(svn r5654) -Cleanup: Change an ugly define into a function
Darkvater
parents:
4193
diff
changeset
|
356 |
if (!IsProductionAlterable(i)) return; |
1004 | 357 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
358 |
x = e->we.click.pt.x; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
359 |
line = (e->we.click.pt.y - 127) / 10; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
360 |
if (e->we.click.pt.y >= 127 && IS_INT_INSIDE(line, 0, 2) && i->produced_cargo[line] != CT_INVALID) { |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1004
diff
changeset
|
361 |
if (IS_INT_INSIDE(x, 5, 25) ) { |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
362 |
/* Clicked buttons, decrease or increase production */ |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1004
diff
changeset
|
363 |
if (x < 15) { |
4211
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
364 |
if (isProductionMinimum(i, line)) return; |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
365 |
i->production_rate[line] = maxu(i->production_rate[line] / 2, 1); |
1004 | 366 |
} else { |
4211
5ee54ab361c9
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4194
diff
changeset
|
367 |
if (isProductionMaximum(i, line)) return; |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
368 |
i->production_rate[line] = minu(i->production_rate[line] * 2, 255); |
1004 | 369 |
} |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
370 |
|
1004 | 371 |
UpdateIndustryProduction(i); |
372 |
SetWindowDirty(w); |
|
373 |
w->flags4 |= 5 << WF_TIMEOUT_SHL; |
|
374 |
WP(w,vp2_d).data_2 = line+1; |
|
375 |
WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2); |
|
376 |
} else if (IS_INT_INSIDE(x, 34, 160)) { |
|
377 |
// clicked the text |
|
378 |
WP(w,vp2_d).data_1 = line; |
|
379 |
SetDParam(0, i->production_rate[line] * 8); |
|
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1004
diff
changeset
|
380 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, |
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1004
diff
changeset
|
381 |
STR_CONFIG_GAME_PRODUCTION, |
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1004
diff
changeset
|
382 |
10, 100, w->window_class, |
4299
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4282
diff
changeset
|
383 |
w->window_number, CS_ALPHANUMERAL); |
1004 | 384 |
} |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1004
diff
changeset
|
385 |
} |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
386 |
} break; |
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
387 |
case 6: |
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
388 |
i = GetIndustry(w->window_number); |
1981 | 389 |
ScrollMainWindowToTile(i->xy + TileDiffXY(1, 1)); |
4193
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
390 |
} break; |
9e82090fef58
(svn r5653) -Cleanup: Do a little cleanup of the industry gui code.
Darkvater
parents:
4192
diff
changeset
|
391 |
|
1004 | 392 |
} |
0 | 393 |
break; |
1004 | 394 |
case WE_TIMEOUT: |
395 |
WP(w,vp2_d).data_2 = 0; |
|
396 |
WP(w,vp2_d).data_3 = 0; |
|
397 |
SetWindowDirty(w); |
|
398 |
break; |
|
399 |
||
400 |
case WE_ON_EDIT_TEXT: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
401 |
if (e->we.edittext.str[0] != '\0') { |
3017
a75caf4efa2d
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents:
2989
diff
changeset
|
402 |
Industry* i = GetIndustry(w->window_number); |
a75caf4efa2d
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
tron
parents:
2989
diff
changeset
|
403 |
int line = WP(w,vp2_d).data_1; |
1004 | 404 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
405 |
i->production_rate[line] = clampu(atoi(e->we.edittext.str), 0, 255); |
1004 | 406 |
UpdateIndustryProduction(i); |
407 |
SetWindowDirty(w); |
|
408 |
} |
|
0 | 409 |
} |
410 |
} |
|
411 |
||
1004 | 412 |
static void UpdateIndustryProduction(Industry *i) |
413 |
{ |
|
414 |
if (i->produced_cargo[0] != CT_INVALID) |
|
415 |
i->total_production[0] = 8 * i->production_rate[0]; |
|
416 |
||
417 |
if (i->produced_cargo[1] != CT_INVALID) |
|
418 |
i->total_production[1] = 8 * i->production_rate[1]; |
|
419 |
} |
|
420 |
||
0 | 421 |
static const Widget _industry_view_widgets[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
422 |
{ WWT_CLOSEBOX, RESIZE_NONE, 9, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
423 |
{ WWT_CAPTION, RESIZE_NONE, 9, 11, 247, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
424 |
{ WWT_STICKYBOX, RESIZE_NONE, 9, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
425 |
{ WWT_IMGBTN, RESIZE_NONE, 9, 0, 259, 14, 105, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
426 |
{ WWT_6, RESIZE_NONE, 9, 2, 257, 16, 103, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
427 |
{ WWT_IMGBTN, RESIZE_NONE, 9, 0, 259, 106, 147, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
428 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
429 |
{ WWT_IMGBTN, RESIZE_NONE, 9, 130, 259, 148, 159, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
430 |
{ WIDGETS_END}, |
0 | 431 |
}; |
432 |
||
433 |
static const WindowDesc _industry_view_desc = { |
|
434 |
-1, -1, 260, 160, |
|
435 |
WC_INDUSTRY_VIEW,0, |
|
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
436 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 437 |
_industry_view_widgets, |
438 |
IndustryViewWndProc |
|
439 |
}; |
|
440 |
||
441 |
void ShowIndustryViewWindow(int industry) |
|
442 |
{ |
|
4171 | 443 |
Window *w = AllocateWindowDescFront(&_industry_view_desc, industry); |
0 | 444 |
|
2989 | 445 |
if (w != NULL) { |
0 | 446 |
w->flags4 |= WF_DISABLE_VP_SCROLL; |
1004 | 447 |
WP(w,vp2_d).data_1 = 0; |
448 |
WP(w,vp2_d).data_2 = 0; |
|
449 |
WP(w,vp2_d).data_3 = 0; |
|
2989 | 450 |
AssignWindowViewport(w, 3, 17, 0xFE, 0x56, GetIndustry(w->window_number)->xy + TileDiffXY(1, 1), 1); |
0 | 451 |
} |
452 |
} |
|
453 |
||
454 |
static const Widget _industry_directory_widgets[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
455 |
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
456 |
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 495, 0, 13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
457 |
{ WWT_STICKYBOX, RESIZE_NONE, 13, 496, 507, 0, 13, 0x0, STR_STICKY_BUTTON}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
458 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 100, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
459 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 101, 200, 14, 25, STR_SORT_BY_TYPE, STR_SORT_ORDER_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
460 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 201, 300, 14, 25, STR_SORT_BY_PRODUCTION, STR_SORT_ORDER_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
461 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 301, 400, 14, 25, STR_SORT_BY_TRANSPORTED, STR_SORT_ORDER_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
462 |
{ WWT_PANEL, RESIZE_NONE, 13, 401, 495, 14, 25, 0x0, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
463 |
{ WWT_IMGBTN, RESIZE_BOTTOM, 13, 0, 495, 26, 189, 0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
464 |
{ WWT_SCROLLBAR, RESIZE_BOTTOM, 13, 496, 507, 14, 177, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4299
diff
changeset
|
465 |
{ WWT_RESIZEBOX, RESIZE_TB, 13, 496, 507, 178, 189, 0x0, STR_RESIZE_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
466 |
{ WIDGETS_END}, |
0 | 467 |
}; |
468 |
||
469 |
static uint _num_industry_sort; |
|
470 |
||
471 |
static char _bufcache[96]; |
|
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
472 |
static const Industry* _last_industry; |
0 | 473 |
|
474 |
static byte _industry_sort_order; |
|
475 |
||
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
69
diff
changeset
|
476 |
static int CDECL GeneralIndustrySorter(const void *a, const void *b) |
0 | 477 |
{ |
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
478 |
const Industry* i = *(const Industry**)a; |
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
479 |
const Industry* j = *(const Industry**)b; |
4282
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
480 |
int r; |
0 | 481 |
|
482 |
switch (_industry_sort_order >> 1) { |
|
4282
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
483 |
default: NOT_REACHED(); |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
484 |
case 0: /* Sort by Name (handled later) */ |
0 | 485 |
r = 0; |
4282
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
486 |
break; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
487 |
|
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
488 |
case 1: /* Sort by Type */ |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
489 |
r = i->type - j->type; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
490 |
break; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
491 |
|
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
492 |
case 2: /* Sort by Production */ |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
493 |
if (i->produced_cargo[0] == CT_INVALID) { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
494 |
r = (j->produced_cargo[0] == CT_INVALID ? 0 : -1); |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
495 |
} else { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
496 |
if (j->produced_cargo[0] == CT_INVALID) { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
497 |
r = 1; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
498 |
} else { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
499 |
r = |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
500 |
(i->total_production[0] + i->total_production[1]) - |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
501 |
(j->total_production[0] + j->total_production[1]); |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
502 |
} |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
503 |
} |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
504 |
break; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
505 |
|
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
506 |
case 3: /* Sort by transported fraction */ |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
507 |
if (i->produced_cargo[0] == CT_INVALID) { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
508 |
r = (j->produced_cargo[0] == CT_INVALID ? 0 : -1); |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
509 |
} else { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
510 |
if (j->produced_cargo[0] == CT_INVALID) { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
511 |
r = 1; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
512 |
} else { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
513 |
int pi; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
514 |
int pj; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
515 |
|
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
516 |
pi = i->pct_transported[0] * 100 >> 8; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
517 |
if (i->produced_cargo[1] != CT_INVALID) { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
518 |
int p = i->pct_transported[1] * 100 >> 8; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
519 |
if (p < pi) pi = p; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
520 |
} |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
521 |
|
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
522 |
pj = j->pct_transported[0] * 100 >> 8; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
523 |
if (j->produced_cargo[1] != CT_INVALID) { |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
524 |
int p = j->pct_transported[1] * 100 >> 8; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
525 |
if (p < pj) pj = p; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
526 |
} |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
527 |
|
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
528 |
r = pi - pj; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
529 |
} |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
530 |
} |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
531 |
break; |
0 | 532 |
} |
533 |
||
534 |
// default to string sorting if they are otherwise equal |
|
535 |
if (r == 0) { |
|
4282
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
536 |
char buf1[96]; |
9394aef5b65b
(svn r5912) -Fix: Sort order for produced amount and transported percentage was reversed in the industry list
tron
parents:
4277
diff
changeset
|
537 |
|
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
538 |
SetDParam(0, i->town->index); |
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
539 |
GetString(buf1, STR_TOWN); |
0 | 540 |
|
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
541 |
if (j != _last_industry) { |
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
542 |
_last_industry = j; |
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
543 |
SetDParam(0, j->town->index); |
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
544 |
GetString(_bufcache, STR_TOWN); |
0 | 545 |
} |
546 |
r = strcmp(buf1, _bufcache); |
|
547 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
548 |
|
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
549 |
if (_industry_sort_order & 1) r = -r; |
0 | 550 |
return r; |
551 |
} |
|
552 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1019
diff
changeset
|
553 |
static void MakeSortedIndustryList(void) |
0 | 554 |
{ |
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
555 |
const Industry* i; |
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
556 |
int n = 0; |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
557 |
|
4617
27e2588a5eff
(svn r6475) - Fix (r6055): Don't try to sort industries when there are none. Thanks to 'Delboy'
peter1138
parents:
4354
diff
changeset
|
558 |
/* Don't attempt a sort if there are no industries */ |
27e2588a5eff
(svn r6475) - Fix (r6055): Don't try to sort industries when there are none. Thanks to 'Delboy'
peter1138
parents:
4354
diff
changeset
|
559 |
if (GetIndustryArraySize() == 0) return; |
27e2588a5eff
(svn r6475) - Fix (r6055): Don't try to sort industries when there are none. Thanks to 'Delboy'
peter1138
parents:
4354
diff
changeset
|
560 |
|
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
561 |
/* Create array for sorting */ |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4346
diff
changeset
|
562 |
_industry_sort = realloc((void *)_industry_sort, GetIndustryArraySize() * sizeof(_industry_sort[0])); |
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
563 |
if (_industry_sort == NULL) |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
564 |
error("Could not allocate memory for the industry-sorting-list"); |
0 | 565 |
|
4346
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
566 |
FOR_ALL_INDUSTRIES(i) _industry_sort[n++] = i; |
66105d4f6e83
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
truelight
parents:
4344
diff
changeset
|
567 |
|
0 | 568 |
_num_industry_sort = n; |
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
569 |
_last_industry = NULL; // used for "cache" |
0 | 570 |
|
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
571 |
qsort((void*)_industry_sort, n, sizeof(_industry_sort[0]), GeneralIndustrySorter); |
65
f9f866bc609c
(svn r66) -Fix Station list updated on station deletion/station rename
darkvater
parents:
0
diff
changeset
|
572 |
|
69 | 573 |
DEBUG(misc, 1) ("Resorting Industries list..."); |
0 | 574 |
} |
575 |
||
576 |
||
577 |
static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) |
|
578 |
{ |
|
2951 | 579 |
switch (e->event) { |
0 | 580 |
case WE_PAINT: { |
581 |
int n; |
|
582 |
uint p; |
|
583 |
static const uint16 _indicator_positions[4] = {88, 187, 284, 387}; |
|
584 |
||
585 |
if (_industry_sort_dirty) { |
|
586 |
_industry_sort_dirty = false; |
|
587 |
MakeSortedIndustryList(); |
|
588 |
} |
|
589 |
||
1666
46dc094142b1
(svn r2170) -fix: [1179457] the industry list can now no longer scroll down then the end of the list is reached (Hackykid)
bjarni
parents:
1388
diff
changeset
|
590 |
SetVScrollCount(w, _num_industry_sort); |
0 | 591 |
|
592 |
DrawWindowWidgets(w); |
|
2406
8c873205483a
(svn r2932) Give the strings consisting of an up/a down arrow symbolic names
tron
parents:
2186
diff
changeset
|
593 |
DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order>>1], 15, 0x10); |
0 | 594 |
|
595 |
p = w->vscroll.pos; |
|
596 |
n = 0; |
|
597 |
||
598 |
while (p < _num_industry_sort) { |
|
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
599 |
const Industry* i = _industry_sort[p]; |
2989 | 600 |
|
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
601 |
SetDParam(0, i->index); |
2469
59a0073914d8
(svn r2995) Replace 0xFF/0xFFFF with CT_INVALID/OWNER_SPECTATOR/INVALID_STATION where appropriate
tron
parents:
2406
diff
changeset
|
602 |
if (i->produced_cargo[0] != CT_INVALID) { |
4896
f86350aaaaa5
(svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents:
4848
diff
changeset
|
603 |
SetDParam(1, i->produced_cargo[0]); |
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
604 |
SetDParam(2, i->total_production[0]); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
605 |
|
2469
59a0073914d8
(svn r2995) Replace 0xFF/0xFFFF with CT_INVALID/OWNER_SPECTATOR/INVALID_STATION where appropriate
tron
parents:
2406
diff
changeset
|
606 |
if (i->produced_cargo[1] != CT_INVALID) { |
4896
f86350aaaaa5
(svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents:
4848
diff
changeset
|
607 |
SetDParam(3, i->produced_cargo[1]); |
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
608 |
SetDParam(4, i->total_production[1]); |
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
609 |
SetDParam(5, i->pct_transported[0] * 100 >> 8); |
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
610 |
SetDParam(6, i->pct_transported[1] * 100 >> 8); |
0 | 611 |
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_TWO, 0); |
612 |
} else { |
|
2070
47b1f29d4671
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
ludde
parents:
2063
diff
changeset
|
613 |
SetDParam(3, i->pct_transported[0] * 100 >> 8); |
0 | 614 |
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM, 0); |
615 |
} |
|
616 |
} else { |
|
617 |
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_NOPROD, 0); |
|
618 |
} |
|
619 |
p++; |
|
2951 | 620 |
if (++n == w->vscroll.cap) break; |
0 | 621 |
} |
622 |
} break; |
|
623 |
||
624 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
625 |
switch (e->we.click.widget) { |
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
626 |
case 3: { |
0 | 627 |
_industry_sort_order = _industry_sort_order==0 ? 1 : 0; |
628 |
_industry_sort_dirty = true; |
|
629 |
SetWindowDirty(w); |
|
630 |
} break; |
|
631 |
||
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
632 |
case 4: { |
0 | 633 |
_industry_sort_order = _industry_sort_order==2 ? 3 : 2; |
634 |
_industry_sort_dirty = true; |
|
635 |
SetWindowDirty(w); |
|
636 |
} break; |
|
637 |
||
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
638 |
case 5: { |
0 | 639 |
_industry_sort_order = _industry_sort_order==4 ? 5 : 4; |
640 |
_industry_sort_dirty = true; |
|
641 |
SetWindowDirty(w); |
|
642 |
} break; |
|
643 |
||
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
644 |
case 6: { |
0 | 645 |
_industry_sort_order = _industry_sort_order==6 ? 7 : 6; |
646 |
_industry_sort_dirty = true; |
|
647 |
SetWindowDirty(w); |
|
648 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
649 |
|
758
423ae0bcba07
(svn r1214) -Feature: Stickified Industries (list & window), Smallmaps (all three), Stations (list & window) and Towns (list & window). I hope I didn't forget to update a widget somewhere :O
darkvater
parents:
727
diff
changeset
|
650 |
case 8: { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
651 |
int y = (e->we.click.pt.y - 28) / 10; |
821
60524daa442c
(svn r1292) -Codechange: also updated the town/industry sort-list to be uint16 compatible
truelight
parents:
758
diff
changeset
|
652 |
uint16 p; |
0 | 653 |
|
2989 | 654 |
if (!IS_INT_INSIDE(y, 0, w->vscroll.cap)) return; |
0 | 655 |
p = y + w->vscroll.pos; |
656 |
if (p < _num_industry_sort) { |
|
4277
345e1bd9525a
(svn r5907) Remove more indirection by using pointers instead of IDs. Also fix some bogus warnings on MSVC by using (void*) casts
tron
parents:
4211
diff
changeset
|
657 |
ScrollMainWindowToTile(_industry_sort[p]->xy); |
0 | 658 |
} |
659 |
} break; |
|
660 |
} |
|
661 |
break; |
|
662 |
||
663 |
case WE_4: |
|
664 |
SetWindowDirty(w); |
|
665 |
break; |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
830
diff
changeset
|
666 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
830
diff
changeset
|
667 |
case WE_RESIZE: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4617
diff
changeset
|
668 |
w->vscroll.cap += e->we.sizing.diff.y / 10; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
830
diff
changeset
|
669 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
670 |
} |
0 | 671 |
} |
672 |
||
673 |
||
674 |
/* Industry List */ |
|
675 |
static const WindowDesc _industry_directory_desc = { |
|
676 |
-1, -1, 508, 190, |
|
677 |
WC_INDUSTRY_DIRECTORY,0, |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
830
diff
changeset
|
678 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 679 |
_industry_directory_widgets, |
680 |
IndustryDirectoryWndProc |
|
681 |
}; |
|
682 |
||
683 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1019
diff
changeset
|
684 |
void ShowIndustryDirectory(void) |
0 | 685 |
{ |
4171 | 686 |
Window *w = AllocateWindowDescFront(&_industry_directory_desc, 0); |
0 | 687 |
|
2989 | 688 |
if (w != NULL) { |
0 | 689 |
w->vscroll.cap = 16; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
830
diff
changeset
|
690 |
w->resize.height = w->height - 6 * 10; // minimum 10 items |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
830
diff
changeset
|
691 |
w->resize.step_height = 10; |
0 | 692 |
SetWindowDirty(w); |
693 |
} |
|
694 |
} |