author | pasky |
Mon, 22 Nov 2004 21:48:40 +0000 | |
changeset 486 | dadcb8d5a6bd |
parent 484 | 3fad52d29f00 |
child 502 | c2db77551c24 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
3 |
||
4 |
#include "window.h" |
|
5 |
#include "gui.h" |
|
6 |
#include "gfx.h" |
|
7 |
#include "command.h" |
|
8 |
#include "engine.h" |
|
430 | 9 |
#include "screenshot.h" |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
10 |
#include "newgrf.h" |
0 | 11 |
|
12 |
static uint32 _difficulty_click_a; |
|
13 |
static uint32 _difficulty_click_b; |
|
14 |
static byte _difficulty_timeout; |
|
15 |
||
16 |
extern const StringID _currency_string_list[]; |
|
17 |
extern uint GetMaskOfAllowedCurrencies(); |
|
18 |
||
19 |
static const StringID _distances_dropdown[] = { |
|
20 |
STR_0139_IMPERIAL_MILES, |
|
21 |
STR_013A_METRIC_KILOMETERS, |
|
22 |
INVALID_STRING_ID |
|
23 |
}; |
|
24 |
||
25 |
static const StringID _driveside_dropdown[] = { |
|
26 |
STR_02E9_DRIVE_ON_LEFT, |
|
27 |
STR_02EA_DRIVE_ON_RIGHT, |
|
28 |
INVALID_STRING_ID |
|
29 |
}; |
|
30 |
||
31 |
static const StringID _autosave_dropdown[] = { |
|
32 |
STR_02F7_OFF, |
|
33 |
STR_AUTOSAVE_1_MONTH, |
|
34 |
STR_02F8_EVERY_3_MONTHS, |
|
35 |
STR_02F9_EVERY_6_MONTHS, |
|
36 |
STR_02FA_EVERY_12_MONTHS, |
|
37 |
INVALID_STRING_ID, |
|
38 |
}; |
|
39 |
||
40 |
static const StringID _designnames_dropdown[] = { |
|
41 |
STR_02BE_DEFAULT, |
|
42 |
STR_02BF_CUSTOM, |
|
43 |
INVALID_STRING_ID |
|
44 |
}; |
|
45 |
||
46 |
static StringID *BuildDynamicDropdown(StringID base, int num) |
|
47 |
{ |
|
48 |
static StringID buf[32 + 1]; |
|
49 |
StringID *p = buf; |
|
50 |
while (--num>=0) *p++ = base++; |
|
51 |
*p = INVALID_STRING_ID; |
|
52 |
return buf; |
|
53 |
} |
|
54 |
||
55 |
static int GetCurRes() |
|
56 |
{ |
|
57 |
int i; |
|
306
c44133836566
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
58 |
for(i = 0; i != _num_resolutions; i++) |
c44133836566
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
59 |
if (_resolutions[i][0] == _screen.width && |
c44133836566
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
60 |
_resolutions[i][1] == _screen.height) |
0 | 61 |
break; |
62 |
return i; |
|
63 |
} |
|
64 |
||
65 |
static void GameOptionsWndProc(Window *w, WindowEvent *e) |
|
66 |
{ |
|
67 |
int i; |
|
68 |
||
69 |
switch(e->event) { |
|
70 |
case WE_PAINT: { |
|
71 |
StringID str = STR_02BE_DEFAULT; |
|
72 |
w->disabled_state = (_vehicle_design_names & 1) ? (++str, 0) : (1 << 21); |
|
73 |
SET_DPARAM16(0, str); |
|
74 |
SET_DPARAM16(1, _currency_string_list[_opt_mod_ptr->currency]); |
|
75 |
SET_DPARAM16(2, _opt_mod_ptr->kilometers + STR_0139_IMPERIAL_MILES); |
|
76 |
SET_DPARAM16(3, STR_02E9_DRIVE_ON_LEFT + _opt_mod_ptr->road_side); |
|
77 |
SET_DPARAM16(4, STR_TOWNNAME_ENGLISH + _opt_mod_ptr->town_name); |
|
78 |
SET_DPARAM16(5, _autosave_dropdown[_opt_mod_ptr->autosave]); |
|
79 |
SET_DPARAM16(6, SPECSTR_LANGUAGE_START + _dynlang.curr); |
|
80 |
i = GetCurRes(); |
|
81 |
SET_DPARAM16(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); |
|
82 |
SET_DPARAM16(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
|
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
83 |
(_fullscreen) ? SETBIT(w->click_state, 28) : CLRBIT(w->click_state, 28); // fullscreen button |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
84 |
|
0 | 85 |
DrawWindowWidgets(w); |
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
86 |
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen |
0 | 87 |
} break; |
88 |
||
89 |
case WE_CLICK: |
|
90 |
switch(e->click.widget) { |
|
91 |
case 5: |
|
92 |
ShowDropDownMenu(w, _currency_string_list, _opt_mod_ptr->currency, e->click.widget, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies()); |
|
93 |
return; |
|
94 |
case 8: |
|
95 |
ShowDropDownMenu(w, _distances_dropdown, _opt_mod_ptr->kilometers, e->click.widget, 0); |
|
96 |
return; |
|
97 |
case 11: { |
|
98 |
int i = _opt_mod_ptr->road_side; |
|
99 |
ShowDropDownMenu(w, _driveside_dropdown, i, e->click.widget, (_game_mode == GM_MENU) ? 0 : (-1) ^ (1 << i)); |
|
100 |
return; |
|
101 |
} |
|
102 |
case 14: { |
|
103 |
int i = _opt_mod_ptr->town_name; |
|
104 |
ShowDropDownMenu(w, BuildDynamicDropdown(STR_TOWNNAME_ENGLISH, SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1), i, e->click.widget, (_game_mode == GM_MENU) ? 0 : (-1) ^ (1 << i)); |
|
105 |
return; |
|
106 |
} |
|
107 |
case 17: |
|
108 |
ShowDropDownMenu(w, _autosave_dropdown, _opt_mod_ptr->autosave, e->click.widget, 0); |
|
109 |
return; |
|
110 |
case 20: |
|
111 |
ShowDropDownMenu(w, _designnames_dropdown, (_vehicle_design_names&1)?1:0, e->click.widget, (_vehicle_design_names&2)?0:2); |
|
112 |
return; |
|
113 |
case 21: |
|
114 |
return; |
|
115 |
case 24: |
|
116 |
ShowDropDownMenu(w, _dynlang.dropdown, _dynlang.curr, e->click.widget, 0); |
|
117 |
return; |
|
118 |
case 27: |
|
119 |
// setup resolution dropdown |
|
120 |
ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), e->click.widget, 0); |
|
121 |
return; |
|
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
122 |
case 28: /* Click fullscreen on/off */ |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
123 |
(_fullscreen) ? CLRBIT(w->click_state, 28) : SETBIT(w->click_state, 28); |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
124 |
ToggleFullScreen(!_fullscreen); // toggle full-screen on/off |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
125 |
SetWindowDirty(w); |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
126 |
return; |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
127 |
case 31: /* Setup screenshot format dropdown */ |
0 | 128 |
ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, e->click.widget, 0); |
129 |
return; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
130 |
|
0 | 131 |
} |
132 |
break; |
|
133 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
134 |
case WE_DROPDOWN_SELECT: |
0 | 135 |
switch(e->dropdown.button) { |
136 |
case 20: |
|
137 |
if (e->dropdown.index == 0) { |
|
138 |
DeleteCustomEngineNames(); |
|
139 |
MarkWholeScreenDirty(); |
|
140 |
} else if (!(_vehicle_design_names&1)) { |
|
141 |
LoadCustomEngineNames(); |
|
142 |
MarkWholeScreenDirty(); |
|
143 |
} |
|
144 |
break; |
|
145 |
case 5: |
|
146 |
_opt_mod_ptr->currency = _opt.currency = e->dropdown.index; |
|
147 |
MarkWholeScreenDirty(); |
|
148 |
break; |
|
149 |
case 8: |
|
150 |
_opt_mod_ptr->kilometers = e->dropdown.index; |
|
151 |
MarkWholeScreenDirty(); |
|
152 |
break; |
|
153 |
case 11: |
|
154 |
if (_game_mode == GM_MENU) |
|
155 |
DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_EMPTY)); |
|
156 |
break; |
|
157 |
case 14: |
|
158 |
if (_game_mode == GM_MENU) |
|
159 |
DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_TOWN_NAME_TYPE | CMD_MSG(STR_EMPTY)); |
|
160 |
break; |
|
161 |
case 17: |
|
162 |
_opt_mod_ptr->autosave = e->dropdown.index; |
|
163 |
SetWindowDirty(w); |
|
164 |
break; |
|
165 |
||
166 |
// change interface language |
|
167 |
case 24: |
|
168 |
ReadLanguagePack(e->dropdown.index); |
|
169 |
MarkWholeScreenDirty(); |
|
170 |
break; |
|
171 |
||
172 |
// change resolution |
|
173 |
case 27: |
|
174 |
if (e->dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->dropdown.index][0],_resolutions[e->dropdown.index][1])) |
|
175 |
SetWindowDirty(w); |
|
176 |
break; |
|
177 |
||
178 |
// change screenshot format |
|
315
e008762a8689
(svn r321) -Fix: crash when making png screenshot with odd resolution (Tron)
truelight
parents:
306
diff
changeset
|
179 |
case 31: |
0 | 180 |
SetScreenshotFormat(e->dropdown.index); |
181 |
SetWindowDirty(w); |
|
182 |
break; |
|
183 |
} |
|
184 |
break; |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
189 |
{ |
|
190 |
if (flags & DC_EXEC) { |
|
191 |
_opt_mod_ptr->road_side = p1; |
|
192 |
InvalidateWindow(WC_GAME_OPTIONS,0); |
|
193 |
} |
|
194 |
return 0; |
|
195 |
} |
|
196 |
||
197 |
int32 CmdSetTownNameType(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
198 |
{ |
|
199 |
if (flags & DC_EXEC) { |
|
200 |
_opt_mod_ptr->town_name = p1; |
|
201 |
InvalidateWindow(WC_GAME_OPTIONS,0); |
|
202 |
} |
|
203 |
return 0; |
|
204 |
} |
|
205 |
||
206 |
||
207 |
static const Widget _game_options_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
208 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
209 |
{ WWT_CAPTION, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
210 |
{ WWT_PANEL, 14, 0, 369, 14, 238, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
211 |
{ WWT_FRAME, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
212 |
{ WWT_6, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
213 |
{ WWT_CLOSEBOX, 14, 158, 168, 35, 44, STR_0225, STR_02E2_CURRENCY_UNITS_SELECTION}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
214 |
{ WWT_FRAME, 14, 190, 359, 20, 55, STR_02E3_DISTANCE_UNITS, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
215 |
{ WWT_6, 14, 200, 349, 34, 45, STR_02E4, STR_02E5_DISTANCE_UNITS_SELECTION}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
216 |
{ WWT_CLOSEBOX, 14, 338, 348, 35, 44, STR_0225, STR_02E5_DISTANCE_UNITS_SELECTION}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
217 |
{ WWT_FRAME, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
218 |
{ WWT_6, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
219 |
{ WWT_CLOSEBOX, 14, 158, 168, 77, 86, STR_0225, STR_02E8_SELECT_SIDE_OF_ROAD_FOR}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
220 |
{ WWT_FRAME, 14, 190, 359, 62, 97, STR_02EB_TOWN_NAMES, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
221 |
{ WWT_6, 14, 200, 349, 76, 87, STR_02EC, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
222 |
{ WWT_CLOSEBOX, 14, 338, 348, 77, 86, STR_0225, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
223 |
{ WWT_FRAME, 14, 10, 179, 104, 139, STR_02F4_AUTOSAVE, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
224 |
{ WWT_6, 14, 20, 169, 118, 129, STR_02F5, STR_02F6_SELECT_INTERVAL_BETWEEN}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
225 |
{ WWT_CLOSEBOX, 14, 158, 168, 119, 128, STR_0225, STR_02F6_SELECT_INTERVAL_BETWEEN}, |
0 | 226 |
|
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
227 |
{ WWT_FRAME, 14, 10, 359, 194, 228, STR_02BC_VEHICLE_DESIGN_NAMES, STR_NULL}, |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
228 |
{ WWT_6, 14, 20, 119, 207, 218, STR_02BD, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION}, |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
229 |
{ WWT_CLOSEBOX, 14, 108, 118, 208, 217, STR_0225, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION}, |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
230 |
{ WWT_CLOSEBOX, 14, 130, 349, 207, 218, STR_02C0_SAVE_CUSTOM_NAMES_TO_DISK, STR_02C2_SAVE_CUSTOMIZED_VEHICLE}, |
0 | 231 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
232 |
{ WWT_FRAME, 14, 190, 359, 104, 139, STR_OPTIONS_LANG, STR_NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
233 |
{ WWT_6, 14, 200, 349, 118, 129, STR_OPTIONS_LANG_CBO, STR_OPTIONS_LANG_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
234 |
{ WWT_CLOSEBOX, 14, 338, 348, 119, 128, STR_0225, STR_OPTIONS_LANG_TIP}, |
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
235 |
|
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
236 |
{ WWT_FRAME, 14, 10, 179, 146, 190, STR_OPTIONS_RES, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
237 |
{ WWT_6, 14, 20, 169, 160, 171, STR_OPTIONS_RES_CBO, STR_OPTIONS_RES_TIP}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
238 |
{ WWT_CLOSEBOX, 14, 158, 168, 161, 170, STR_0225, STR_OPTIONS_RES_TIP}, |
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
239 |
{ WWT_TEXTBTN, 14, 149, 169, 176, 184, STR_EMPTY, STR_OPTIONS_FULLSCREEN_TIP}, |
0 | 240 |
|
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
241 |
{ WWT_FRAME, 14, 190, 359, 146, 190, STR_OPTIONS_SCREENSHOT_FORMAT, STR_NULL}, |
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
242 |
{ WWT_6, 14, 200, 349, 160, 171, STR_OPTIONS_SCREENSHOT_FORMAT_CBO, STR_OPTIONS_SCREENSHOT_FORMAT_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
243 |
{ WWT_CLOSEBOX, 14, 338, 348, 161, 170, STR_0225, STR_OPTIONS_SCREENSHOT_FORMAT_TIP}, |
0 | 244 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
245 |
{ WIDGETS_END}, |
0 | 246 |
}; |
247 |
||
248 |
static const WindowDesc _game_options_desc = { |
|
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
249 |
WDP_CENTER, WDP_CENTER, 370, 239, |
0 | 250 |
WC_GAME_OPTIONS,0, |
251 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS, |
|
252 |
_game_options_widgets, |
|
253 |
GameOptionsWndProc |
|
254 |
}; |
|
255 |
||
256 |
||
257 |
void ShowGameOptions() |
|
258 |
{ |
|
259 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
260 |
AllocateWindowDesc(&_game_options_desc); |
|
261 |
} |
|
262 |
||
263 |
typedef struct { |
|
264 |
int16 min; |
|
265 |
int16 max; |
|
266 |
int16 step; |
|
267 |
StringID str; |
|
268 |
} GameSettingData; |
|
269 |
||
270 |
static const GameSettingData _game_setting_info[] = { |
|
271 |
{0,7,1,0}, |
|
272 |
{0,3,1,STR_6830_IMMEDIATE}, |
|
273 |
{0,2,1,STR_6816_LOW}, |
|
61
cd2827156f2a
(svn r62) - Added "None" as option for number of industries in difficulty settings
orudge
parents:
58
diff
changeset
|
274 |
{0,3,1,STR_26816_NONE}, |
0 | 275 |
{100,500,50,0}, |
276 |
{2,4,1,0}, |
|
277 |
{0,2,1,STR_6820_LOW}, |
|
278 |
{0,4,1,STR_681B_VERY_SLOW}, |
|
279 |
{0,2,1,STR_6820_LOW}, |
|
280 |
{0,2,1,STR_6823_NONE}, |
|
281 |
{0,3,1,STR_6826_X1_5}, |
|
282 |
{0,2,1,STR_6820_LOW}, |
|
283 |
{0,3,1,STR_682A_VERY_FLAT}, |
|
284 |
{0,3,1,STR_VERY_LOW}, |
|
285 |
{0,1,1,STR_682E_STEADY}, |
|
286 |
{0,1,1,STR_6834_AT_END_OF_LINE_AND_AT_STATIONS}, |
|
287 |
{0,1,1,STR_6836_OFF}, |
|
288 |
{0,2,1,STR_6839_PERMISSIVE}, |
|
289 |
}; |
|
290 |
||
291 |
static bool FORCEINLINE GetBitAndShift(uint32 *b) |
|
292 |
{ |
|
293 |
uint32 x = *b; |
|
294 |
*b >>= 1; |
|
295 |
return (x&1) != 0; |
|
296 |
} |
|
297 |
||
298 |
static GameOptions _opt_mod_temp; |
|
299 |
||
300 |
static const int16 _default_game_diff[3][GAME_DIFFICULTY_NUM] = { |
|
61
cd2827156f2a
(svn r62) - Added "None" as option for number of industries in difficulty settings
orudge
parents:
58
diff
changeset
|
301 |
{2, 2, 1, 3, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, |
cd2827156f2a
(svn r62) - Added "None" as option for number of industries in difficulty settings
orudge
parents:
58
diff
changeset
|
302 |
{4, 1, 1, 2, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, |
cd2827156f2a
(svn r62) - Added "None" as option for number of industries in difficulty settings
orudge
parents:
58
diff
changeset
|
303 |
{7, 0, 2, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, |
0 | 304 |
}; |
305 |
||
306 |
void SetDifficultyLevel(int mode, GameOptions *gm_opt) |
|
307 |
{ |
|
308 |
int i; |
|
309 |
assert(mode <= 3); |
|
310 |
||
311 |
gm_opt->diff_level = mode; |
|
312 |
if (mode != 3) { // not custom |
|
313 |
for(i = 0; i != GAME_DIFFICULTY_NUM; i++) |
|
314 |
((int*)&gm_opt->diff)[i] = _default_game_diff[mode][i]; |
|
315 |
} |
|
316 |
} |
|
317 |
||
46
c9bdf1d58df6
(svn r47) -Fix StartupEconomy warning in settings_gui.c
darkvater
parents:
42
diff
changeset
|
318 |
extern void StartupEconomy(); |
c9bdf1d58df6
(svn r47) -Fix StartupEconomy warning in settings_gui.c
darkvater
parents:
42
diff
changeset
|
319 |
|
0 | 320 |
static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
321 |
{ |
|
322 |
switch(e->event) { |
|
323 |
case WE_PAINT: { |
|
324 |
uint32 click_a, click_b, disabled; |
|
325 |
int i; |
|
326 |
int x,y,value; |
|
327 |
||
328 |
w->click_state = (1 << 4) << _opt_mod_temp.diff_level; |
|
329 |
w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7); |
|
330 |
DrawWindowWidgets(w); |
|
331 |
||
332 |
click_a = _difficulty_click_a; |
|
333 |
click_b = _difficulty_click_b; |
|
334 |
||
335 |
disabled = _game_mode == GM_NORMAL ? 0x383E : 0; |
|
336 |
// XXX |
|
337 |
||
338 |
x = 0; |
|
339 |
y = 32; |
|
340 |
for (i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
|
341 |
DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, GetBitAndShift(&click_a)?0x20:0); |
|
342 |
DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, GetBitAndShift(&click_b)?0x20:0); |
|
343 |
if (GetBitAndShift(&disabled)) { |
|
344 |
int color = 0x8000 | _color_list[3].unk2; |
|
345 |
GfxFillRect(x+6, y+2, x+6+8, y+9, color); |
|
346 |
GfxFillRect(x+16, y+2, x+16+8, y+9, color); |
|
347 |
} |
|
348 |
||
349 |
DrawStringCentered(x+10, y+1, STR_6819, 0); |
|
350 |
DrawStringCentered(x+20, y+1, STR_681A, 0); |
|
351 |
||
352 |
||
353 |
value = _game_setting_info[i].str + ((int*)&_opt_mod_temp.diff)[i]; |
|
354 |
if (i == 4) value *= 1000; // handle currency option |
|
355 |
SET_DPARAM32(0, value); |
|
356 |
DrawString(x+30, y+1, STR_6805_MAXIMUM_NO_COMPETITORS + i, 0); |
|
357 |
||
358 |
y += 11; |
|
359 |
} |
|
360 |
} break; |
|
361 |
||
362 |
case WE_CLICK: |
|
363 |
switch(e->click.widget) { |
|
364 |
case 3: { |
|
365 |
int x,y; |
|
366 |
uint btn, dis; |
|
367 |
int val; |
|
368 |
const GameSettingData *info; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
369 |
|
0 | 370 |
x = e->click.pt.x - 5; |
371 |
if (!IS_INT_INSIDE(x, 0, 21)) |
|
372 |
return; |
|
373 |
||
374 |
y = e->click.pt.y - 33; |
|
375 |
if (y < 0) |
|
376 |
return; |
|
377 |
||
378 |
// Get button from Y coord. |
|
379 |
btn = y / 11; |
|
380 |
if (btn >= GAME_DIFFICULTY_NUM || y % 11 > 9) |
|
381 |
return; |
|
382 |
||
383 |
// Clicked disabled button? |
|
384 |
dis = 0; |
|
385 |
if (_game_mode == GM_NORMAL) |
|
386 |
dis |= 0x383E; |
|
387 |
if (HASBIT(dis, btn)) |
|
388 |
return; |
|
389 |
||
390 |
_difficulty_timeout = 5; |
|
391 |
||
392 |
val = ((int*)&_opt_mod_temp.diff)[btn]; |
|
393 |
||
394 |
info = &_game_setting_info[btn]; |
|
395 |
if (x >= 10) { |
|
396 |
// Increase button clicked |
|
397 |
val = min(val + info->step, info->max); |
|
398 |
SETBIT(_difficulty_click_b, btn); |
|
399 |
} else { |
|
400 |
// Decrease button clicked |
|
401 |
val = max(val - info->step, info->min); |
|
402 |
SETBIT(_difficulty_click_a, btn); |
|
403 |
} |
|
404 |
||
405 |
// save value in temporary variable |
|
406 |
((int*)&_opt_mod_temp.diff)[btn] = val; |
|
407 |
SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
|
408 |
SetWindowDirty(w); |
|
409 |
break; |
|
410 |
} |
|
411 |
case 4: case 5: case 6: case 7: // easy/medium/hard/custom |
|
412 |
// temporarily change difficulty level |
|
413 |
SetDifficultyLevel(e->click.widget - 4, &_opt_mod_temp); |
|
414 |
SetWindowDirty(w); |
|
415 |
break; |
|
416 |
case 8: |
|
417 |
ShowHighscoreTable(_opt_mod_ptr->diff_level); |
|
418 |
break; |
|
419 |
case 10: { // Save button - save changes |
|
420 |
int btn, val; |
|
421 |
for (btn = 0; btn != GAME_DIFFICULTY_NUM; btn++) { |
|
422 |
val = ((int*)&_opt_mod_temp.diff)[btn]; |
|
423 |
// if setting has changed, change it |
|
424 |
if (val != ((int*)&_opt_mod_ptr->diff)[btn]) |
|
425 |
DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
|
426 |
} |
|
427 |
DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
|
428 |
DeleteWindow(w); |
|
42
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
429 |
// If we are in the editor, we should reload the economy. |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
430 |
// This way when you load a game, the max loan and interest rate |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
431 |
// are loaded correctly. |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
432 |
if (_game_mode == GM_EDITOR) |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
433 |
StartupEconomy(); |
0 | 434 |
break; |
435 |
} |
|
436 |
case 11: // Cancel button - close window |
|
437 |
DeleteWindow(w); |
|
438 |
break; |
|
439 |
} |
|
440 |
break; |
|
441 |
||
442 |
case WE_MOUSELOOP: |
|
443 |
if (_difficulty_timeout != 0 && !--_difficulty_timeout) { |
|
444 |
_difficulty_click_a = 0; |
|
445 |
_difficulty_click_b = 0; |
|
446 |
SetWindowDirty(w); |
|
447 |
} |
|
448 |
break; |
|
449 |
} |
|
450 |
} |
|
451 |
||
452 |
static const Widget _game_difficulty_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
453 |
{ WWT_CLOSEBOX, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
454 |
{ WWT_CAPTION, 10, 11, 369, 0, 13, STR_6800_DIFFICULTY_LEVEL, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
455 |
{ WWT_PANEL, 10, 0, 369, 14, 29, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
456 |
{ WWT_PANEL, 10, 0, 369, 30, 276, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
457 |
{ WWT_PUSHTXTBTN, 3, 10, 96, 16, 27, STR_6801_EASY, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
458 |
{ WWT_PUSHTXTBTN, 3, 97, 183, 16, 27, STR_6802_MEDIUM, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
459 |
{ WWT_PUSHTXTBTN, 3, 184, 270, 16, 27, STR_6803_HARD, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
460 |
{ WWT_PUSHTXTBTN, 3, 271, 357, 16, 27, STR_6804_CUSTOM, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
461 |
{ WWT_EMPTY, 10, 0, 369, 251, 262, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
462 |
//{ WWT_CLOSEBOX, 10, 0, 369, 251, 262, STR_6838_SHOW_HI_SCORE_CHART,STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
463 |
{ WWT_PANEL, 10, 0, 369, 263, 278, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
464 |
{ WWT_PUSHTXTBTN, 3, 105, 185, 265, 276, STR_OPTIONS_SAVE_CHANGES, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
465 |
{ WWT_PUSHTXTBTN, 3, 186, 266, 265, 276, STR_012E_CANCEL, STR_NULL}, |
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 const WindowDesc _game_difficulty_desc = { |
|
470 |
WDP_CENTER, WDP_CENTER, 370, 279, |
|
471 |
WC_GAME_OPTIONS,0, |
|
472 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
473 |
_game_difficulty_widgets, |
|
474 |
GameDifficultyWndProc |
|
475 |
}; |
|
476 |
||
477 |
void ShowGameDifficulty() |
|
478 |
{ |
|
479 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
480 |
/* copy current settings to temporary holding place |
|
481 |
* change that when setting stuff, copy back on clicking 'OK' |
|
482 |
*/ |
|
483 |
memcpy(&_opt_mod_temp, _opt_mod_ptr, sizeof(GameOptions)); |
|
484 |
AllocateWindowDesc(&_game_difficulty_desc); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
485 |
} |
0 | 486 |
|
487 |
void ShowHighscoreTable(int tbl) |
|
488 |
{ |
|
489 |
ShowInfoF("ShowHighscoreTable(%d) not implemented", tbl); |
|
490 |
} |
|
491 |
||
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
492 |
// virtual PositionMainToolbar function, calls the right one. |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
493 |
int32 v_PositionMainToolbar(int32 p1) |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
494 |
{ |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
495 |
if (_game_mode != GM_MENU) |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
496 |
PositionMainToolbar(NULL); |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
497 |
|
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
498 |
return 0; |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
499 |
} |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
500 |
|
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
501 |
int32 AiNew_PatchActive_Warning(int32 p1) |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
502 |
{ |
155
81e9878f3678
(svn r156) -Codechange: remove obsolete callback arrays
darkvater
parents:
91
diff
changeset
|
503 |
if (p1 == 1) |
81e9878f3678
(svn r156) -Codechange: remove obsolete callback arrays
darkvater
parents:
91
diff
changeset
|
504 |
ShowErrorMessage(-1, TEMP_AI_ACTIVATED, 0, 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
505 |
|
155
81e9878f3678
(svn r156) -Codechange: remove obsolete callback arrays
darkvater
parents:
91
diff
changeset
|
506 |
return 0; |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
507 |
} |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
508 |
|
91
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
509 |
int32 InvisibleTreesActive(int32 p1) |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
510 |
{ |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
511 |
MarkWholeScreenDirty(); |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
512 |
return 0; |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
513 |
} |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
514 |
|
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
515 |
int32 InValidateDetailsWindow(int32 p1) |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
516 |
{ |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
517 |
InvalidateWindowClasses(WC_VEHICLE_DETAILS); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
518 |
return 0; |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
519 |
} |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
520 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
521 |
/* Check service intervals of vehicles, p1 is value of % or day based servicing */ |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
522 |
int32 CheckInterval(int32 p1) |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
523 |
{ |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
524 |
bool warning; |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
525 |
if (p1) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
526 |
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 5, 90+1) || _patches.servint_trains == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
527 |
(IS_INT_INSIDE(_patches.servint_roadveh, 5, 90+1) || _patches.servint_roadveh == 0) && |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
528 |
(IS_INT_INSIDE(_patches.servint_aircraft, 5, 90+1) || _patches.servint_aircraft == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
529 |
(IS_INT_INSIDE(_patches.servint_ships, 5, 90+1) || _patches.servint_ships == 0) ); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
530 |
} else { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
531 |
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 30, 800+1) || _patches.servint_trains == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
532 |
(IS_INT_INSIDE(_patches.servint_roadveh, 30, 800+1) || _patches.servint_roadveh == 0) && |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
533 |
(IS_INT_INSIDE(_patches.servint_aircraft, 30, 800+1) || _patches.servint_aircraft == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
534 |
(IS_INT_INSIDE(_patches.servint_ships, 30, 800+1) || _patches.servint_ships == 0) ); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
535 |
} |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
536 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
537 |
if (!warning) |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
538 |
ShowErrorMessage(-1, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
539 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
540 |
return InValidateDetailsWindow(0); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
541 |
} |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
542 |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
543 |
typedef int32 PatchButtonClick(int32); |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
544 |
|
0 | 545 |
typedef struct PatchEntry { |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
546 |
byte type; // type of selector |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
547 |
byte flags; // selector flags |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
548 |
StringID str; // string with descriptive text |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
549 |
void *variable; // pointer to the variable |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
550 |
int32 min,max; // range for spinbox setting |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
551 |
uint32 step; // step for spinbox |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
552 |
PatchButtonClick *click_proc; // callback procedure |
0 | 553 |
} PatchEntry; |
554 |
||
555 |
enum { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
556 |
PE_BOOL = 0, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
557 |
PE_UINT8 = 1, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
558 |
PE_INT16 = 2, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
559 |
PE_UINT16 = 3, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
560 |
PE_INT32 = 4, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
561 |
PE_CURRENCY = 5, |
0 | 562 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
563 |
PF_0ISDIS = 1, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
564 |
PF_NOCOMMA = 2, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
565 |
PF_MULTISTRING = 4, |
0 | 566 |
}; |
567 |
||
568 |
static const PatchEntry _patches_ui[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
569 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_VEHICLESPEED, &_patches.vehicle_speed, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
570 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_LONGDATE, &_patches.status_long_date, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
571 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SHOWFINANCES, &_patches.show_finances, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
572 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AUTOSCROLL, &_patches.autoscroll, 0, 0, 0, NULL}, |
0 | 573 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
574 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION, &_patches.errmsg_duration, 0, 20, 1, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
575 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
576 |
{PE_UINT8, PF_MULTISTRING, STR_CONFIG_PATCHES_TOOLBAR_POS, &_patches.toolbar_pos, 0, 2, 1, &v_PositionMainToolbar}, |
350 | 577 |
{PE_UINT8, PF_0ISDIS, STR_CONFIG_PATCHES_SNAP_RADIUS, &_patches.window_snap_radius, 1, 32, 1, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
578 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_INVISIBLE_TREES, &_patches.invisible_trees, 0, 1, 1, &InvisibleTreesActive}, |
0 | 579 |
}; |
580 |
||
581 |
static const PatchEntry _patches_construction[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
582 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_BUILDONSLOPES, &_patches.build_on_slopes, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
583 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_EXTRADYNAMITE, &_patches.extra_dynamite, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
584 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_LONGBRIDGES, &_patches.longbridges, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
585 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SIGNALSIDE, &_patches.signal_side, 0, 0, 0, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
586 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
587 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SMALL_AIRPORTS, &_patches.always_small_airport, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
588 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY, &_patches.drag_signals_density, 1, 20, 1, NULL}, |
0 | 589 |
|
590 |
}; |
|
591 |
||
592 |
static const PatchEntry _patches_vehicles[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
593 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_REALISTICACCEL, &_patches.realistic_acceleration, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
594 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_MAMMOTHTRAINS, &_patches.mammoth_trains, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
595 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_GOTODEPOT, &_patches.gotodepot, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
596 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_ROADVEH_QUEUE, &_patches.roadveh_queue, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
597 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_DEPOT_FINDING,&_patches.new_depot_finding, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
598 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_TRAIN_PATHFIND, &_patches.new_pathfinding, 0, 0, 0, NULL}, |
0 | 599 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
600 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_WARN_INCOME_LESS, &_patches.train_income_warn, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
601 |
{PE_UINT8, PF_MULTISTRING, STR_CONFIG_PATCHES_ORDER_REVIEW,&_patches.order_review_system,0,2, 1, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
602 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES, &_patches.never_expire_vehicles,0,0,0, NULL}, |
0 | 603 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
604 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_LOST_TRAIN_DAYS, &_patches.lost_train_days, 180,720, 60, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
605 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE,&_patches.autorenew, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
606 |
{PE_INT16, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, &_patches.autorenew_months, -12, 12, 1, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
607 |
{PE_CURRENCY, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY,&_patches.autorenew_money, 0, 2000000, 100000, NULL}, |
0 | 608 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
609 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_TRAINS, &_patches.max_trains, 0,240, 10, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
610 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, &_patches.max_roadveh, 0,240, 10, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
611 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, &_patches.max_aircraft, 0,240, 10, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
612 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_MAX_SHIPS, &_patches.max_ships, 0,240, 10, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
613 |
|
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
614 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVINT_ISPERCENT,&_patches.servint_ispercent, 0, 0, 0, &CheckInterval}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
615 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_TRAINS, &_patches.servint_trains, 5,800, 5, &InValidateDetailsWindow}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
616 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_ROADVEH, &_patches.servint_roadveh, 5,800, 5, &InValidateDetailsWindow}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
617 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, &_patches.servint_aircraft, 5,800, 5, &InValidateDetailsWindow}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
618 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_SHIPS, &_patches.servint_ships, 5,800, 5, &InValidateDetailsWindow}, |
0 | 619 |
}; |
620 |
||
621 |
static const PatchEntry _patches_stations[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
622 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_JOINSTATIONS, &_patches.join_stations, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
623 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_FULLLOADANY, &_patches.full_load_any, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
624 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SELECTGOODS, &_patches.selectgoods, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
625 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_NONSTOP, &_patches.new_nonstop, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
626 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NONUNIFORM_STATIONS, &_patches.nonuniform_stations, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
627 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_STATION_SPREAD, &_patches.station_spread, 4, 64, 1, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
628 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVICEATHELIPAD, &_patches.serviceathelipad, 0, 0, 0, NULL}, |
0 | 629 |
}; |
630 |
||
631 |
static const PatchEntry _patches_economy[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
632 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_INFLATION, &_patches.inflation, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
633 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_BUILDXTRAIND, &_patches.build_rawmaterial_ind, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
634 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_MULTIPINDTOWN, &_patches.multiple_industry_per_town,0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
635 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SAMEINDCLOSE, &_patches.same_industry_close, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
636 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_BRIBE, &_patches.bribe, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
637 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, &_patches.snow_line_height, 2, 13, 1, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
638 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
639 |
{PE_INT32, PF_NOCOMMA, STR_CONFIG_PATCHES_COLORED_NEWS_DATE, &_patches.colored_news_date, 1900, 2200, 5, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
640 |
{PE_INT32, PF_NOCOMMA, STR_CONFIG_PATCHES_STARTING_DATE, &_patches.starting_date, 1920,2100, 1, NULL}, |
0 | 641 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
642 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, &_patches.smooth_economy, 0, 0, 0, NULL}, |
0 | 643 |
}; |
644 |
||
21 | 645 |
static const PatchEntry _patches_ai[] = { |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
646 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AINEW_ACTIVE, &_patches.ainew_active, 0, 1, 1, &AiNew_PatchActive_Warning}, |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
647 |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
648 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, &_patches.ai_disable_veh_train, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
649 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,&_patches.ai_disable_veh_roadveh, 0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
650 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT, &_patches.ai_disable_veh_aircraft,0, 0, 0, NULL}, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
651 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS, &_patches.ai_disable_veh_ship, 0, 0, 0, NULL}, |
21 | 652 |
}; |
653 |
||
0 | 654 |
typedef struct PatchPage { |
655 |
const PatchEntry *entries; |
|
656 |
uint num; |
|
657 |
} PatchPage; |
|
658 |
||
659 |
static const PatchPage _patches_page[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
660 |
{_patches_ui, lengthof(_patches_ui) }, |
0 | 661 |
{_patches_construction, lengthof(_patches_construction) }, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
662 |
{_patches_vehicles, lengthof(_patches_vehicles) }, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
663 |
{_patches_stations, lengthof(_patches_stations) }, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
664 |
{_patches_economy, lengthof(_patches_economy) }, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
665 |
{_patches_ai, lengthof(_patches_ai) }, |
0 | 666 |
}; |
667 |
||
26 | 668 |
extern uint GetCurrentCurrencyRate(); |
669 |
||
0 | 670 |
static int32 ReadPE(const PatchEntry*pe) |
671 |
{ |
|
672 |
switch(pe->type) { |
|
673 |
case PE_BOOL: return *(bool*)pe->variable; |
|
674 |
case PE_UINT8: return *(uint8*)pe->variable; |
|
675 |
case PE_INT16: return *(int16*)pe->variable; |
|
676 |
case PE_UINT16: return *(uint16*)pe->variable; |
|
677 |
case PE_INT32: return *(int32*)pe->variable; |
|
26 | 678 |
case PE_CURRENCY: return (*(int64*)pe->variable) * GetCurrentCurrencyRate(); |
0 | 679 |
default: |
680 |
NOT_REACHED(); |
|
681 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
682 |
|
0 | 683 |
/* useless, but avoids compiler warning this way */ |
684 |
return 0; |
|
685 |
} |
|
686 |
||
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
687 |
static void WritePE(const PatchEntry *pe, int32 val) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
688 |
{ |
48
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
689 |
|
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
690 |
if ((pe->flags & PF_0ISDIS) && val <= 0) { |
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
691 |
*(bool*)pe->variable = 0; // "clamp" 'disabled' value to smallest type, PE_BOOL |
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
692 |
return; |
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
693 |
} |
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
694 |
|
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
695 |
switch(pe->type) { |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
696 |
case PE_BOOL: *(bool*)pe->variable = (bool)val; break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
697 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
698 |
case PE_UINT8: if ((uint8)val > (uint8)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
699 |
*(uint8*)pe->variable = (uint8)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
700 |
else if ((uint8)val < (uint8)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
701 |
*(uint8*)pe->variable = (uint8)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
702 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
703 |
*(uint8*)pe->variable = (uint8)val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
704 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
705 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
706 |
case PE_INT16: if ((int16)val > (int16)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
707 |
*(int16*)pe->variable = (int16)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
708 |
else if ((int16)val < (int16)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
709 |
*(int16*)pe->variable = (int16)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
710 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
711 |
*(int16*)pe->variable = (int16)val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
712 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
713 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
714 |
case PE_UINT16: if ((uint16)val > (uint16)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
715 |
*(uint16*)pe->variable = (uint16)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
716 |
else if ((uint16)val < (uint16)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
717 |
*(uint16*)pe->variable = (uint16)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
718 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
719 |
*(uint16*)pe->variable = (uint16)val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
720 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
721 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
722 |
case PE_INT32: if ((int32)val > (int32)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
723 |
*(int32*)pe->variable = (int32)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
724 |
else if ((int32)val < (int32)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
725 |
*(int32*)pe->variable = (int32)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
726 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
727 |
*(int32*)pe->variable = val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
728 |
break; |
26 | 729 |
|
730 |
case PE_CURRENCY: val /= GetCurrentCurrencyRate(); |
|
731 |
if ((int64)val > (int64)pe->max) |
|
732 |
*(int64*)pe->variable = (int64)pe->max; |
|
733 |
else if ((int64)val < (int64)pe->min) |
|
734 |
*(int64*)pe->variable = (int64)pe->min; |
|
735 |
else |
|
736 |
*(int64*)pe->variable = val; |
|
737 |
break; |
|
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
738 |
default: |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
739 |
NOT_REACHED(); |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
740 |
} |
0 | 741 |
} |
742 |
||
743 |
static void PatchesSelectionWndProc(Window *w, WindowEvent *e) |
|
744 |
{ |
|
745 |
uint i; |
|
746 |
switch(e->event) { |
|
747 |
case WE_PAINT: { |
|
748 |
int x,y; |
|
749 |
const PatchEntry *pe; |
|
750 |
const PatchPage *page; |
|
751 |
uint clk; |
|
752 |
int32 val; |
|
753 |
||
754 |
w->click_state = 1 << (WP(w,def_d).data_1 + 4); |
|
755 |
||
756 |
DrawWindowWidgets(w); |
|
757 |
||
758 |
x = 0; |
|
759 |
y = 46; |
|
760 |
clk = WP(w,def_d).data_2; |
|
761 |
page = &_patches_page[WP(w,def_d).data_1]; |
|
762 |
for(i=0,pe=page->entries; i!=page->num; i++,pe++) { |
|
11
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
763 |
bool disabled = false; |
0 | 764 |
if (pe->type == PE_BOOL) { |
765 |
DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable)?6:4, (*(bool*)pe->variable)?0x20:0); |
|
766 |
SET_DPARAM16(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
|
767 |
} else { |
|
768 |
DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, clk == i*2+1 ? 0x20 : 0); |
|
769 |
DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, clk == i*2+2 ? 0x20 : 0); |
|
770 |
DrawStringCentered(x+10, y+1, STR_6819, 0); |
|
771 |
DrawStringCentered(x+20, y+1, STR_681A, 0); |
|
772 |
||
773 |
val = ReadPE(pe); |
|
26 | 774 |
if (pe->type == PE_CURRENCY) |
775 |
val /= GetCurrentCurrencyRate(); |
|
11
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
776 |
disabled = ((val == 0) && (pe->flags & PF_0ISDIS)); |
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
777 |
if (disabled) { |
0 | 778 |
SET_DPARAM16(0, STR_CONFIG_PATCHES_DISABLED); |
779 |
} else { |
|
780 |
SET_DPARAM32(1, val); |
|
26 | 781 |
if (pe->type == PE_CURRENCY) |
782 |
SET_DPARAM16(0, STR_CONFIG_PATCHES_CURRENCY); |
|
53
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
783 |
else { |
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
784 |
if (pe->flags & PF_MULTISTRING) |
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
785 |
SET_DPARAM16(0, pe->str + val + 1); |
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
786 |
else |
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
787 |
SET_DPARAM16(0, pe->flags & PF_NOCOMMA ? STR_CONFIG_PATCHES_INT32 : STR_7024); |
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
788 |
} |
0 | 789 |
} |
790 |
} |
|
11
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
791 |
DrawString(30, y+1, (pe->str)+disabled, 0); |
0 | 792 |
y += 11; |
793 |
} |
|
794 |
break; |
|
795 |
} |
|
796 |
||
797 |
case WE_CLICK: |
|
798 |
switch(e->click.widget) { |
|
799 |
case 3: { |
|
800 |
int x,y; |
|
801 |
uint btn; |
|
802 |
const PatchPage *page; |
|
803 |
const PatchEntry *pe; |
|
804 |
||
805 |
y = e->click.pt.y - 46 - 1; |
|
806 |
if (y < 0) return; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
807 |
|
0 | 808 |
btn = y / 11; |
809 |
if (y % 11 > 9) return; |
|
810 |
||
811 |
page = &_patches_page[WP(w,def_d).data_1]; |
|
812 |
if (btn >= page->num) return; |
|
813 |
pe = &page->entries[btn]; |
|
814 |
||
815 |
x = e->click.pt.x - 5; |
|
816 |
if (x < 0) return; |
|
817 |
||
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
818 |
if (x < 21) { // clicked on the icon on the left side. Either scroller or bool on/off |
0 | 819 |
int32 val = ReadPE(pe), oval = val; |
820 |
||
821 |
switch(pe->type) { |
|
822 |
case PE_BOOL: |
|
823 |
val ^= 1; |
|
824 |
break; |
|
825 |
case PE_UINT8: |
|
826 |
case PE_INT16: |
|
827 |
case PE_UINT16: |
|
828 |
case PE_INT32: |
|
26 | 829 |
case PE_CURRENCY: |
0 | 830 |
// don't allow too fast scrolling |
831 |
if ((w->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) { |
|
832 |
_left_button_clicked = false; |
|
833 |
return; |
|
834 |
} |
|
835 |
||
836 |
if (x >= 10) { |
|
837 |
//increase |
|
838 |
if (pe->flags & PF_0ISDIS && val == 0) |
|
839 |
val = pe->min; |
|
840 |
else |
|
841 |
val += pe->step; |
|
842 |
if (val > pe->max) val = pe->max; |
|
843 |
} else { |
|
47
8368e4d4ef07
(svn r48) Fix: Possible to disable some patches (e.g. default service interval) again by setting them to 0
dominik
parents:
46
diff
changeset
|
844 |
// decrease |
0 | 845 |
if (val <= pe->min && pe->flags & PF_0ISDIS) { |
846 |
val = 0; |
|
847 |
} else { |
|
848 |
val -= pe->step; |
|
849 |
if (val < pe->min) val = pe->min; |
|
850 |
} |
|
851 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
852 |
|
0 | 853 |
if (val != oval) { |
854 |
WP(w,def_d).data_2 = btn * 2 + 1 + ((x>=10) ? 1 : 0); |
|
855 |
w->flags4 |= 5 << WF_TIMEOUT_SHL; |
|
856 |
_left_button_clicked = false; |
|
857 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
858 |
break; |
0 | 859 |
} |
860 |
if (val != oval) { |
|
861 |
WritePE(pe, val); |
|
862 |
SetWindowDirty(w); |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
863 |
|
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
864 |
if (pe->click_proc != NULL) // call callback function |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
865 |
pe->click_proc(val); |
0 | 866 |
} |
867 |
} else { |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
868 |
if (pe->type != PE_BOOL && !(pe->flags & PF_MULTISTRING)) { // do not open editbox |
0 | 869 |
WP(w,def_d).data_3 = btn; |
870 |
SET_DPARAM32(0, ReadPE(pe)); |
|
871 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, WC_GAME_OPTIONS, 0); |
|
872 |
} |
|
873 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
874 |
|
0 | 875 |
break; |
876 |
} |
|
21 | 877 |
case 4: case 5: case 6: case 7: case 8: case 9: |
0 | 878 |
WP(w,def_d).data_1 = e->click.widget - 4; |
879 |
DeleteWindowById(WC_QUERY_STRING, 0); |
|
880 |
SetWindowDirty(w); |
|
881 |
break; |
|
882 |
} |
|
883 |
break; |
|
884 |
||
885 |
case WE_TIMEOUT: |
|
886 |
WP(w,def_d).data_2 = 0; |
|
887 |
SetWindowDirty(w); |
|
888 |
break; |
|
889 |
||
890 |
case WE_ON_EDIT_TEXT: { |
|
891 |
if (*e->edittext.str) { |
|
892 |
const PatchPage *page = &_patches_page[WP(w,def_d).data_1]; |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
893 |
const PatchEntry *pe = &page->entries[WP(w,def_d).data_3]; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
894 |
WritePE(pe, atoi(e->edittext.str)); |
0 | 895 |
SetWindowDirty(w); |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
896 |
|
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
897 |
if (pe->click_proc != NULL) // call callback function |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
898 |
pe->click_proc(*(int32*)pe->variable); |
0 | 899 |
} |
900 |
break; |
|
901 |
} |
|
902 |
||
903 |
case WE_DESTROY: |
|
904 |
DeleteWindowById(WC_QUERY_STRING, 0); |
|
905 |
break; |
|
906 |
} |
|
907 |
} |
|
908 |
||
909 |
static const Widget _patches_selection_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
910 |
{ WWT_CLOSEBOX, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
911 |
{ WWT_CAPTION, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
912 |
{ WWT_PANEL, 10, 0, 369, 14, 41, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
913 |
{ WWT_PANEL, 10, 0, 369, 42, 320, 0x0, STR_NULL}, |
0 | 914 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
915 |
{ WWT_CLOSEBOX, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
916 |
{ WWT_CLOSEBOX, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
917 |
{ WWT_CLOSEBOX, 3, 184, 270, 16, 27, STR_CONFIG_PATCHES_VEHICLES, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
918 |
{ WWT_CLOSEBOX, 3, 271, 357, 16, 27, STR_CONFIG_PATCHES_STATIONS, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
919 |
{ WWT_CLOSEBOX, 3, 10, 96, 28, 39, STR_CONFIG_PATCHES_ECONOMY, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
920 |
{ WWT_CLOSEBOX, 3, 97, 183, 28, 39, STR_CONFIG_PATCHES_AI, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
921 |
{ WIDGETS_END}, |
0 | 922 |
}; |
923 |
||
924 |
static const WindowDesc _patches_selection_desc = { |
|
925 |
WDP_CENTER, WDP_CENTER, 370, 321, |
|
926 |
WC_GAME_OPTIONS,0, |
|
927 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
928 |
_patches_selection_widgets, |
|
929 |
PatchesSelectionWndProc, |
|
930 |
}; |
|
931 |
||
932 |
void ShowPatchesSelection() |
|
933 |
{ |
|
934 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
935 |
AllocateWindowDesc(&_patches_selection_desc); |
|
936 |
} |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
937 |
|
484 | 938 |
struct GRFFile *_sel_grffile; |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
939 |
|
484 | 940 |
enum { |
941 |
NEwGRF_WND_PROC_OFFSET_TOP_WIDGET = 14, |
|
942 |
NEWGRF_WND_PROC_ROWSIZE = 14 |
|
943 |
}; |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
944 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
945 |
static void NewgrfWndProc(Window *w, WindowEvent *e) |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
946 |
{ |
484 | 947 |
switch (e->event) { |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
948 |
case WE_PAINT: { |
484 | 949 |
int x, y = NEwGRF_WND_PROC_OFFSET_TOP_WIDGET; |
950 |
uint16 i = 0; |
|
951 |
struct GRFFile *c = _first_grffile; |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
952 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
953 |
DrawWindowWidgets(w); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
954 |
|
484 | 955 |
if (_first_grffile == NULL) { // no grf sets installed |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
956 |
DrawStringMultiCenter(140, 240, STR_NEWGRF_NO_FILES_INSTALLED, 250); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
957 |
break; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
958 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
959 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
960 |
// draw list of all grf files |
484 | 961 |
while (c != NULL) { |
962 |
if (i >= w->vscroll.pos) { // draw files according to scrollbar position |
|
963 |
DrawSprite(SPRITE_PALETTE(0x2EB | 0x30b8000), 5, y + 3); |
|
964 |
// give highlighted item other colour |
|
965 |
// XXX - will be grf name later |
|
966 |
DoDrawString(c->filename, 25, y + 2, (_sel_grffile == c) ? 0xC : 0x10); |
|
967 |
y += NEWGRF_WND_PROC_ROWSIZE; |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
968 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
969 |
|
484 | 970 |
c = c->next; |
971 |
if (++i == w->vscroll.cap + w->vscroll.pos) break; // stop after displaying 12 items |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
972 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
973 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
974 |
// DoDrawString(_sel_grffile->setname, 120, 200, 0x01); // draw grf name |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
975 |
|
484 | 976 |
if (_sel_grffile == NULL) { // no grf file selected yet |
977 |
DrawStringMultiCenter(140, 229, STR_NEWGRF_TIP, 250); |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
978 |
} else { |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
979 |
// draw filename |
484 | 980 |
x = DrawString(5, 199, STR_NEWGRF_FILENAME, 0); |
981 |
DoDrawString(_sel_grffile->filename, x + 2, 199, 0x01); |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
982 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
983 |
// draw grf id |
484 | 984 |
x = DrawString(5, 209, STR_NEWGRF_GRF_ID, 0); |
486
dadcb8d5a6bd
(svn r768) In the NewGRF manager, show GRF ids as 8-digit hex numbers (that's how they are supposed to look).
pasky
parents:
484
diff
changeset
|
985 |
snprintf(_userstring, USERSTRING_LEN, "%08X", _sel_grffile->grfid); |
dadcb8d5a6bd
(svn r768) In the NewGRF manager, show GRF ids as 8-digit hex numbers (that's how they are supposed to look).
pasky
parents:
484
diff
changeset
|
986 |
DrawString(x + 2, 209, STR_SPEC_USERSTRING, 0x01); |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
987 |
} |
484 | 988 |
} break; |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
989 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
990 |
case WE_CLICK: |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
991 |
switch(e->click.widget) { |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
992 |
case 2: { // select a grf file |
484 | 993 |
int y = (e->click.pt.y - NEwGRF_WND_PROC_OFFSET_TOP_WIDGET) / NEWGRF_WND_PROC_ROWSIZE; |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
994 |
|
484 | 995 |
if (y >= w->vscroll.cap) { return;} // click out of bounds |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
996 |
|
484 | 997 |
y += w->vscroll.pos; |
998 |
||
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
999 |
if (y >= _grffile_count) return; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1000 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1001 |
_sel_grffile = _first_grffile; |
484 | 1002 |
// get selected grf-file |
1003 |
while (y-- != 0) _sel_grffile = _sel_grffile->next; |
|
1004 |
||
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1005 |
SetWindowDirty(w); |
484 | 1006 |
} break; |
1007 |
case 9: /* Cancel button */ |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1008 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1009 |
break; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1010 |
} break; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1011 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1012 |
/* Parameter edit box not used yet |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1013 |
case WE_TIMEOUT: |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1014 |
WP(w,def_d).data_2 = 0; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1015 |
SetWindowDirty(w); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1016 |
break; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1017 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1018 |
case WE_ON_EDIT_TEXT: { |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1019 |
if (*e->edittext.str) { |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1020 |
SetWindowDirty(w); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1021 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1022 |
break; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1023 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1024 |
*/ |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1025 |
case WE_DESTROY: |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1026 |
DeleteWindowById(WC_QUERY_STRING, 0); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1027 |
break; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1028 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1029 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1030 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1031 |
static const Widget _newgrf_widgets[] = { |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1032 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1033 |
{ WWT_CAPTION, 14, 11, 279, 0, 13, STR_NEWGRF_SETINGS_CAPTION,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
484 | 1034 |
{ WWT_MATRIX, 14, 0, 268, 14, 182, 0xC01,/*small rows*/ STR_NEWGRF_TIP}, |
1035 |
{ WWT_PANEL, 14, 0, 279, 183, 321, 0x0, STR_NULL}, |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1036 |
|
484 | 1037 |
{ WWT_SCROLLBAR, 14, 269, 279, 14, 182, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1038 |
|
484 | 1039 |
{ WWT_CLOSEBOX, 14, 147, 158, 289, 300, STR_0188, STR_NULL}, |
1040 |
{ WWT_CLOSEBOX, 14, 159, 170, 289, 300, STR_0189, STR_NULL}, |
|
1041 |
{ WWT_CLOSEBOX, 14, 175, 274, 289, 300, STR_NEWGRF_SET_PARAMETERS, STR_NULL}, |
|
1042 |
||
1043 |
{ WWT_CLOSEBOX, 3, 5, 138, 306, 317, STR_NEWGRF_APPLY_CHANGES, STR_NULL}, |
|
1044 |
{ WWT_CLOSEBOX, 3, 142, 274, 306, 317, STR_012E_CANCEL, STR_NULL}, |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1045 |
{ WIDGETS_END}, |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1046 |
}; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1047 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1048 |
static const WindowDesc _newgrf_desc = { |
484 | 1049 |
WDP_CENTER, WDP_CENTER, 280, 322, |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1050 |
WC_GAME_OPTIONS,0, |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1051 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1052 |
_newgrf_widgets, |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1053 |
NewgrfWndProc, |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1054 |
}; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1055 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1056 |
void ShowNewgrf() |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1057 |
{ |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1058 |
Window *w; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1059 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1060 |
w = AllocateWindowDesc(&_newgrf_desc); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1061 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1062 |
{ // little helper function to calculate _grffile_count |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1063 |
// should be REMOVED once _grffile_count is calculated at loading |
484 | 1064 |
struct GRFFile *c = _first_grffile; |
1065 |
_grffile_count = 0; |
|
1066 |
while (c != NULL) { |
|
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1067 |
_grffile_count++; |
484 | 1068 |
c = c->next; |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1069 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1070 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1071 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1072 |
w->vscroll.cap = 12; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1073 |
w->vscroll.count = _grffile_count; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1074 |
w->vscroll.pos = 0; |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1075 |
w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7); |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1076 |
} |
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
1077 |