Mercurial > hg > openttd
annotate src/settings_gui.cpp @ 12778:bc7926153e19 draft
(svn r17248) -Fix: add GPL license notice where appropriate
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 21 Aug 2009 20:21:05 +0000 |
parents | 7a25de72eb71 |
children | dd7db20331f6 |
rev | line source |
---|---|
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
9 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
9092
diff
changeset
|
10 /** @file settings_gui.cpp GUI for settings. */ |
6420
080aae477331
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas <belugas@openttd.org>
parents:
6378
diff
changeset
|
11 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
12 #include "stdafx.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
13 #include "openttd.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
14 #include "currency.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
15 #include "gui.h" |
8107
f65cf2bc3255
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents:
8106
diff
changeset
|
16 #include "window_gui.h" |
f65cf2bc3255
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents:
8106
diff
changeset
|
17 #include "textbuf_gui.h" |
8116
9cc845deddfe
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
8114
diff
changeset
|
18 #include "command_func.h" |
8786
e2d4956b7251
(svn r12490) -Codechange: rename engine.h to engine_func.h and remove unneeded inclusions of engine.h and/or replace them with engine_type.h.
rubidium <rubidium@openttd.org>
parents:
8785
diff
changeset
|
19 #include "engine_func.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
20 #include "screenshot.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
21 #include "network/network.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
22 #include "town.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
23 #include "variables.h" |
8208
ddc34919158f
(svn r11771) -Codechange: split settings.h into better separated headers.
rubidium <rubidium@openttd.org>
parents:
8191
diff
changeset
|
24 #include "settings_internal.h" |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
25 #include "newgrf_townname.h" |
8114
2d6af5d7a142
(svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents:
8107
diff
changeset
|
26 #include "strings_func.h" |
8131
e300ac8001ae
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents:
8130
diff
changeset
|
27 #include "window_func.h" |
8214
6385dffc0b37
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium <rubidium@openttd.org>
parents:
8213
diff
changeset
|
28 #include "string_func.h" |
8224
c45446125bf0
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents:
8214
diff
changeset
|
29 #include "gfx_func.h" |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
30 #include "widgets/dropdown_type.h" |
8284
dbb7bfe0e95c
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138 <peter1138@openttd.org>
parents:
8264
diff
changeset
|
31 #include "widgets/dropdown_func.h" |
8785
2a8950a812dc
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents:
8648
diff
changeset
|
32 #include "station_func.h" |
10558
15517829eb17
(svn r14815) -Codechange: separate 'highscore' code from 'company' code
smatz <smatz@openttd.org>
parents:
10543
diff
changeset
|
33 #include "highscore.h" |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
12676
diff
changeset
|
34 #include "base_media_base.h" |
12022
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
35 #include "company_base.h" |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
36 #include "company_func.h" |
9581
9a3e1ee617ce
(svn r13618) -Codechange: move tar-specific declarations to separate file
smatz <smatz@openttd.org>
parents:
9533
diff
changeset
|
37 #include <map> |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
38 |
8264
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
39 #include "table/sprites.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
40 #include "table/strings.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
41 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
42 static const StringID _units_dropdown[] = { |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
43 STR_GAME_OPTIONS_MEASURING_UNITS_IMPERIAL, |
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
44 STR_GAME_OPTIONS_MEASURING_UNITS_METRIC, |
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
45 STR_GAME_OPTIONS_MEASURING_UNITS_SI, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
46 INVALID_STRING_ID |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
47 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
48 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
49 static const StringID _driveside_dropdown[] = { |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
50 STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT, |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
51 STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
52 INVALID_STRING_ID |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
53 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
54 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
55 static const StringID _autosave_dropdown[] = { |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
56 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF, |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
57 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH, |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
58 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_3_MONTHS, |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
59 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_6_MONTHS, |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
60 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_12_MONTHS, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
61 INVALID_STRING_ID, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
62 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
63 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
64 static StringID *BuildDynamicDropdown(StringID base, int num) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
65 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
66 static StringID buf[32 + 1]; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
67 StringID *p = buf; |
8969
01cc3ee6ecb1
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
68 while (--num >= 0) *p++ = base++; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
69 *p = INVALID_STRING_ID; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
70 return buf; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
71 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
72 |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
73 int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
74 static StringID *_grf_names = NULL; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
75 static int _nb_grf_names = 0; |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
76 |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
77 void InitGRFTownGeneratorNames() |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
78 { |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
79 free(_grf_names); |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
80 _grf_names = GetGRFTownNameList(); |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
81 _nb_grf_names = 0; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
82 for (StringID *s = _grf_names; *s != INVALID_STRING_ID; s++) _nb_grf_names++; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
83 } |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
84 |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
85 static inline StringID TownName(int town_name) |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
86 { |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
87 if (town_name < _nb_orig_names) return STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + town_name; |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
88 town_name -= _nb_orig_names; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
89 if (town_name < _nb_grf_names) return _grf_names[town_name]; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
90 return STR_UNDEFINED; |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
91 } |
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
92 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
93 static int GetCurRes() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
94 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
95 int i; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
96 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
97 for (i = 0; i != _num_resolutions; i++) { |
12262
fd3b92f848cc
(svn r16677) -Codechange: Dimension width and height are unsigned.
alberth <alberth@openttd.org>
parents:
12200
diff
changeset
|
98 if ((int)_resolutions[i].width == _screen.width && |
fd3b92f848cc
(svn r16677) -Codechange: Dimension width and height are unsigned.
alberth <alberth@openttd.org>
parents:
12200
diff
changeset
|
99 (int)_resolutions[i].height == _screen.height) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
100 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
101 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
102 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
103 return i; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
104 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
105 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
106 /** Widgets of the game options menu */ |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
107 enum GameOptionsWidgets { |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
108 GOW_CLOSEBOX = 0, ///< Close the window |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
109 GOW_CAPTION, ///< Caption of the window |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
110 GOW_BACKGROUND, ///< Background of the window |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
111 GOW_CURRENCY_FRAME, ///< Frame of the currency dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
112 GOW_CURRENCY_DROPDOWN, ///< Currency dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
113 GOW_DISTANCE_FRAME, ///< Measuring unit frame |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
114 GOW_DISTANCE_DROPDOWN, ///< Measuring unit dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
115 GOW_ROADSIDE_FRAME, ///< Road side frame |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
116 GOW_ROADSIDE_DROPDOWN, ///< Dropdown to select the road side (to set the right side ;)) |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
117 GOW_TOWNNAME_FRAME, ///< Frame for the town name dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
118 GOW_TOWNNAME_DROPDOWN, ///< Town name dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
119 GOW_AUTOSAVE_FRAME, ///< Frame for autosave |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
120 GOW_AUTOSAVE_DROPDOWN, ///< Dropdown to say how often to autosave |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
121 GOW_LANG_FRAME, ///< Language dropdown frame |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
122 GOW_LANG_DROPDOWN, ///< Language dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
123 GOW_RESOLUTION_FRAME, ///< Frame for the dropdown for the resolution |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
124 GOW_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
125 GOW_FULLSCREEN_LABEL, ///< Text (right) to the fullscreen button |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
126 GOW_FULLSCREEN_BUTTON, ///< Toggle fullscreen |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
127 GOW_SCREENSHOT_FRAME, ///< Frame for the screenshot type |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
128 GOW_SCREENSHOT_DROPDOWN, ///< Select the screenshot type... please use PNG! |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
129 GOW_BASE_GRF_FRAME, ///< Base GRF selection frame |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
130 GOW_BASE_GRF_DROPDOWN, ///< Use to select a base GRF |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
131 GOW_BASE_GRF_STATUS, ///< Info about missing files etc. |
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
132 GOW_BASE_GRF_DESCRIPTION,///< Description of selected base GRF |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
133 GOW_BASE_SFX_FRAME, ///< Base SFX selection frame |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
134 GOW_BASE_SFX_DROPDOWN, ///< Use to select a base SFX |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
135 GOW_BASE_SFX_DESCRIPTION,///< Description of selected base SFX |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
136 }; |
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
137 |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
138 /** |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
139 * Update/redraw the townnames dropdown |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
140 * @param w the window the dropdown belongs to |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
141 * @param sel the currently selected townname generator |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
142 */ |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
143 static void ShowTownnameDropdown(Window *w, int sel) |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
144 { |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
145 typedef std::map<StringID, int, StringIDCompare> TownList; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
146 TownList townnames; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
147 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
148 /* Add and sort original townnames generators */ |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
149 for (int i = 0; i < _nb_orig_names; i++) townnames[STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i] = i; |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
150 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
151 /* Add and sort newgrf townnames generators */ |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
152 for (int i = 0; i < _nb_grf_names; i++) townnames[_grf_names[i]] = _nb_orig_names + i; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
153 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
154 DropDownList *list = new DropDownList(); |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
155 for (TownList::iterator it = townnames.begin(); it != townnames.end(); it++) { |
11973
e17a54c88806
(svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead
smatz <smatz@openttd.org>
parents:
11939
diff
changeset
|
156 list->push_back(new DropDownListStringItem((*it).first, (*it).second, !(_game_mode == GM_MENU || Town::GetNumItems() == 0 || (*it).second == sel))); |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
157 } |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
158 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
159 ShowDropDownList(w, list, sel, GOW_TOWNNAME_DROPDOWN); |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
160 } |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
161 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
162 static void ShowCustCurrency(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
163 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
164 template <class T> |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
165 static void ShowSetMenu(Window *w, int widget) |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
166 { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
167 int n = T::GetNumSets(); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
168 int current = T::GetIndexOfUsedSet(); |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
169 |
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
170 DropDownList *list = new DropDownList(); |
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
171 for (int i = 0; i < n; i++) { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
172 list->push_back(new DropDownListCharStringItem(T::GetSet(i)->name, i, (_game_mode == GM_MENU) ? false : (current != i))); |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
173 } |
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
174 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
175 ShowDropDownList(w, list, current, widget); |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
176 } |
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
177 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
178 struct GameOptionsWindow : Window { |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9359
diff
changeset
|
179 GameSettings *opt; |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
180 bool reload; |
9346
0c181c088ed8
(svn r13242) -Codechange: remove _opt_ptr.
rubidium <rubidium@openttd.org>
parents:
9334
diff
changeset
|
181 |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
182 GameOptionsWindow(const WindowDesc *desc) : Window() |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
183 { |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9359
diff
changeset
|
184 this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
185 this->reload = false; |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
186 |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
187 this->InitNested(desc); |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
188 this->OnInvalidateData(0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
189 } |
8190
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
190 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
191 ~GameOptionsWindow() |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
192 { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
193 DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
194 if (this->reload) _switch_mode = SM_MENU; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
195 } |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
196 |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
197 virtual void SetStringParameters(int widget) const |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
198 { |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
199 switch (widget) { |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
200 case GOW_CURRENCY_DROPDOWN: SetDParam(0, _currency_specs[this->opt->locale.currency].name); break; |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
201 case GOW_DISTANCE_DROPDOWN: SetDParam(0, STR_GAME_OPTIONS_MEASURING_UNITS_IMPERIAL + this->opt->locale.units); break; |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
202 case GOW_ROADSIDE_DROPDOWN: SetDParam(0, STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT + this->opt->vehicle.road_side); break; |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
203 case GOW_TOWNNAME_DROPDOWN: SetDParam(0, TownName(this->opt->game_creation.town_name)); break; |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
204 case GOW_AUTOSAVE_DROPDOWN: SetDParam(0, _autosave_dropdown[_settings_client.gui.autosave]); break; |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
205 case GOW_LANG_DROPDOWN: SetDParam(0, SPECSTR_LANGUAGE_START + _dynlang.curr); break; |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
206 case GOW_RESOLUTION_DROPDOWN: SetDParam(0, GetCurRes() == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + GetCurRes()); break; |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
207 case GOW_SCREENSHOT_DROPDOWN: SetDParam(0, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); break; |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
12676
diff
changeset
|
208 case GOW_BASE_GRF_DROPDOWN: SetDParamStr(0, BaseGraphics::GetUsedSet()->name); break; |
12771
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12704
diff
changeset
|
209 case GOW_BASE_GRF_STATUS: SetDParam(0, BaseGraphics::GetUsedSet()->GetNumInvalid()); break; |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
210 case GOW_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break; |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
211 } |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
212 } |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
213 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
214 virtual void OnPaint() |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
215 { |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
216 this->DrawWidgets(); |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
217 } |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
218 |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
219 virtual void DrawWidget(const Rect &r, int widget) const |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
220 { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
221 switch (widget) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
222 case GOW_BASE_GRF_DESCRIPTION: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
223 SetDParamStr(0, BaseGraphics::GetUsedSet()->description); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
224 DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
225 break; |
8190
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
226 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
227 case GOW_BASE_SFX_DESCRIPTION: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
228 SetDParamStr(0, BaseSounds::GetUsedSet()->description); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
229 DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
230 break; |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
231 } |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
232 } |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
233 |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
234 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize) |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
235 { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
236 switch (widget) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
237 case GOW_BASE_GRF_DESCRIPTION: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
238 /* Find the biggest description for the default size. */ |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
239 for (int i = 0; i < BaseGraphics::GetNumSets(); i++) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
240 SetDParamStr(0, BaseGraphics::GetSet(i)->description); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
241 size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
242 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
243 break; |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
244 |
12704
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
245 case GOW_BASE_GRF_STATUS: |
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
246 /* Find the biggest description for the default size. */ |
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
247 for (int i = 0; i < BaseGraphics::GetNumSets(); i++) { |
12771
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12704
diff
changeset
|
248 uint invalid_files = BaseGraphics::GetSet(i)->GetNumInvalid(); |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12704
diff
changeset
|
249 if (invalid_files == 0) continue; |
12704
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
250 |
12771
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12704
diff
changeset
|
251 SetDParam(0, invalid_files); |
12704
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
252 *size = maxdim(*size, GetStringBoundingBox(STR_GAME_OPTIONS_BASE_GRF_STATUS)); |
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
253 } |
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
254 break; |
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
255 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
256 case GOW_BASE_SFX_DESCRIPTION: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
257 /* Find the biggest description for the default size. */ |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
258 for (int i = 0; i < BaseSounds::GetNumSets(); i++) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
259 SetDParamStr(0, BaseSounds::GetSet(i)->description); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
260 size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
261 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
262 break; |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
263 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
264 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
265 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
266 virtual void OnClick(Point pt, int widget) |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
267 { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
268 switch (widget) { |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
269 case GOW_CURRENCY_DROPDOWN: // Setup currencies dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
270 ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->locale.currency, GOW_CURRENCY_DROPDOWN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
271 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
272 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
273 case GOW_DISTANCE_DROPDOWN: // Setup distance unit dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
274 ShowDropDownMenu(this, _units_dropdown, this->opt->locale.units, GOW_DISTANCE_DROPDOWN, 0, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
275 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
276 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
277 case GOW_ROADSIDE_DROPDOWN: { // Setup road-side dropdown |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
278 int i = 0; |
9298
b2a46cf9b23e
(svn r13166) -Codechange: CmdSetRoadDriveSide belongs in road_cmd.cpp, not settings_gui.cpp.
rubidium <rubidium@openttd.org>
parents:
9291
diff
changeset
|
279 extern bool RoadVehiclesAreBuilt(); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
280 |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
281 /* You can only change the drive side if you are in the menu or ingame with |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
282 * no vehicles present. In a networking game only the server can change it */ |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
283 if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) { |
9358
12f4585b2124
(svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
284 i = (-1) ^ (1 << this->opt->vehicle.road_side); // disable the other value |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
285 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
286 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
287 ShowDropDownMenu(this, _driveside_dropdown, this->opt->vehicle.road_side, GOW_ROADSIDE_DROPDOWN, i, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
288 } break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
289 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
290 case GOW_TOWNNAME_DROPDOWN: // Setup townname dropdown |
9358
12f4585b2124
(svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
291 ShowTownnameDropdown(this, this->opt->game_creation.town_name); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
292 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
293 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
294 case GOW_AUTOSAVE_DROPDOWN: // Setup autosave dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
295 ShowDropDownMenu(this, _autosave_dropdown, _settings_client.gui.autosave, GOW_AUTOSAVE_DROPDOWN, 0, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
296 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
297 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
298 case GOW_LANG_DROPDOWN: { // Setup interface language dropdown |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
299 typedef std::map<StringID, int, StringIDCompare> LangList; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
300 |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
301 /* Sort language names */ |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
302 LangList langs; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
303 for (int i = 0; i < _dynlang.num; i++) langs[SPECSTR_LANGUAGE_START + i] = i; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
304 |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
305 DropDownList *list = new DropDownList(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
306 for (LangList::iterator it = langs.begin(); it != langs.end(); it++) { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
307 list->push_back(new DropDownListStringItem((*it).first, (*it).second, false)); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
308 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
309 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
310 ShowDropDownList(this, list, _dynlang.curr, GOW_LANG_DROPDOWN); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
311 } break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
312 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
313 case GOW_RESOLUTION_DROPDOWN: // Setup resolution dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
314 ShowDropDownMenu(this, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), GOW_RESOLUTION_DROPDOWN, 0, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
315 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
316 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
317 case GOW_FULLSCREEN_BUTTON: // Click fullscreen on/off |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
318 /* try to toggle full-screen on/off */ |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
319 if (!ToggleFullScreen(!_fullscreen)) { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
320 ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_FULLSCREEN_FAILED, 0, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
321 } |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
322 this->SetWidgetLoweredState(GOW_FULLSCREEN_BUTTON, _fullscreen); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
323 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
324 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
325 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
326 case GOW_SCREENSHOT_DROPDOWN: // Setup screenshot format dropdown |
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
327 ShowDropDownMenu(this, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, GOW_SCREENSHOT_DROPDOWN, 0, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
328 break; |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
329 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
330 case GOW_BASE_GRF_DROPDOWN: |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
331 ShowSetMenu<BaseGraphics>(this, GOW_BASE_GRF_DROPDOWN); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
332 break; |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
333 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
334 case GOW_BASE_SFX_DROPDOWN: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
335 ShowSetMenu<BaseSounds>(this, GOW_BASE_SFX_DROPDOWN); |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
336 break; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
337 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
338 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
339 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
340 /** |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
341 * Set the base media set. |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
342 * @param index the index of the media set |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
343 * @tparam T class of media set |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
344 */ |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
345 template <class T> |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
346 void SetMediaSet(int index) |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
347 { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
348 if (_game_mode == GM_MENU) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
349 const char *name = T::GetSet(index)->name; |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
350 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
351 free(const_cast<char *>(T::ini_set)); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
352 T::ini_set = strdup(name); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
353 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
354 T::SetSet(name); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
355 this->reload = true; |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
356 this->SetDirty(); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
357 this->OnInvalidateData(0); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
358 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
359 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
360 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
361 virtual void OnDropdownSelect(int widget, int index) |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
362 { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
363 switch (widget) { |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
364 case GOW_CURRENCY_DROPDOWN: // Currency |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
365 if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency(); |
9466
f81fe8c0065a
(svn r13386) -Fix: global currency/units setting being overriden when loading a savegame.
rubidium <rubidium@openttd.org>
parents:
9421
diff
changeset
|
366 this->opt->locale.currency = index; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
367 MarkWholeScreenDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
368 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
369 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
370 case GOW_DISTANCE_DROPDOWN: // Measuring units |
9466
f81fe8c0065a
(svn r13386) -Fix: global currency/units setting being overriden when loading a savegame.
rubidium <rubidium@openttd.org>
parents:
9421
diff
changeset
|
371 this->opt->locale.units = index; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
372 MarkWholeScreenDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
373 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
374 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
375 case GOW_ROADSIDE_DROPDOWN: // Road side |
11075
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
376 if (this->opt->vehicle.road_side != index) { // only change if setting changed |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
377 uint i; |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
378 if (GetSettingFromName("vehicle.road_side", &i) == NULL) NOT_REACHED(); |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
379 SetSettingValue(i, index); |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
380 MarkWholeScreenDirty(); |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
381 } |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
382 break; |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
383 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
384 case GOW_TOWNNAME_DROPDOWN: // Town names |
11973
e17a54c88806
(svn r16379) -Codechange: remove GetNumTowns(), GetNumIndustries() and GetActiveCompanyCount(), use PoolItem::GetNumItems() instead
smatz <smatz@openttd.org>
parents:
11939
diff
changeset
|
385 if (_game_mode == GM_MENU || Town::GetNumItems() == 0) { |
9358
12f4585b2124
(svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
386 this->opt->game_creation.town_name = index; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
387 InvalidateWindow(WC_GAME_OPTIONS, 0); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
388 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
389 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
390 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
391 case GOW_AUTOSAVE_DROPDOWN: // Autosave options |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9359
diff
changeset
|
392 _settings_client.gui.autosave = index; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
393 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
394 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
395 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
396 case GOW_LANG_DROPDOWN: // Change interface language |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
397 ReadLanguagePack(index); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
398 CheckForMissingGlyphsInLoadedLanguagePack(); |
12391
b7b1110f6c24
(svn r16821) -Codechange: unify the naming of type::UpdateVirtCoord and UpdateAll[Type]VirtCoords.
rubidium <rubidium@openttd.org>
parents:
12357
diff
changeset
|
399 UpdateAllStationVirtCoords(); |
12272
c8708dfd0118
(svn r16687) -Codechange: Perform re-initialization of windows with nested widgets after a language change.
alberth <alberth@openttd.org>
parents:
12262
diff
changeset
|
400 ReInitAllWindows(); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
401 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
402 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
403 case GOW_RESOLUTION_DROPDOWN: // Change resolution |
9533
176a9fe1018f
(svn r13537) -Fix [FS#2090](r13523): QSortT won't work this way, use Dimension instead of uint16[2] for resolutions
smatz <smatz@openttd.org>
parents:
9466
diff
changeset
|
404 if (index < _num_resolutions && ChangeResInGame(_resolutions[index].width, _resolutions[index].height)) { |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
405 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
406 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
407 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
408 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
409 case GOW_SCREENSHOT_DROPDOWN: // Change screenshot format |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
410 SetScreenshotFormat(index); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
411 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
412 break; |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
413 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
414 case GOW_BASE_GRF_DROPDOWN: |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
415 this->SetMediaSet<BaseGraphics>(index); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
416 break; |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
417 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
418 case GOW_BASE_SFX_DROPDOWN: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
419 this->SetMediaSet<BaseSounds>(index); |
11049
ed93627e213f
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
peter1138 <peter1138@openttd.org>
parents:
11000
diff
changeset
|
420 break; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
421 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
422 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
423 |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
424 virtual void OnInvalidateData(int data) |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
425 { |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
426 this->SetWidgetLoweredState(GOW_FULLSCREEN_BUTTON, _fullscreen); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
427 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
12676
diff
changeset
|
428 bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0; |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
429 this->nested_array[GOW_BASE_GRF_STATUS]->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_GRF_STATUS, STR_NULL); |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
430 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
431 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
432 |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
433 static const NWidgetPart _nested_game_options_widgets[] = { |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
434 NWidget(NWID_HORIZONTAL), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
435 NWidget(WWT_CLOSEBOX, COLOUR_GREY, GOW_CLOSEBOX), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
436 NWidget(WWT_CAPTION, COLOUR_GREY, GOW_CAPTION), SetDataTip(STR_GAME_OPTIONS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
437 EndContainer(), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
438 NWidget(WWT_PANEL, COLOUR_GREY, GOW_BACKGROUND), SetPIP(6, 6, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
439 NWidget(NWID_HORIZONTAL), SetPIP(10, 10, 10), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
440 NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
441 NWidget(WWT_FRAME, COLOUR_GREY, GOW_CURRENCY_FRAME), SetDataTip(STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME, STR_NULL), |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
442 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_CURRENCY_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
443 EndContainer(), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
444 NWidget(WWT_FRAME, COLOUR_GREY, GOW_ROADSIDE_FRAME), SetDataTip(STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME, STR_NULL), |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
445 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_ROADSIDE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
446 EndContainer(), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
447 NWidget(WWT_FRAME, COLOUR_GREY, GOW_AUTOSAVE_FRAME), SetDataTip(STR_GAME_OPTIONS_AUTOSAVE_FRAME, STR_NULL), |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
448 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_AUTOSAVE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
449 EndContainer(), |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
450 NWidget(WWT_FRAME, COLOUR_GREY, GOW_RESOLUTION_FRAME), SetDataTip(STR_GAME_OPTIONS_RESOLUTION, STR_NULL), |
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
451 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_RESOLUTION_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_RESOLUTION_TOOLTIP), SetPadding(14, 10, 3, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
452 NWidget(NWID_HORIZONTAL), |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
453 NWidget(WWT_TEXT, COLOUR_GREY, GOW_FULLSCREEN_LABEL), SetMinimalSize(0, 12), SetFill(true, false), SetDataTip(STR_GAME_OPTIONS_FULLSCREEN, STR_NULL), SetPadding(0, 2, 4, 10), |
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
454 NWidget(WWT_TEXTBTN, COLOUR_GREY, GOW_FULLSCREEN_BUTTON), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_FULLSCREEN_TOOLTIP), SetPadding(0, 10, 4, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
455 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
456 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
457 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
458 |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
459 NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
460 NWidget(WWT_FRAME, COLOUR_GREY, GOW_DISTANCE_FRAME), SetDataTip(STR_GAME_OPTIONS_MEASURING_UNITS_FRAME, STR_NULL), |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
461 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_DISTANCE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_MEASURING_UNITS_DROPDOWN_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
462 EndContainer(), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
463 NWidget(WWT_FRAME, COLOUR_GREY, GOW_TOWNNAME_FRAME), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
464 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_TOWNNAME_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
465 EndContainer(), |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
466 NWidget(WWT_FRAME, COLOUR_GREY, GOW_LANG_FRAME), SetDataTip(STR_GAME_OPTIONS_LANGUAGE, STR_NULL), |
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
467 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_LANG_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_LANGUAGE_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
468 EndContainer(), |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
469 NWidget(WWT_FRAME, COLOUR_GREY, GOW_SCREENSHOT_FRAME), SetDataTip(STR_GAME_OPTIONS_SCREENSHOT_FORMAT, STR_NULL), |
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
470 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_SCREENSHOT_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_SCREENSHOT_FORMAT_TOOLTIP), SetPadding(14, 10, 10, 10), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
471 NWidget(NWID_SPACER), SetMinimalSize(0, 9), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
472 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
473 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
474 EndContainer(), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
475 |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
476 NWidget(WWT_FRAME, COLOUR_GREY, GOW_BASE_GRF_FRAME), SetDataTip(STR_GAME_OPTIONS_BASE_GRF, STR_NULL), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
477 NWidget(NWID_HORIZONTAL), SetPIP(10, 30, 10), |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
478 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_GRF_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_GRF_TOOLTIP), SetPadding(14, 0, 0, 0), |
12704
dba29babe01f
(svn r17167) -Fix: don't resize the 'base grf status' text part in the game options window when there is no base graphics set that misses files.
rubidium <rubidium@openttd.org>
parents:
12684
diff
changeset
|
479 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_GRF_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetPadding(14, 0, 0, 0), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
480 EndContainer(), |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
481 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_GRF_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP), SetPadding(6, 10, 10, 10), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
482 EndContainer(), |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
483 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
484 NWidget(WWT_FRAME, COLOUR_GREY, GOW_BASE_SFX_FRAME), SetDataTip(STR_GAME_OPTIONS_BASE_SFX, STR_NULL), |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
485 NWidget(NWID_HORIZONTAL), SetPIP(10, 30, 10), |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
486 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_SFX_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_SFX_TOOLTIP), SetPadding(14, 0, 0, 0), |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
487 NWidget(NWID_SPACER), SetFill(true, false), |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
488 EndContainer(), |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
489 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetPadding(6, 10, 10, 10), |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
490 EndContainer(), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
491 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
492 }; |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
493 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
494 static const WindowDesc _game_options_desc( |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
495 WDP_CENTER, WDP_CENTER, 370, 249, 370, 249, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
496 WC_GAME_OPTIONS, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
497 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
498 NULL, _nested_game_options_widgets, lengthof(_nested_game_options_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
499 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
500 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
501 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
502 void ShowGameOptions() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
503 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
504 DeleteWindowById(WC_GAME_OPTIONS, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
505 new GameOptionsWindow(&_game_options_desc); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
506 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
507 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
508 extern void StartupEconomy(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
509 |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
510 |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
511 /* Names of the game difficulty settings window */ |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
512 enum GameDifficultyWidgets { |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
513 GDW_CAPTION, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
514 GDW_UPPER_BG, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
515 GDW_LVL_EASY, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
516 GDW_LVL_MEDIUM, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
517 GDW_LVL_HARD, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
518 GDW_LVL_CUSTOM, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
519 GDW_HIGHSCORE, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
520 GDW_SETTING_BG, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
521 GDW_LOWER_BG, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
522 GDW_ACCEPT, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
523 GDW_CANCEL, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
524 }; |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
525 |
8136
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
526 /* Widget definition for the game difficulty settings window */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
527 static const Widget _game_difficulty_widgets[] = { |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
528 { WWT_CAPTION, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 0, 13, STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // GDW_CAPTION |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
529 { WWT_PANEL, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 14, 41, 0x0, STR_NULL}, // GDW_UPPER_BG |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
530 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 10, 96, 16, 27, STR_DIFFICULTY_LEVEL_EASY, STR_NULL}, // GDW_LVL_EASY |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
531 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 97, 183, 16, 27, STR_DIFFICULTY_LEVEL_MEDIUM, STR_NULL}, // GDW_LVL_MEDIUM |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
532 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 184, 270, 16, 27, STR_DIFFICULTY_LEVEL_HARD, STR_NULL}, // GDW_LVL_HARD |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
533 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 271, 357, 16, 27, STR_DIFFICULTY_LEVEL_CUSTOM, STR_NULL}, // GDW_LVL_CUSTOM |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
534 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREEN, 10, 357, 28, 39, STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL}, // GDW_HIGHSCORE |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
535 { WWT_PANEL, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 42, 262, 0x0, STR_NULL}, // GDW_SETTING_BG |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
536 { WWT_PANEL, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 263, 278, 0x0, STR_NULL}, // GDW_LOWER_BG |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
537 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 105, 185, 265, 276, STR_DIFFICULTY_LEVEL_SAVE, STR_NULL}, // GDW_ACCEPT |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
538 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 186, 266, 265, 276, STR_BUTTON_CANCEL, STR_NULL}, // GDW_CANCEL |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
539 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
540 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
541 |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
542 static const NWidgetPart _nested_game_difficulty_widgets[] = { |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
543 NWidget(WWT_CAPTION, COLOUR_MAUVE, GDW_CAPTION), SetMinimalSize(370, 14), SetDataTip(STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
544 NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_UPPER_BG), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
545 NWidget(NWID_SPACER), SetMinimalSize(0, 2), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
546 NWidget(NWID_HORIZONTAL), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
547 NWidget(NWID_SPACER), SetMinimalSize(10, 0), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
548 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_EASY), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_EASY, STR_NULL), |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
549 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_MEDIUM), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_MEDIUM, STR_NULL), |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
550 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_HARD), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_HARD, STR_NULL), |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
551 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_LVL_CUSTOM), SetMinimalSize(87, 12), SetDataTip(STR_DIFFICULTY_LEVEL_CUSTOM, STR_NULL), |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
552 NWidget(NWID_SPACER), SetMinimalSize(12, 0), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
553 EndContainer(), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
554 NWidget(NWID_HORIZONTAL), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
555 NWidget(NWID_SPACER), SetMinimalSize(10, 0), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
556 NWidget(WWT_TEXTBTN, COLOUR_GREEN, GDW_HIGHSCORE), SetMinimalSize(348, 12), SetDataTip(STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL), |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
557 NWidget(NWID_SPACER), SetMinimalSize(12, 0), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
558 EndContainer(), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
559 NWidget(NWID_SPACER), SetMinimalSize(0, 2), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
560 EndContainer(), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
561 NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_SETTING_BG), SetMinimalSize(370, 221), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
562 EndContainer(), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
563 NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_LOWER_BG), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
564 NWidget(NWID_SPACER), SetMinimalSize(0, 2), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
565 NWidget(NWID_HORIZONTAL), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
566 NWidget(NWID_SPACER), SetMinimalSize(105, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
567 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_ACCEPT), SetMinimalSize(81, 12), SetDataTip(STR_DIFFICULTY_LEVEL_SAVE, STR_NULL), |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
568 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_CANCEL), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
569 NWidget(NWID_SPACER), SetMinimalSize(103, 0), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
570 EndContainer(), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
571 NWidget(NWID_SPACER), SetMinimalSize(0, 2), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
572 EndContainer(), |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
573 }; |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
574 |
8136
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
575 /* Window definition for the game difficulty settings window */ |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
576 static const WindowDesc _game_difficulty_desc( |
7341
549c757023fc
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents:
7177
diff
changeset
|
577 WDP_CENTER, WDP_CENTER, 370, 279, 370, 279, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
578 WC_GAME_OPTIONS, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
579 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
580 _game_difficulty_widgets, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
581 ); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
582 |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
583 void SetDifficultyLevel(int mode, DifficultySettings *gm_opt); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
584 |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
585 struct GameDifficultyWindow : public Window { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
586 private: |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
587 static const uint GAME_DIFFICULTY_NUM = 18; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
588 bool clicked_increase; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
589 uint8 clicked_button; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
590 uint8 timeout; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
591 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
592 /* Temporary holding place of values in the difficulty window until 'Save' is clicked */ |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9359
diff
changeset
|
593 GameSettings opt_mod_temp; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
594 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
595 enum { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
596 GAMEDIFF_WND_TOP_OFFSET = 45, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
597 GAMEDIFF_WND_ROWSIZE = 9, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
598 NO_SETTINGS_BUTTON = 0xFF, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
599 }; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
600 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
601 public: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
602 GameDifficultyWindow() : Window(&_game_difficulty_desc) |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
603 { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
604 /* Copy current settings (ingame or in intro) to temporary holding place |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
605 * change that when setting stuff, copy back on clicking 'OK' */ |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9359
diff
changeset
|
606 this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
607 this->clicked_increase = false; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
608 this->clicked_button = NO_SETTINGS_BUTTON; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
609 this->timeout = 0; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
610 /* Setup disabled buttons when creating window |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
611 * disable all other difficulty buttons during gameplay except for 'custom' */ |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
612 this->SetWidgetsDisabledState(_game_mode == GM_NORMAL, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
613 GDW_LVL_EASY, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
614 GDW_LVL_MEDIUM, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
615 GDW_LVL_HARD, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
616 GDW_LVL_CUSTOM, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
617 WIDGET_LIST_END); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
618 this->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
619 this->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client) |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
620 this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
621 this->FindWindowPlacementAndResize(&_game_difficulty_desc); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
622 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
623 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
624 virtual void OnPaint() |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
625 { |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9246
diff
changeset
|
626 this->DrawWidgets(); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
627 |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
628 uint i; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
629 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
630 int y = GAMEDIFF_WND_TOP_OFFSET; |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
631 StringID str = STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS; |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
632 for (i = 0; i < GAME_DIFFICULTY_NUM; i++, sd++) { |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
633 const SettingDescBase *sdb = &sd->desc; |
10813
fa3d9e9ec3c5
(svn r15148) -Cleanup: Remove the options "competitor start time" and "competitor intelligence" from the difficulty options because they already were unused.
Yexo <Yexo@openttd.org>
parents:
10696
diff
changeset
|
634 /* skip deprecated difficulty options */ |
fa3d9e9ec3c5
(svn r15148) -Cleanup: Remove the options "competitor start time" and "competitor intelligence" from the difficulty options because they already were unused.
Yexo <Yexo@openttd.org>
parents:
10696
diff
changeset
|
635 if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
636 int32 value = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
637 bool editable = (_game_mode == GM_MENU || (sdb->flags & SGF_NEWGAME_ONLY) == 0); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
638 |
9871
fa16e41cec2c
(svn r14017) -Codechange: DrawArrowButtons now uses Colours enum to specify the colour of the button
belugas <belugas@openttd.org>
parents:
9793
diff
changeset
|
639 DrawArrowButtons(5, y, COLOUR_YELLOW, |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
640 (this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
641 editable && sdb->min != value, |
11897
b29337cb73a4
(svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents:
11770
diff
changeset
|
642 editable && sdb->max != (uint32)value); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
643 |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
644 value += sdb->str; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
645 SetDParam(0, value); |
11770
534c3c3167f2
(svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents:
11762
diff
changeset
|
646 DrawString(30, this->width, y, str); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
647 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
648 y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit |
10813
fa3d9e9ec3c5
(svn r15148) -Cleanup: Remove the options "competitor start time" and "competitor intelligence" from the difficulty options because they already were unused.
Yexo <Yexo@openttd.org>
parents:
10696
diff
changeset
|
649 str++; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
650 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
651 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
652 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
653 virtual void OnClick(Point pt, int widget) |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
654 { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
655 switch (widget) { |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11252
diff
changeset
|
656 case GDW_SETTING_BG: { // Difficulty settings widget, decode click |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
657 /* Don't allow clients to make any changes */ |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
658 if (_networking && !_network_server) return; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
659 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
660 const int x = pt.x - 5; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
661 if (!IsInsideMM(x, 0, 21)) return; // Button area |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
662 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
663 const int y = pt.y - GAMEDIFF_WND_TOP_OFFSET; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
664 if (y < 0) return; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
665 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
666 /* Get button from Y coord. */ |
10813
fa3d9e9ec3c5
(svn r15148) -Cleanup: Remove the options "competitor start time" and "competitor intelligence" from the difficulty options because they already were unused.
Yexo <Yexo@openttd.org>
parents:
10696
diff
changeset
|
667 uint8 btn = y / (GAMEDIFF_WND_ROWSIZE + 2); |
fa3d9e9ec3c5
(svn r15148) -Cleanup: Remove the options "competitor start time" and "competitor intelligence" from the difficulty options because they already were unused.
Yexo <Yexo@openttd.org>
parents:
10696
diff
changeset
|
668 if (btn >= 1) btn++; // Skip the deprecated option "competitor start time" |
fa3d9e9ec3c5
(svn r15148) -Cleanup: Remove the options "competitor start time" and "competitor intelligence" from the difficulty options because they already were unused.
Yexo <Yexo@openttd.org>
parents:
10696
diff
changeset
|
669 if (btn >= 8) btn++; // Skip the deprecated option "competitor intelligence" |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
670 if (btn >= GAME_DIFFICULTY_NUM || y % (GAMEDIFF_WND_ROWSIZE + 2) >= 9) return; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
671 |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
672 uint i; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
673 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + btn; |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
674 const SettingDescBase *sdb = &sd->desc; |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
675 |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
676 /* Clicked disabled button? */ |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
677 bool editable = (_game_mode == GM_MENU || (sdb->flags & SGF_NEWGAME_ONLY) == 0); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
678 if (!editable) return; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
679 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
680 this->timeout = 5; |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
681 int32 val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
682 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
683 if (x >= 10) { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
684 /* Increase button clicked */ |
12683
0bd578d2be8f
(svn r17138) -Fix: some MSVC 64 bits compiler warnings
rubidium <rubidium@openttd.org>
parents:
12678
diff
changeset
|
685 val = min(val + sdb->interval, (int32)sdb->max); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
686 this->clicked_increase = true; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
687 } else { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
688 /* Decrease button clicked */ |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
689 val -= sdb->interval; |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
690 val = max(val, sdb->min); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
691 this->clicked_increase = false; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
692 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
693 this->clicked_button = btn; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
694 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
695 /* save value in temporary variable */ |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
696 WriteValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv, val); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
697 this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
698 SetDifficultyLevel(3, &this->opt_mod_temp.difficulty); // set difficulty level to custom |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
699 this->LowerWidget(GDW_LVL_CUSTOM); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
700 this->SetDirty(); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
701 } break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
702 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
703 case GDW_LVL_EASY: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
704 case GDW_LVL_MEDIUM: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
705 case GDW_LVL_HARD: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
706 case GDW_LVL_CUSTOM: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
707 /* temporarily change difficulty level */ |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
708 this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
709 SetDifficultyLevel(widget - GDW_LVL_EASY, &this->opt_mod_temp.difficulty); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
710 this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
711 this->SetDirty(); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
712 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
713 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
714 case GDW_HIGHSCORE: // Highscore Table |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
715 ShowHighscoreTable(this->opt_mod_temp.difficulty.diff_level, -1); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
716 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
717 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
718 case GDW_ACCEPT: { // Save button - save changes |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9359
diff
changeset
|
719 GameSettings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
720 |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
721 uint i; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
722 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i); |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
723 for (uint btn = 0; btn != GAME_DIFFICULTY_NUM; btn++, sd++) { |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
724 int32 new_val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
725 int32 cur_val = (int32)ReadValue(GetVariableAddress(opt_ptr, &sd->save), sd->save.conv); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
726 /* if setting has changed, change it */ |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
727 if (new_val != cur_val) { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
728 DoCommandP(0, i + btn, new_val, CMD_CHANGE_SETTING); |
9346
0c181c088ed8
(svn r13242) -Codechange: remove _opt_ptr.
rubidium <rubidium@openttd.org>
parents:
9334
diff
changeset
|
729 } |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
730 } |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
731 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
732 GetSettingFromName("difficulty.diff_level", &i); |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
733 DoCommandP(0, i, this->opt_mod_temp.difficulty.diff_level, CMD_CHANGE_SETTING); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
734 delete this; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
735 /* If we are in the editor, we should reload the economy. |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
736 * This way when you load a game, the max loan and interest rate |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
737 * are loaded correctly. */ |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
738 if (_game_mode == GM_EDITOR) StartupEconomy(); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
739 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
740 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
741 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
742 case GDW_CANCEL: // Cancel button - close window, abandon changes |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
743 delete this; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
744 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
745 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
746 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
747 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
748 virtual void OnTick() |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
749 { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
750 if (this->timeout != 0) { |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
751 this->timeout--; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
752 if (this->timeout == 0) this->clicked_button = NO_SETTINGS_BUTTON; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
753 this->SetDirty(); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
754 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
755 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
756 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
757 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
758 void ShowGameDifficulty() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
759 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
760 DeleteWindowById(WC_GAME_OPTIONS, 0); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
761 new GameDifficultyWindow(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
762 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
763 |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
764 static const int SETTING_HEIGHT = 11; ///< Height of a single setting in the tree view in pixels |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
765 static const int LEVEL_WIDTH = 15; ///< Indenting width of a sub-page in pixels |
10538
24ddd67a00be
(svn r14795) -Codechange: replace a magic number with a constant (Alberth)
rubidium <rubidium@openttd.org>
parents:
10537
diff
changeset
|
766 |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
767 /** |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
768 * Flags for #SettingEntry |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
769 * @note The #SEF_BUTTONS_MASK matches expectations of the formal parameter 'state' of #DrawArrowButtons |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
770 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
771 enum SettingEntryFlags { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
772 SEF_LEFT_DEPRESSED = 0x01, ///< Of a numeric setting entry, the left button is depressed |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
773 SEF_RIGHT_DEPRESSED = 0x02, ///< Of a numeric setting entry, the right button is depressed |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
774 SEF_BUTTONS_MASK = (SEF_LEFT_DEPRESSED | SEF_RIGHT_DEPRESSED), ///< Bit-mask for button flags |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
775 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
776 SEF_LAST_FIELD = 0x04, ///< This entry is the last one in a (sub-)page |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
777 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
778 /* Entry kind */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
779 SEF_SETTING_KIND = 0x10, ///< Entry kind: Entry is a setting |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
780 SEF_SUBTREE_KIND = 0x20, ///< Entry kind: Entry is a sub-tree |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
781 SEF_KIND_MASK = (SEF_SETTING_KIND | SEF_SUBTREE_KIND), ///< Bit-mask for fetching entry kind |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
782 }; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
783 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
784 struct SettingsPage; // Forward declaration |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
785 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
786 /** Data fields for a sub-page (#SEF_SUBTREE_KIND kind)*/ |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
787 struct SettingEntrySubtree { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
788 SettingsPage *page; ///< Pointer to the sub-page |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
789 bool folded; ///< Sub-page is folded (not visible except for its title) |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
790 StringID title; ///< Title of the sub-page |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
791 }; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
792 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
793 /** Data fields for a single setting (#SEF_SETTING_KIND kind) */ |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
794 struct SettingEntrySetting { |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
795 const char *name; ///< Name of the setting |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
796 const SettingDesc *setting; ///< Setting description of the setting |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
797 uint index; ///< Index of the setting in the settings table |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
798 }; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
799 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
800 /** Data structure describing a single setting in a tab */ |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
801 struct SettingEntry { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
802 byte flags; ///< Flags of the setting entry. @see SettingEntryFlags |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
803 byte level; ///< Nesting level of this setting entry |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
804 union { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
805 SettingEntrySetting entry; ///< Data fields if entry is a setting |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
806 SettingEntrySubtree sub; ///< Data fields if entry is a sub-page |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
807 } d; ///< Data fields for each kind |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
808 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
809 SettingEntry(const char *nm); |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
810 SettingEntry(SettingsPage *sub, StringID title); |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
811 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
812 void Init(byte level, bool last_field); |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
813 void FoldAll(); |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
814 void SetButtons(byte new_val); |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
815 |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
816 uint Length() const; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
817 SettingEntry *FindEntry(uint row, uint *cur_row); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
818 |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
819 uint Draw(GameSettings *settings_ptr, int base_x, int base_y, int max_x, uint first_row, uint max_row, uint cur_row, uint parent_last); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
820 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
821 private: |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
822 void DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd, int x, int y, int max_x, int state); |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
823 }; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
824 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
825 /** Data structure describing one page of settings in the settings window. */ |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
826 struct SettingsPage { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
827 SettingEntry *entries; ///< Array of setting entries of the page. |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
828 byte num; ///< Number of entries on the page (statically filled). |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
829 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
830 void Init(byte level = 0); |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
831 void FoldAll(); |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
832 |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
833 uint Length() const; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
834 SettingEntry *FindEntry(uint row, uint *cur_row) const; |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
835 |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
836 uint Draw(GameSettings *settings_ptr, int base_x, int base_y, int max_x, uint first_row, uint max_row, uint cur_row = 0, uint parent_last = 0) const; |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
837 }; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
838 |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
839 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
840 /* == SettingEntry methods == */ |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
841 |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
842 /** |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
843 * Constructor for a single setting in the 'advanced settings' window |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
844 * @param nm Name of the setting in the setting table |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
845 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
846 SettingEntry::SettingEntry(const char *nm) |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
847 { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
848 this->flags = SEF_SETTING_KIND; |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
849 this->level = 0; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
850 this->d.entry.name = nm; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
851 this->d.entry.setting = NULL; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
852 this->d.entry.index = 0; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
853 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
854 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
855 /** |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
856 * Constructor for a sub-page in the 'advanced settings' window |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
857 * @param sub Sub-page |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
858 * @param title Title of the sub-page |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
859 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
860 SettingEntry::SettingEntry(SettingsPage *sub, StringID title) |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
861 { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
862 this->flags = SEF_SUBTREE_KIND; |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
863 this->level = 0; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
864 this->d.sub.page = sub; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
865 this->d.sub.folded = true; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
866 this->d.sub.title = title; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
867 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
868 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
869 /** |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
870 * Initialization of a setting entry |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
871 * @param level Page nesting level of this entry |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
872 * @param last_field Boolean indicating this entry is the last at the (sub-)page |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
873 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
874 void SettingEntry::Init(byte level, bool last_field) |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
875 { |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
876 this->level = level; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
877 if (last_field) this->flags |= SEF_LAST_FIELD; |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
878 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
879 switch (this->flags & SEF_KIND_MASK) { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
880 case SEF_SETTING_KIND: |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
881 this->d.entry.setting = GetSettingFromName(this->d.entry.name, &this->d.entry.index); |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
882 assert(this->d.entry.setting != NULL); |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
883 break; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
884 case SEF_SUBTREE_KIND: |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
885 this->d.sub.page->Init(level + 1); |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
886 break; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
887 default: NOT_REACHED(); |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
888 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
889 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
890 |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
891 /** Recursively close all folds of sub-pages */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
892 void SettingEntry::FoldAll() |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
893 { |
12676
d1ed749a9ce5
(svn r17131) -Codechange: apply coding style to some switch statements
smatz <smatz@openttd.org>
parents:
12632
diff
changeset
|
894 switch (this->flags & SEF_KIND_MASK) { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
895 case SEF_SETTING_KIND: |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
896 break; |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
897 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
898 case SEF_SUBTREE_KIND: |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
899 this->d.sub.folded = true; |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
900 this->d.sub.page->FoldAll(); |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
901 break; |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
902 |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
903 default: NOT_REACHED(); |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
904 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
905 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
906 |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
907 |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
908 /** |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
909 * Set the button-depressed flags (#SEF_LEFT_DEPRESSED and #SEF_RIGHT_DEPRESSED) to a specified value |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
910 * @param new_val New value for the button flags |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
911 * @see SettingEntryFlags |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
912 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
913 void SettingEntry::SetButtons(byte new_val) |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
914 { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
915 assert((new_val & ~SEF_BUTTONS_MASK) == 0); // Should not touch any flags outside the buttons |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
916 this->flags = (this->flags & ~SEF_BUTTONS_MASK) | new_val; |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
917 } |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
918 |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
919 /** Return numbers of rows needed to display the entry */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
920 uint SettingEntry::Length() const |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
921 { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
922 switch (this->flags & SEF_KIND_MASK) { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
923 case SEF_SETTING_KIND: |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
924 return 1; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
925 case SEF_SUBTREE_KIND: |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
926 if (this->d.sub.folded) return 1; // Only displaying the title |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
927 |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
928 return 1 + this->d.sub.page->Length(); // 1 extra row for the title |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
929 default: NOT_REACHED(); |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
930 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
931 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
932 |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
933 /** |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
934 * Find setting entry at row \a row_num |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
935 * @param row_num Index of entry to return |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
936 * @param cur_row Current row number |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
937 * @return The requested setting entry or \c NULL if it not found |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
938 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
939 SettingEntry *SettingEntry::FindEntry(uint row_num, uint *cur_row) |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
940 { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
941 if (row_num == *cur_row) return this; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
942 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
943 switch (this->flags & SEF_KIND_MASK) { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
944 case SEF_SETTING_KIND: |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
945 (*cur_row)++; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
946 break; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
947 case SEF_SUBTREE_KIND: |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
948 (*cur_row)++; // add one for row containing the title |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
949 if (this->d.sub.folded) { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
950 break; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
951 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
952 |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
953 /* sub-page is visible => search it too */ |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
954 return this->d.sub.page->FindEntry(row_num, cur_row); |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
955 default: NOT_REACHED(); |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
956 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
957 return NULL; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
958 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
959 |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
960 /** |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
961 * Draw a row in the settings panel. |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
962 * |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
963 * See SettingsPage::Draw() for an explanation about how drawing is performed. |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
964 * |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
965 * The \a parent_last parameter ensures that the vertical lines at the left are |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
966 * only drawn when another entry follows, that it prevents output like |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
967 * \verbatim |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
968 * |-- setting |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
969 * |-- (-) - Title |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
970 * | |-- setting |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
971 * | |-- setting |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
972 * \endverbatim |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
973 * The left-most vertical line is not wanted. It is prevented by setting the |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
974 * appropiate bit in the \a parent_last parameter. |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
975 * |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
976 * @param settings_ptr Pointer to current values of all settings |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
977 * @param base_x Left-most position in window/panel to start drawing \a first_row |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
978 * @param base_y Upper-most position in window/panel to start drawing \a first_row |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
979 * @param max_x The maximum x position to draw strings add. |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
980 * @param first_row First row number to draw |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
981 * @param max_row Row-number to stop drawing (the row-number of the row below the last row to draw) |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
982 * @param cur_row Current row number (internal variable) |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
983 * @param parent_last Last-field booleans of parent page level (page level \e i sets bit \e i to 1 if it is its last field) |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
984 * @return Row number of the next row to draw |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
985 */ |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
986 uint SettingEntry::Draw(GameSettings *settings_ptr, int base_x, int base_y, int max_x, uint first_row, uint max_row, uint cur_row, uint parent_last) |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
987 { |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
988 if (cur_row >= max_row) return cur_row; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
989 |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
990 int x = base_x; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
991 int y = base_y; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
992 if (cur_row >= first_row) { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
993 int colour = _colour_gradient[COLOUR_ORANGE][4]; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
994 y = base_y + (cur_row - first_row) * SETTING_HEIGHT; // Compute correct y start position |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
995 |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
996 /* Draw vertical for parent nesting levels */ |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
997 for (uint lvl = 0; lvl < this->level; lvl++) { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
998 if (!HasBit(parent_last, lvl)) GfxDrawLine(x + 4, y, x + 4, y + SETTING_HEIGHT - 1, colour); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
999 x += LEVEL_WIDTH; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1000 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1001 /* draw own |- prefix */ |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1002 int halfway_y = y + SETTING_HEIGHT / 2; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1003 int bottom_y = (flags & SEF_LAST_FIELD) ? halfway_y : y + SETTING_HEIGHT - 1; |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1004 GfxDrawLine(x + 4, y, x + 4, bottom_y, colour); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1005 /* Small horizontal line from the last vertical line */ |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1006 GfxDrawLine(x + 4, halfway_y, x + LEVEL_WIDTH - 4, halfway_y, colour); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1007 x += LEVEL_WIDTH; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1008 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1009 |
12676
d1ed749a9ce5
(svn r17131) -Codechange: apply coding style to some switch statements
smatz <smatz@openttd.org>
parents:
12632
diff
changeset
|
1010 switch (this->flags & SEF_KIND_MASK) { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1011 case SEF_SETTING_KIND: |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1012 if (cur_row >= first_row) { |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1013 DrawSetting(settings_ptr, this->d.entry.setting, x, y, max_x, this->flags & SEF_BUTTONS_MASK); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1014 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1015 cur_row++; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1016 break; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1017 case SEF_SUBTREE_KIND: |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1018 if (cur_row >= first_row) { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1019 DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, x, y); |
11770
534c3c3167f2
(svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents:
11762
diff
changeset
|
1020 DrawString(x + 12, max_x, y, this->d.sub.title); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1021 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1022 cur_row++; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1023 if (!this->d.sub.folded) { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1024 if (this->flags & SEF_LAST_FIELD) { |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1025 assert(this->level < sizeof(parent_last)); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1026 SetBit(parent_last, this->level); // Add own last-field state |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1027 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1028 |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1029 cur_row = this->d.sub.page->Draw(settings_ptr, base_x, base_y, max_x, first_row, max_row, cur_row, parent_last); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1030 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1031 break; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1032 default: NOT_REACHED(); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1033 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1034 return cur_row; |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1035 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1036 |
12022
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1037 const void *ResolveVariableAddress(const GameSettings *settings_ptr, const SettingDesc *sd) |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1038 { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1039 if ((sd->desc.flags & SGF_PER_COMPANY) != 0) { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1040 if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1041 return GetVariableAddress(&Company::Get(_local_company)->settings, &sd->save); |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1042 } else { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1043 return GetVariableAddress(&_settings_client.company, &sd->save); |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1044 } |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1045 } else { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1046 return GetVariableAddress(settings_ptr, &sd->save); |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1047 } |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1048 } |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1049 |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1050 /** |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1051 * Private function to draw setting value (button + text + current value) |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1052 * @param settings_ptr Pointer to current values of all settings |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1053 * @param sd Pointer to value description of setting to draw |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1054 * @param x Left-most position in window/panel to start drawing |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1055 * @param y Upper-most position in window/panel to start drawing |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1056 * @param max_x The maximum x position to draw strings add. |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1057 * @param state State of the left + right arrow buttons to draw for the setting |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1058 */ |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1059 void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd, int x, int y, int max_x, int state) |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1060 { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1061 const SettingDescBase *sdb = &sd->desc; |
12022
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1062 const void *var = ResolveVariableAddress(settings_ptr, sd); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1063 bool editable = true; |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1064 bool disabled = false; |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1065 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1066 /* We do not allow changes of some items when we are a client in a networkgame */ |
12024
ca8b215793c4
(svn r16431) -Fix (16429): Company settings can also be changed in multiplayer games
yexo <yexo@openttd.org>
parents:
12022
diff
changeset
|
1067 if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server && !(sdb->flags & SGF_PER_COMPANY)) editable = false; |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1068 if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false; |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1069 if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false; |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1070 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1071 if (sdb->cmd == SDT_BOOLX) { |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11075
diff
changeset
|
1072 static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}}; |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1073 /* Draw checkbox for boolean-value either on/off */ |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1074 bool on = (*(bool*)var); |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1075 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1076 DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE); |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1077 SetDParam(0, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1078 } else { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1079 int32 value; |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1080 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1081 value = (int32)ReadValue(var, sd->save.conv); |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1082 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1083 /* Draw [<][>] boxes for settings of an integer-type */ |
11897
b29337cb73a4
(svn r16297) -Codechange: silence more ICC warnings
rubidium <rubidium@openttd.org>
parents:
11770
diff
changeset
|
1084 DrawArrowButtons(x, y, COLOUR_YELLOW, state, editable && value != (sdb->flags & SGF_0ISDISABLED ? 0 : sdb->min), editable && (uint32)value != sdb->max); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1085 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1086 disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED); |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1087 if (disabled) { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1088 SetDParam(0, STR_CONFIG_SETTING_DISABLED); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1089 } else { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1090 if (sdb->flags & SGF_CURRENCY) { |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1091 SetDParam(0, STR_JUST_CURRENCY); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1092 } else if (sdb->flags & SGF_MULTISTRING) { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1093 SetDParam(0, sdb->str + value + 1); |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1094 } else { |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1095 SetDParam(0, (sdb->flags & SGF_NOCOMMA) ? STR_JUST_INT : STR_JUST_COMMA); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1096 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1097 SetDParam(1, value); |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1098 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1099 } |
11770
534c3c3167f2
(svn r16160) -Codechange: remove the need for explicit TC_FROMSTRING for DrawString.
rubidium <rubidium@openttd.org>
parents:
11762
diff
changeset
|
1100 DrawString(x + 25, max_x, y, (sdb->str) + disabled); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1101 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1102 |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1103 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1104 /* == SettingsPage methods == */ |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1105 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1106 /** |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1107 * Initialization of an entire setting page |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1108 * @param level Nesting level of this page (internal variable, do not provide a value for it when calling) |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1109 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1110 void SettingsPage::Init(byte level) |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1111 { |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1112 for (uint field = 0; field < this->num; field++) { |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1113 this->entries[field].Init(level, field + 1 == num); |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1114 } |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
1115 } |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
1116 |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1117 /** Recursively close all folds of sub-pages */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1118 void SettingsPage::FoldAll() |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1119 { |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1120 for (uint field = 0; field < this->num; field++) { |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1121 this->entries[field].FoldAll(); |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1122 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1123 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1124 |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1125 /** Return number of rows needed to display the whole page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1126 uint SettingsPage::Length() const |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1127 { |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1128 uint length = 0; |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1129 for (uint field = 0; field < this->num; field++) { |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1130 length += this->entries[field].Length(); |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1131 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1132 return length; |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1133 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1134 |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1135 /** |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1136 * Find the setting entry at row number \a row_num |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1137 * @param row_num Index of entry to return |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1138 * @param cur_row Variable used for keeping track of the current row number. Should point to memory initialized to \c 0 when first called. |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1139 * @return The requested setting entry or \c NULL if it does not exist |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1140 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1141 SettingEntry *SettingsPage::FindEntry(uint row_num, uint *cur_row) const |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1142 { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1143 SettingEntry *pe = NULL; |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1144 |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1145 for (uint field = 0; field < this->num; field++) { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1146 pe = this->entries[field].FindEntry(row_num, cur_row); |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1147 if (pe != NULL) { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1148 break; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1149 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1150 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1151 return pe; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1152 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1153 |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1154 /** |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1155 * Draw a selected part of the settings page. |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1156 * |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1157 * The scrollbar uses rows of the page, while the page data strucure is a tree of #SettingsPage and #SettingEntry objects. |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1158 * As a result, the drawing routing traverses the tree from top to bottom, counting rows in \a cur_row until it reaches \a first_row. |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1159 * Then it enables drawing rows while traversing until \a max_row is reached, at which point drawing is terminated. |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1160 * |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1161 * @param settings_ptr Pointer to current values of all settings |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1162 * @param base_x Left-most position in window/panel to start drawing of each setting row |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1163 * @param base_y Upper-most position in window/panel to start drawing of row number \a first_row |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1164 * @param max_x The maximum x position to draw strings add. |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1165 * @param first_row Number of first row to draw |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1166 * @param max_row Row-number to stop drawing (the row-number of the row below the last row to draw) |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1167 * @param cur_row Current row number (internal variable) |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1168 * @param parent_last Last-field booleans of parent page level (page level \e i sets bit \e i to 1 if it is its last field) |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1169 * @return Row number of the next row to draw |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1170 */ |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1171 uint SettingsPage::Draw(GameSettings *settings_ptr, int base_x, int base_y, int max_x, uint first_row, uint max_row, uint cur_row, uint parent_last) const |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1172 { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1173 if (cur_row >= max_row) return cur_row; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1174 |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1175 for (uint i = 0; i < this->num; i++) { |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1176 cur_row = this->entries[i].Draw(settings_ptr, base_x, base_y, max_x, first_row, max_row, cur_row, parent_last); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1177 if (cur_row >= max_row) { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1178 break; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1179 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1180 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1181 return cur_row; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1182 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1183 |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
1184 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1185 static SettingEntry _settings_ui_display[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1186 SettingEntry("gui.vehicle_speed"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1187 SettingEntry("gui.status_long_date"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1188 SettingEntry("gui.date_format_in_default_names"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1189 SettingEntry("gui.population_in_label"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1190 SettingEntry("gui.measure_tooltip"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1191 SettingEntry("gui.loading_indicators"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1192 SettingEntry("gui.liveries"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1193 SettingEntry("gui.show_track_reservation"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1194 SettingEntry("gui.expenses_layout"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1195 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1196 /** Display options sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1197 static SettingsPage _settings_ui_display_page = {_settings_ui_display, lengthof(_settings_ui_display)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1198 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1199 static SettingEntry _settings_ui_interaction[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1200 SettingEntry("gui.window_snap_radius"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1201 SettingEntry("gui.window_soft_limit"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1202 SettingEntry("gui.link_terraform_toolbar"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1203 SettingEntry("gui.prefer_teamchat"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1204 SettingEntry("gui.autoscroll"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1205 SettingEntry("gui.reverse_scroll"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1206 SettingEntry("gui.smooth_scroll"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1207 SettingEntry("gui.left_mouse_btn_scrolling"), |
6289
7830dc08984a
(svn r9111) -Feature: [OSX] mighty mice and touchpads can now scroll the map (in all directions)
bjarni <bjarni@openttd.org>
parents:
6259
diff
changeset
|
1208 /* While the horizontal scrollwheel scrolling is written as general code, only |
7830dc08984a
(svn r9111) -Feature: [OSX] mighty mice and touchpads can now scroll the map (in all directions)
bjarni <bjarni@openttd.org>
parents:
6259
diff
changeset
|
1209 * the cocoa (OSX) driver generates input for it. |
6296
94f5e47fddaa
(svn r9126) -Feature: "Function of scrollwheel" can now be set to off as well
bjarni <bjarni@openttd.org>
parents:
6293
diff
changeset
|
1210 * Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1211 SettingEntry("gui.scrollwheel_scrolling"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1212 SettingEntry("gui.scrollwheel_multiplier"), |
7485
f7dd4bbc720d
(svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni <bjarni@openttd.org>
parents:
7341
diff
changeset
|
1213 #ifdef __APPLE__ |
f7dd4bbc720d
(svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni <bjarni@openttd.org>
parents:
7341
diff
changeset
|
1214 /* We might need to emulate a right mouse button on mac */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1215 SettingEntry("gui.right_mouse_btn_emulation"), |
7485
f7dd4bbc720d
(svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni <bjarni@openttd.org>
parents:
7341
diff
changeset
|
1216 #endif |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1217 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1218 /** Interaction sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1219 static SettingsPage _settings_ui_interaction_page = {_settings_ui_interaction, lengthof(_settings_ui_interaction)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1220 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1221 static SettingEntry _settings_ui[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1222 SettingEntry(&_settings_ui_display_page, STR_CONFIG_SETTING_DISPLAY_OPTIONS), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1223 SettingEntry(&_settings_ui_interaction_page, STR_CONFIG_SETTING_INTERACTION), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1224 SettingEntry("gui.show_finances"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1225 SettingEntry("gui.errmsg_duration"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1226 SettingEntry("gui.toolbar_pos"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1227 SettingEntry("gui.pause_on_newgame"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1228 SettingEntry("gui.advanced_vehicle_list"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1229 SettingEntry("gui.timetable_in_ticks"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1230 SettingEntry("gui.quick_goto"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1231 SettingEntry("gui.default_rail_type"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1232 SettingEntry("gui.always_build_infrastructure"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1233 SettingEntry("gui.persistent_buildingtools"), |
11085
8da1855e9f14
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents:
11075
diff
changeset
|
1234 SettingEntry("gui.coloured_news_year"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1235 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1236 /** Interface subpage */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1237 static SettingsPage _settings_ui_page = {_settings_ui, lengthof(_settings_ui)}; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1238 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1239 static SettingEntry _settings_construction_signals[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1240 SettingEntry("construction.signal_side"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1241 SettingEntry("gui.enable_signal_gui"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1242 SettingEntry("gui.drag_signals_density"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1243 SettingEntry("gui.semaphore_build_before"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1244 SettingEntry("gui.default_signal_type"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1245 SettingEntry("gui.cycle_signal_types"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1246 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1247 /** Signals subpage */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1248 static SettingsPage _settings_construction_signals_page = {_settings_construction_signals, lengthof(_settings_construction_signals)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1249 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1250 static SettingEntry _settings_construction[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1251 SettingEntry(&_settings_construction_signals_page, STR_CONFIG_SETTING_CONSTRUCTION_SIGNALS), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1252 SettingEntry("construction.build_on_slopes"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1253 SettingEntry("construction.autoslope"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1254 SettingEntry("construction.extra_dynamite"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1255 SettingEntry("construction.longbridges"), |
12200
abcb7c9c1d4d
(svn r16614) -Codechange: Make the airport min/max available year a property of the Airport class.
yexo <yexo@openttd.org>
parents:
12067
diff
changeset
|
1256 SettingEntry("station.never_expire_airports"), |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1257 SettingEntry("construction.freeform_edges"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1258 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1259 /** Construction sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1260 static SettingsPage _settings_construction_page = {_settings_construction, lengthof(_settings_construction)}; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1261 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1262 static SettingEntry _settings_stations_cargo[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1263 SettingEntry("order.improved_load"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1264 SettingEntry("order.gradual_loading"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1265 SettingEntry("order.selectgoods"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1266 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1267 /** Cargo handling sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1268 static SettingsPage _settings_stations_cargo_page = {_settings_stations_cargo, lengthof(_settings_stations_cargo)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1269 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1270 static SettingEntry _settings_stations[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1271 SettingEntry(&_settings_stations_cargo_page, STR_CONFIG_SETTING_STATIONS_CARGOHANDLING), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1272 SettingEntry("station.join_stations"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1273 SettingEntry("station.nonuniform_stations"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1274 SettingEntry("station.adjacent_stations"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1275 SettingEntry("station.distant_join_stations"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1276 SettingEntry("station.station_spread"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1277 SettingEntry("economy.station_noise_level"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1278 SettingEntry("station.modified_catchment"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1279 SettingEntry("construction.road_stop_on_town_road"), |
11252
f7b6f8f03e5e
(svn r15601) -Fix [FS#2615]: bridges/tunnels don't store tram owner making it possible to remove someone's tram tracks.
rubidium <rubidium@openttd.org>
parents:
11217
diff
changeset
|
1280 SettingEntry("construction.road_stop_on_competitor_road"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1281 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1282 /** Stations sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1283 static SettingsPage _settings_stations_page = {_settings_stations, lengthof(_settings_stations)}; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1284 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1285 static SettingEntry _settings_economy_towns[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1286 SettingEntry("economy.bribe"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1287 SettingEntry("economy.exclusive_rights"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1288 SettingEntry("economy.town_layout"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1289 SettingEntry("economy.allow_town_roads"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1290 SettingEntry("economy.mod_road_rebuild"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1291 SettingEntry("economy.town_growth_rate"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1292 SettingEntry("economy.larger_towns"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1293 SettingEntry("economy.initial_city_size"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1294 }; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1295 /** Towns sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1296 static SettingsPage _settings_economy_towns_page = {_settings_economy_towns, lengthof(_settings_economy_towns)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1297 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1298 static SettingEntry _settings_economy_industries[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1299 SettingEntry("construction.raw_industry_construction"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1300 SettingEntry("economy.multiple_industry_per_town"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1301 SettingEntry("economy.same_industry_close"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1302 SettingEntry("game_creation.oil_refinery_limit"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1303 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1304 /** Industries sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1305 static SettingsPage _settings_economy_industries_page = {_settings_economy_industries, lengthof(_settings_economy_industries)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1306 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1307 static SettingEntry _settings_economy[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1308 SettingEntry(&_settings_economy_towns_page, STR_CONFIG_SETTING_ECONOMY_TOWNS), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1309 SettingEntry(&_settings_economy_industries_page, STR_CONFIG_SETTING_ECONOMY_INDUSTRIES), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1310 SettingEntry("economy.inflation"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1311 SettingEntry("economy.smooth_economy"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1312 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1313 /** Economy sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1314 static SettingsPage _settings_economy_page = {_settings_economy, lengthof(_settings_economy)}; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1315 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1316 static SettingEntry _settings_ai_npc[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1317 SettingEntry("ai.ai_in_multiplayer"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1318 SettingEntry("ai.ai_disable_veh_train"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1319 SettingEntry("ai.ai_disable_veh_roadveh"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1320 SettingEntry("ai.ai_disable_veh_aircraft"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1321 SettingEntry("ai.ai_disable_veh_ship"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1322 SettingEntry("ai.ai_max_opcode_till_suspend"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1323 }; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1324 /** Computer players sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1325 static SettingsPage _settings_ai_npc_page = {_settings_ai_npc, lengthof(_settings_ai_npc)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1326 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1327 static SettingEntry _settings_ai[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1328 SettingEntry(&_settings_ai_npc_page, STR_CONFIG_SETTING_AI_NPC), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1329 SettingEntry("economy.give_money"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1330 SettingEntry("economy.allow_shares"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1331 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1332 /** AI sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1333 static SettingsPage _settings_ai_page = {_settings_ai, lengthof(_settings_ai)}; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1334 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1335 static SettingEntry _settings_vehicles_routing[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1336 SettingEntry("pf.pathfinder_for_trains"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1337 SettingEntry("pf.forbid_90_deg"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1338 SettingEntry("pf.pathfinder_for_roadvehs"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1339 SettingEntry("pf.roadveh_queue"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1340 SettingEntry("pf.pathfinder_for_ships"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1341 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1342 /** Autorenew sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1343 static SettingsPage _settings_vehicles_routing_page = {_settings_vehicles_routing, lengthof(_settings_vehicles_routing)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1344 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1345 static SettingEntry _settings_vehicles_autorenew[] = { |
11913
f67b6243e05a
(svn r16315) -Codechange: move the autorenew settings to a new CompanySettings struct
yexo <yexo@openttd.org>
parents:
11897
diff
changeset
|
1346 SettingEntry("company.engine_renew"), |
f67b6243e05a
(svn r16315) -Codechange: move the autorenew settings to a new CompanySettings struct
yexo <yexo@openttd.org>
parents:
11897
diff
changeset
|
1347 SettingEntry("company.engine_renew_months"), |
f67b6243e05a
(svn r16315) -Codechange: move the autorenew settings to a new CompanySettings struct
yexo <yexo@openttd.org>
parents:
11897
diff
changeset
|
1348 SettingEntry("company.engine_renew_money"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1349 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1350 /** Autorenew sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1351 static SettingsPage _settings_vehicles_autorenew_page = {_settings_vehicles_autorenew, lengthof(_settings_vehicles_autorenew)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1352 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1353 static SettingEntry _settings_vehicles_servicing[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1354 SettingEntry("vehicle.servint_ispercent"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1355 SettingEntry("vehicle.servint_trains"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1356 SettingEntry("vehicle.servint_roadveh"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1357 SettingEntry("vehicle.servint_ships"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1358 SettingEntry("vehicle.servint_aircraft"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1359 SettingEntry("order.no_servicing_if_no_breakdowns"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1360 SettingEntry("order.serviceathelipad"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1361 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1362 /** Servicing sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1363 static SettingsPage _settings_vehicles_servicing_page = {_settings_vehicles_servicing, lengthof(_settings_vehicles_servicing)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1364 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1365 static SettingEntry _settings_vehicles_trains[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1366 SettingEntry("vehicle.train_acceleration_model"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1367 SettingEntry("vehicle.mammoth_trains"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1368 SettingEntry("gui.lost_train_warn"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1369 SettingEntry("vehicle.wagon_speed_limits"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1370 SettingEntry("vehicle.disable_elrails"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1371 SettingEntry("vehicle.freight_trains"), |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
1372 SettingEntry("gui.stop_location"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1373 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1374 /** Trains sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1375 static SettingsPage _settings_vehicles_trains_page = {_settings_vehicles_trains, lengthof(_settings_vehicles_trains)}; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1376 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1377 static SettingEntry _settings_vehicles[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1378 SettingEntry(&_settings_vehicles_routing_page, STR_CONFIG_SETTING_VEHICLES_ROUTING), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1379 SettingEntry(&_settings_vehicles_autorenew_page, STR_CONFIG_SETTING_VEHICLES_AUTORENEW), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1380 SettingEntry(&_settings_vehicles_servicing_page, STR_CONFIG_SETTING_VEHICLES_SERVICING), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1381 SettingEntry(&_settings_vehicles_trains_page, STR_CONFIG_SETTING_VEHICLES_TRAINS), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1382 SettingEntry("order.gotodepot"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1383 SettingEntry("gui.new_nonstop"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1384 SettingEntry("gui.order_review_system"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1385 SettingEntry("gui.vehicle_income_warn"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1386 SettingEntry("vehicle.never_expire_vehicles"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1387 SettingEntry("vehicle.max_trains"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1388 SettingEntry("vehicle.max_roadveh"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1389 SettingEntry("vehicle.max_aircraft"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1390 SettingEntry("vehicle.max_ships"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1391 SettingEntry("vehicle.plane_speed"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1392 SettingEntry("order.timetabling"), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1393 SettingEntry("vehicle.dynamic_engines"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1394 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1395 /** Vehicles sub-page */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1396 static SettingsPage _settings_vehicles_page = {_settings_vehicles, lengthof(_settings_vehicles)}; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1397 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1398 static SettingEntry _settings_main[] = { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1399 SettingEntry(&_settings_ui_page, STR_CONFIG_SETTING_GUI), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1400 SettingEntry(&_settings_construction_page, STR_CONFIG_SETTING_CONSTRUCTION), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1401 SettingEntry(&_settings_vehicles_page, STR_CONFIG_SETTING_VEHICLES), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1402 SettingEntry(&_settings_stations_page, STR_CONFIG_SETTING_STATIONS), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1403 SettingEntry(&_settings_economy_page, STR_CONFIG_SETTING_ECONOMY), |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1404 SettingEntry(&_settings_ai_page, STR_CONFIG_SETTING_AI), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1405 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1406 |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1407 /** Main page, holding all advanced settings */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1408 static SettingsPage _settings_main_page = {_settings_main, lengthof(_settings_main)}; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1409 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1410 /** Widget numbers of settings window */ |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1411 enum GameSettingsWidgets { |
11697
ef293835ecc2
(svn r16082) -Codechange: Completed the widget numbers of the advanced settings window.
alberth <alberth@openttd.org>
parents:
11657
diff
changeset
|
1412 SETTINGSEL_CLOSEBOX, ///< Close box at top-left |
ef293835ecc2
(svn r16082) -Codechange: Completed the widget numbers of the advanced settings window.
alberth <alberth@openttd.org>
parents:
11657
diff
changeset
|
1413 SETTINGSEL_CAPTION, ///< Title bar |
ef293835ecc2
(svn r16082) -Codechange: Completed the widget numbers of the advanced settings window.
alberth <alberth@openttd.org>
parents:
11657
diff
changeset
|
1414 SETTINGSEL_OPTIONSPANEL, ///< Panel widget containing the option lists |
ef293835ecc2
(svn r16082) -Codechange: Completed the widget numbers of the advanced settings window.
alberth <alberth@openttd.org>
parents:
11657
diff
changeset
|
1415 SETTINGSEL_SCROLLBAR, ///< Scrollbar |
ef293835ecc2
(svn r16082) -Codechange: Completed the widget numbers of the advanced settings window.
alberth <alberth@openttd.org>
parents:
11657
diff
changeset
|
1416 SETTINGSEL_RESIZE, ///< Resize button |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1417 }; |
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1418 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1419 struct GameSettingsWindow : Window { |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1420 static const int SETTINGTREE_LEFT_OFFSET; ///< Position of left edge of setting values |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1421 static const int SETTINGTREE_TOP_OFFSET; ///< Position of top edge of setting values |
10540
ad93cc8a687f
(svn r14797) -Codechange: replace even more magic numbers with constants (Alberth)
rubidium <rubidium@openttd.org>
parents:
10539
diff
changeset
|
1422 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1423 static GameSettings *settings_ptr; ///< Pointer to the game settings being displayed and modified |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1424 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1425 SettingEntry *valuewindow_entry; ///< If non-NULL, pointer to setting for which a value-entering window has been opened |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1426 SettingEntry *clicked_entry; ///< If non-NULL, pointer to a clicked numeric setting (with a depressed left or right button) |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1427 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1428 GameSettingsWindow(const WindowDesc *desc) : Window(desc) |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1429 { |
10540
ad93cc8a687f
(svn r14797) -Codechange: replace even more magic numbers with constants (Alberth)
rubidium <rubidium@openttd.org>
parents:
10539
diff
changeset
|
1430 /* Check that the widget doesn't get moved without adapting the constant as well. |
ad93cc8a687f
(svn r14797) -Codechange: replace even more magic numbers with constants (Alberth)
rubidium <rubidium@openttd.org>
parents:
10539
diff
changeset
|
1431 * - SETTINGTREE_LEFT_OFFSET should be 5 pixels to the right of the left edge of the panel |
ad93cc8a687f
(svn r14797) -Codechange: replace even more magic numbers with constants (Alberth)
rubidium <rubidium@openttd.org>
parents:
10539
diff
changeset
|
1432 * - SETTINGTREE_TOP_OFFSET should be 5 pixels below the top edge of the panel |
ad93cc8a687f
(svn r14797) -Codechange: replace even more magic numbers with constants (Alberth)
rubidium <rubidium@openttd.org>
parents:
10539
diff
changeset
|
1433 */ |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1434 assert(this->widget[SETTINGSEL_OPTIONSPANEL].left + 5 == SETTINGTREE_LEFT_OFFSET); |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1435 assert(this->widget[SETTINGSEL_OPTIONSPANEL].top + 5 == SETTINGTREE_TOP_OFFSET); |
10540
ad93cc8a687f
(svn r14797) -Codechange: replace even more magic numbers with constants (Alberth)
rubidium <rubidium@openttd.org>
parents:
10539
diff
changeset
|
1436 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1437 static bool first_time = true; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1438 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1439 settings_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1440 |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1441 /* Build up the dynamic settings-array only once per OpenTTD session */ |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1442 if (first_time) { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1443 _settings_main_page.Init(); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1444 first_time = false; |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1445 } else { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1446 _settings_main_page.FoldAll(); // Close all sub-pages |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1447 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1448 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1449 this->valuewindow_entry = NULL; // No setting entry for which a entry window is opened |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1450 this->clicked_entry = NULL; // No numeric setting buttons are depressed |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1451 this->vscroll.pos = 0; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1452 this->vscroll.cap = (this->widget[SETTINGSEL_OPTIONSPANEL].bottom - this->widget[SETTINGSEL_OPTIONSPANEL].top - 8) / SETTING_HEIGHT; |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1453 SetVScrollCount(this, _settings_main_page.Length()); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1454 |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1455 this->resize.step_height = SETTING_HEIGHT; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1456 this->resize.height = this->height; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1457 this->resize.step_width = 1; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1458 this->resize.width = this->width; |
8593
90ffef351faa
(svn r12174) -Codechange: Make the patches window dynamically resize to the largest patch tab, so adding patch options is simply a case of adding to the lists.
peter1138 <peter1138@openttd.org>
parents:
8551
diff
changeset
|
1459 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1460 this->FindWindowPlacementAndResize(desc); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1461 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1462 |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1463 virtual void OnPaint() |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1464 { |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9246
diff
changeset
|
1465 this->DrawWidgets(); |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1466 _settings_main_page.Draw(settings_ptr, SETTINGTREE_LEFT_OFFSET, SETTINGTREE_TOP_OFFSET, |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
1467 this->width - 13, this->vscroll.pos, this->vscroll.pos + this->vscroll.cap); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1468 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1469 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1470 virtual void OnClick(Point pt, int widget) |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1471 { |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1472 if (widget != SETTINGSEL_OPTIONSPANEL) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1473 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1474 int y = pt.y - SETTINGTREE_TOP_OFFSET; // Shift y coordinate |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1475 if (y < 0) return; // Clicked above first entry |
10541
9742f1fb3d1b
(svn r14798) -Codechange: move variable declaration to first use of variable (Alberth)
rubidium <rubidium@openttd.org>
parents:
10540
diff
changeset
|
1476 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1477 byte btn = this->vscroll.pos + y / SETTING_HEIGHT; // Compute which setting is selected |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1478 if (y % SETTING_HEIGHT > SETTING_HEIGHT - 2) return; // Clicked too low at the setting |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1479 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1480 uint cur_row = 0; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1481 SettingEntry *pe = _settings_main_page.FindEntry(btn, &cur_row); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1482 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1483 if (pe == NULL) return; // Clicked below the last setting of the page |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1484 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1485 int x = pt.x - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH; // Shift x coordinate |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1486 if (x < 0) return; // Clicked left of the entry |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1487 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1488 if ((pe->flags & SEF_KIND_MASK) == SEF_SUBTREE_KIND) { |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1489 pe->d.sub.folded = !pe->d.sub.folded; // Flip 'folded'-ness of the sub-page |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1490 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1491 SetVScrollCount(this, _settings_main_page.Length()); |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1492 this->SetDirty(); |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1493 return; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1494 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1495 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1496 assert((pe->flags & SEF_KIND_MASK) == SEF_SETTING_KIND); |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1497 const SettingDesc *sd = pe->d.entry.setting; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1498 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1499 /* return if action is only active in network, or only settable by server */ |
12024
ca8b215793c4
(svn r16431) -Fix (16429): Company settings can also be changed in multiplayer games
yexo <yexo@openttd.org>
parents:
12022
diff
changeset
|
1500 if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server && !(sd->desc.flags & SGF_PER_COMPANY)) return; |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1501 if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1502 if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1503 |
12022
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1504 const void *var = ResolveVariableAddress(settings_ptr, sd); |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1505 int32 value = (int32)ReadValue(var, sd->save.conv); |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1506 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1507 /* clicked on the icon on the left side. Either scroller or bool on/off */ |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1508 if (x < 21) { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1509 const SettingDescBase *sdb = &sd->desc; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1510 int32 oldvalue = value; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1511 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1512 switch (sdb->cmd) { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1513 case SDT_BOOLX: value ^= 1; break; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1514 case SDT_ONEOFMANY: |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1515 case SDT_NUMX: { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1516 /* Add a dynamic step-size to the scroller. In a maximum of |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1517 * 50-steps you should be able to get from min to max, |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1518 * unless specified otherwise in the 'interval' variable |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1519 * of the current setting. */ |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1520 uint32 step = (sdb->interval == 0) ? ((sdb->max - sdb->min) / 50) : sdb->interval; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1521 if (step == 0) step = 1; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1522 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1523 /* don't allow too fast scrolling */ |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1524 if ((this->flags4 & WF_TIMEOUT_MASK) > WF_TIMEOUT_TRIGGER) { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1525 _left_button_clicked = false; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1526 return; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1527 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1528 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1529 /* Increase or decrease the value and clamp it to extremes */ |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1530 if (x >= 10) { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1531 value += step; |
12357
8fe6b4cef297
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
rubidium <rubidium@openttd.org>
parents:
12272
diff
changeset
|
1532 if (sdb->min < 0) { |
8fe6b4cef297
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
rubidium <rubidium@openttd.org>
parents:
12272
diff
changeset
|
1533 assert((int32)sdb->max >= 0); |
8fe6b4cef297
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
rubidium <rubidium@openttd.org>
parents:
12272
diff
changeset
|
1534 if (value > (int32)sdb->max) value = (int32)sdb->max; |
8fe6b4cef297
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
rubidium <rubidium@openttd.org>
parents:
12272
diff
changeset
|
1535 } else { |
8fe6b4cef297
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
rubidium <rubidium@openttd.org>
parents:
12272
diff
changeset
|
1536 if ((uint32)value > sdb->max) value = (int32)sdb->max; |
8fe6b4cef297
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
rubidium <rubidium@openttd.org>
parents:
12272
diff
changeset
|
1537 } |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1538 if (value < sdb->min) value = sdb->min; // skip between "disabled" and minimum |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1539 } else { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1540 value -= step; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1541 if (value < sdb->min) value = (sdb->flags & SGF_0ISDISABLED) ? 0 : sdb->min; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1542 } |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1543 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1544 /* Set up scroller timeout for numeric values */ |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1545 if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1546 if (this->clicked_entry != NULL) { // Release previous buttons if any |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1547 this->clicked_entry->SetButtons(0); |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1548 } |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1549 this->clicked_entry = pe; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1550 this->clicked_entry->SetButtons((x >= 10) ? SEF_RIGHT_DEPRESSED : SEF_LEFT_DEPRESSED); |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1551 this->flags4 |= WF_TIMEOUT_BEGIN; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1552 _left_button_clicked = false; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1553 } |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1554 } break; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1555 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1556 default: NOT_REACHED(); |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1557 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1558 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1559 if (value != oldvalue) { |
12022
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1560 if ((sd->desc.flags & SGF_PER_COMPANY) != 0) { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1561 SetCompanySetting(pe->d.entry.index, value); |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1562 } else { |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1563 SetSettingValue(pe->d.entry.index, value); |
6258c029db2d
(svn r16429) -Change: Make the company settings behave like all others settings: the default set in the main menu / config file is now really the default for a new company, and changing the value in game will no longer change the default for new companies.
yexo <yexo@openttd.org>
parents:
11973
diff
changeset
|
1564 } |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1565 this->SetDirty(); |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1566 } |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1567 } else { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1568 /* only open editbox for types that its sensible for */ |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1569 if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1570 /* Show the correct currency-translated value */ |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1571 if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1572 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1573 this->valuewindow_entry = pe; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1574 SetDParam(0, value); |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1575 ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, 100, this, CS_NUMERAL, QSF_NONE); |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1576 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1577 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1578 } |
8190
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
1579 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1580 virtual void OnTimeout() |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1581 { |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1582 if (this->clicked_entry != NULL) { // On timeout, release any depressed buttons |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1583 this->clicked_entry->SetButtons(0); |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1584 this->clicked_entry = NULL; |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1585 this->SetDirty(); |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1586 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1587 } |
8190
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
1588 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1589 virtual void OnQueryTextFinished(char *str) |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1590 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1591 if (!StrEmpty(str)) { |
10663
41ac7281100a
(svn r14965) -Codechange: remember the patch entry instead of the page and index of the entry for handling the "input box" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10662
diff
changeset
|
1592 assert(this->valuewindow_entry != NULL); |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1593 assert((this->valuewindow_entry->flags & SEF_KIND_MASK) == SEF_SETTING_KIND); |
10663
41ac7281100a
(svn r14965) -Codechange: remember the patch entry instead of the page and index of the entry for handling the "input box" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10662
diff
changeset
|
1594 const SettingDesc *sd = this->valuewindow_entry->d.entry.setting; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1595 int32 value = atoi(str); |
8190
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
1596 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1597 /* Save the correct currency-translated value */ |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1598 if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1599 |
12067
43d8d69b7a31
(svn r16474) -Fix [FS#2933]: could set company related settings via query window
rubidium <rubidium@openttd.org>
parents:
12024
diff
changeset
|
1600 if ((sd->desc.flags & SGF_PER_COMPANY) != 0) { |
43d8d69b7a31
(svn r16474) -Fix [FS#2933]: could set company related settings via query window
rubidium <rubidium@openttd.org>
parents:
12024
diff
changeset
|
1601 SetCompanySetting(this->valuewindow_entry->d.entry.index, value); |
43d8d69b7a31
(svn r16474) -Fix [FS#2933]: could set company related settings via query window
rubidium <rubidium@openttd.org>
parents:
12024
diff
changeset
|
1602 } else { |
43d8d69b7a31
(svn r16474) -Fix [FS#2933]: could set company related settings via query window
rubidium <rubidium@openttd.org>
parents:
12024
diff
changeset
|
1603 SetSettingValue(this->valuewindow_entry->d.entry.index, value); |
43d8d69b7a31
(svn r16474) -Fix [FS#2933]: could set company related settings via query window
rubidium <rubidium@openttd.org>
parents:
12024
diff
changeset
|
1604 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1605 this->SetDirty(); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1606 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1607 } |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1608 |
11524
420a4f0b4e0b
(svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
alberth <alberth@openttd.org>
parents:
11513
diff
changeset
|
1609 virtual void OnResize(Point delta) |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1610 { |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1611 this->vscroll.cap += delta.y / SETTING_HEIGHT; |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1612 SetVScrollCount(this, _settings_main_page.Length()); |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1613 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1614 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1615 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1616 GameSettings *GameSettingsWindow::settings_ptr = NULL; |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1617 const int GameSettingsWindow::SETTINGTREE_LEFT_OFFSET = 5; |
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1618 const int GameSettingsWindow::SETTINGTREE_TOP_OFFSET = 19; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1619 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1620 static const Widget _settings_selection_widgets[] = { |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
1621 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_MAUVE, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // SETTINGSEL_CLOSEBOX |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
1622 { WWT_CAPTION, RESIZE_RIGHT, COLOUR_MAUVE, 11, 411, 0, 13, STR_CONFIG_SETTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // SETTINGSEL_CAPTION |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
1623 { WWT_PANEL, RESIZE_RB, COLOUR_MAUVE, 0, 399, 14, 187, 0x0, STR_NULL}, // SETTINGSEL_OPTIONSPANEL |
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11697
diff
changeset
|
1624 { WWT_SCROLLBAR, RESIZE_LRB, COLOUR_MAUVE, 400, 411, 14, 175, 0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // SETTINGSEL_SCROLLBAR |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1625 { WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_MAUVE, 400, 411, 176, 187, 0x0, STR_TOOLTIP_RESIZE}, // SETTINGSEL_RESIZE |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1626 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1627 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1628 |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1629 static const NWidgetPart _nested_settings_selection_widgets[] = { |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1630 NWidget(NWID_HORIZONTAL), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1631 NWidget(WWT_CLOSEBOX, COLOUR_MAUVE, SETTINGSEL_CLOSEBOX), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1632 NWidget(WWT_CAPTION, COLOUR_MAUVE, SETTINGSEL_CAPTION), SetDataTip(STR_CONFIG_SETTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1633 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1634 NWidget(NWID_HORIZONTAL), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1635 NWidget(WWT_PANEL, COLOUR_MAUVE, SETTINGSEL_OPTIONSPANEL), SetMinimalSize(400, 174), SetResize(1, SETTING_HEIGHT), EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1636 NWidget(NWID_VERTICAL), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1637 NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, SETTINGSEL_SCROLLBAR), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1638 NWidget(WWT_RESIZEBOX, COLOUR_MAUVE, SETTINGSEL_RESIZE), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1639 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1640 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1641 }; |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1642 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1643 static const WindowDesc _settings_selection_desc( |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1644 WDP_CENTER, WDP_CENTER, 412, 188, 450, 397, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
1645 WC_GAME_OPTIONS, WC_NONE, |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1646 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1647 _settings_selection_widgets, _nested_settings_selection_widgets, lengthof(_nested_settings_selection_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1648 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1649 |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1650 void ShowGameSettings() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1651 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1652 DeleteWindowById(WC_GAME_OPTIONS, 0); |
11069
36d798171bfd
(svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents:
11049
diff
changeset
|
1653 new GameSettingsWindow(&_settings_selection_desc); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1654 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1655 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1656 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1657 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1658 * Draw [<][>] boxes. |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1659 * @param x the x position to draw |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1660 * @param y the y position to draw |
9871
fa16e41cec2c
(svn r14017) -Codechange: DrawArrowButtons now uses Colours enum to specify the colour of the button
belugas <belugas@openttd.org>
parents:
9793
diff
changeset
|
1661 * @param button_colour the colour of the button |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1662 * @param state 0 = none clicked, 1 = first clicked, 2 = second clicked |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1663 * @param clickable_left is the left button clickable? |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1664 * @param clickable_right is the right button clickable? |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1665 */ |
9872
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1666 void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1667 { |
10358
531cadaa0bbc
(svn r14609) -Codechange: Use supplied button colour instead of hardcoded yellow, for 'greyed out' arrow buttons. (Yorick)
peter1138 <peter1138@openttd.org>
parents:
10310
diff
changeset
|
1668 int colour = _colour_gradient[button_colour][2]; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1669 |
9871
fa16e41cec2c
(svn r14017) -Codechange: DrawArrowButtons now uses Colours enum to specify the colour of the button
belugas <belugas@openttd.org>
parents:
9793
diff
changeset
|
1670 DrawFrameRect(x, y + 1, x + 9, y + 9, button_colour, (state == 1) ? FR_LOWERED : FR_NONE); |
fa16e41cec2c
(svn r14017) -Codechange: DrawArrowButtons now uses Colours enum to specify the colour of the button
belugas <belugas@openttd.org>
parents:
9793
diff
changeset
|
1671 DrawFrameRect(x + 10, y + 1, x + 19, y + 9, button_colour, (state == 2) ? FR_LOWERED : FR_NONE); |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1672 DrawString(x, x + 9, y + 1, STR_BLACK_SMALL_ARROW_LEFT, TC_FROMSTRING, SA_CENTER); // [<] |
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1673 DrawString(x + 10, x + 19, y + 1, STR_BLACK_SMALL_ARROW_RIGHT, TC_FROMSTRING, SA_CENTER); // [>] |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1674 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1675 /* Grey out the buttons that aren't clickable */ |
9872
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1676 if (!clickable_left) { |
9871
fa16e41cec2c
(svn r14017) -Codechange: DrawArrowButtons now uses Colours enum to specify the colour of the button
belugas <belugas@openttd.org>
parents:
9793
diff
changeset
|
1677 GfxFillRect(x + 1, y + 1, x + 1 + 8, y + 8, colour, FILLRECT_CHECKER); |
9872
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1678 } |
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1679 if (!clickable_right) { |
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1680 GfxFillRect(x + 11, y + 1, x + 11 + 8, y + 8, colour, FILLRECT_CHECKER); |
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1681 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1682 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1683 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1684 /** Widget numbers of the custom currency window. */ |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1685 enum CustomCurrencyWidgets { |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1686 CUSTCURR_CLOSEBOX, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1687 CUSTCURR_CAPTION, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1688 CUSTCURR_BACKGROUND, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1689 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1690 CUSTCURR_RATE_DOWN, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1691 CUSTCURR_RATE_UP, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1692 CUSTCURR_RATE, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1693 CUSTCURR_SEPARATOR_EDIT, |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1694 CUSTCURR_SEPARATOR, |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1695 CUSTCURR_PREFIX_EDIT, |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1696 CUSTCURR_PREFIX, |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1697 CUSTCURR_SUFFIX_EDIT, |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1698 CUSTCURR_SUFFIX, |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1699 CUSTCURR_YEAR_DOWN, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1700 CUSTCURR_YEAR_UP, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1701 CUSTCURR_YEAR, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1702 CUSTCURR_PREVIEW, |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1703 }; |
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1704 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1705 struct CustomCurrencyWindow : Window { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1706 int query_widget; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1707 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1708 CustomCurrencyWindow(const WindowDesc *desc) : Window(desc) |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1709 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1710 this->FindWindowPlacementAndResize(desc); |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1711 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1712 SetButtonState(); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1713 } |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1714 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1715 void SetButtonState() |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1716 { |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1717 this->SetWidgetDisabledState(CUSTCURR_RATE_DOWN, _custom_currency.rate == 1); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1718 this->SetWidgetDisabledState(CUSTCURR_RATE_UP, _custom_currency.rate == UINT16_MAX); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1719 this->SetWidgetDisabledState(CUSTCURR_YEAR_DOWN, _custom_currency.to_euro == CF_NOEURO); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1720 this->SetWidgetDisabledState(CUSTCURR_YEAR_UP, _custom_currency.to_euro == MAX_YEAR); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1721 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1722 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1723 virtual void OnPaint() |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1724 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1725 SetDParam(0, 1); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1726 SetDParam(1, 1); |
11754
1b84d3b57f8b
(svn r16144) -Fix (r16129): setting the custom digit grouping separator required to restart OpenTTD to take effect. Now also support non 1 ASCII character custom grouping separators.
rubidium <rubidium@openttd.org>
parents:
11752
diff
changeset
|
1727 SetDParamStr(2, _custom_currency.separator); |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1728 SetDParamStr(3, _custom_currency.prefix); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1729 SetDParamStr(4, _custom_currency.suffix); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1730 SetDParam(5, _custom_currency.to_euro); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1731 this->widget[CUSTCURR_YEAR].data = (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1732 SetDParam(6, 10000); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1733 this->DrawWidgets(); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1734 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1735 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1736 virtual void OnClick(Point pt, int widget) |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1737 { |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1738 int line = 0; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1739 int len = 0; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1740 StringID str = 0; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1741 CharSetFilter afilter = CS_ALPHANUMERAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1742 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1743 switch (widget) { |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1744 case CUSTCURR_RATE_DOWN: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1745 if (_custom_currency.rate > 1) _custom_currency.rate--; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1746 if (_custom_currency.rate == 1) this->DisableWidget(CUSTCURR_RATE_DOWN); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1747 this->EnableWidget(CUSTCURR_RATE_UP); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1748 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1749 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1750 case CUSTCURR_RATE_UP: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1751 if (_custom_currency.rate < UINT16_MAX) _custom_currency.rate++; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1752 if (_custom_currency.rate == UINT16_MAX) this->DisableWidget(CUSTCURR_RATE_UP); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1753 this->EnableWidget(CUSTCURR_RATE_DOWN); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1754 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1755 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1756 case CUSTCURR_RATE: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1757 SetDParam(0, _custom_currency.rate); |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1758 str = STR_JUST_INT; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1759 len = 5; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1760 line = CUSTCURR_RATE; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1761 afilter = CS_NUMERAL; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1762 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1763 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1764 case CUSTCURR_SEPARATOR_EDIT: |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1765 case CUSTCURR_SEPARATOR: |
11754
1b84d3b57f8b
(svn r16144) -Fix (r16129): setting the custom digit grouping separator required to restart OpenTTD to take effect. Now also support non 1 ASCII character custom grouping separators.
rubidium <rubidium@openttd.org>
parents:
11752
diff
changeset
|
1766 SetDParamStr(0, _custom_currency.separator); |
9648
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9607
diff
changeset
|
1767 str = STR_JUST_RAW_STRING; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1768 len = 1; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1769 line = CUSTCURR_SEPARATOR; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1770 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1771 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1772 case CUSTCURR_PREFIX_EDIT: |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1773 case CUSTCURR_PREFIX: |
9648
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9607
diff
changeset
|
1774 SetDParamStr(0, _custom_currency.prefix); |
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9607
diff
changeset
|
1775 str = STR_JUST_RAW_STRING; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1776 len = 12; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1777 line = CUSTCURR_PREFIX; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1778 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1779 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1780 case CUSTCURR_SUFFIX_EDIT: |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1781 case CUSTCURR_SUFFIX: |
9648
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9607
diff
changeset
|
1782 SetDParamStr(0, _custom_currency.suffix); |
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9607
diff
changeset
|
1783 str = STR_JUST_RAW_STRING; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1784 len = 12; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1785 line = CUSTCURR_SUFFIX; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1786 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1787 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1788 case CUSTCURR_YEAR_DOWN: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1789 _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ? CF_NOEURO : _custom_currency.to_euro - 1; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1790 if (_custom_currency.to_euro == CF_NOEURO) this->DisableWidget(CUSTCURR_YEAR_DOWN); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1791 this->EnableWidget(CUSTCURR_YEAR_UP); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1792 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1793 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1794 case CUSTCURR_YEAR_UP: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1795 _custom_currency.to_euro = Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1796 if (_custom_currency.to_euro == MAX_YEAR) this->DisableWidget(CUSTCURR_YEAR_UP); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1797 this->EnableWidget(CUSTCURR_YEAR_DOWN); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1798 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1799 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1800 case CUSTCURR_YEAR: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1801 SetDParam(0, _custom_currency.to_euro); |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1802 str = STR_JUST_INT; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1803 len = 7; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1804 line = CUSTCURR_YEAR; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1805 afilter = CS_NUMERAL; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1806 break; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1807 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1808 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1809 if (len != 0) { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1810 this->query_widget = line; |
10145
dbe302da93a8
(svn r14331) -Codechange: use an enum as additional parameter for ShowQueryString()
smatz <smatz@openttd.org>
parents:
9872
diff
changeset
|
1811 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter, QSF_NONE); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1812 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1813 |
10180
e024f1d28082
(svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents:
10145
diff
changeset
|
1814 this->flags4 |= WF_TIMEOUT_BEGIN; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1815 this->SetDirty(); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1816 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1817 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1818 virtual void OnQueryTextFinished(char *str) |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1819 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1820 if (str == NULL) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1821 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1822 switch (this->query_widget) { |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1823 case CUSTCURR_RATE: |
10510
c317167cc7a4
(svn r14767) -Codechange: remove some unneeded artificial limits from currencies and use the bounds of the data type.
rubidium <rubidium@openttd.org>
parents:
10500
diff
changeset
|
1824 _custom_currency.rate = Clamp(atoi(str), 1, UINT16_MAX); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1825 break; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1826 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11252
diff
changeset
|
1827 case CUSTCURR_SEPARATOR: // Thousands seperator |
11754
1b84d3b57f8b
(svn r16144) -Fix (r16129): setting the custom digit grouping separator required to restart OpenTTD to take effect. Now also support non 1 ASCII character custom grouping separators.
rubidium <rubidium@openttd.org>
parents:
11752
diff
changeset
|
1828 strecpy(_custom_currency.separator, str, lastof(_custom_currency.separator)); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1829 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1830 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1831 case CUSTCURR_PREFIX: |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10234
diff
changeset
|
1832 strecpy(_custom_currency.prefix, str, lastof(_custom_currency.prefix)); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1833 break; |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1834 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1835 case CUSTCURR_SUFFIX: |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10234
diff
changeset
|
1836 strecpy(_custom_currency.suffix, str, lastof(_custom_currency.suffix)); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1837 break; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1838 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1839 case CUSTCURR_YEAR: { // Year to switch to euro |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1840 int val = atoi(str); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1841 |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1842 _custom_currency.to_euro = (val < 2000 ? CF_NOEURO : min(val, MAX_YEAR)); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1843 break; |
8188
2ca3ac32fa76
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas <belugas@openttd.org>
parents:
8182
diff
changeset
|
1844 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1845 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1846 MarkWholeScreenDirty(); |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1847 SetButtonState(); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1848 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1849 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1850 virtual void OnTimeout() |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1851 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1852 this->SetDirty(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1853 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1854 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1855 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1856 static const Widget _cust_currency_widgets[] = { |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1857 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // CUSTCURR_CLOSEBOX |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1858 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 229, 0, 13, STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // CUSTCURR_CAPTION |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1859 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 229, 14, 119, 0x0, STR_NULL}, // CUSTCURR_BACKGROUND |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1860 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1861 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 10, 19, 21, 29, STR_BLACK_SMALL_ARROW_LEFT, STR_CURRENCY_DECREASE_EXCHANGE_RATE_TOOLTIP}, // CUSTCURR_RATE_DOWN |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1862 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 20, 29, 21, 29, STR_BLACK_SMALL_ARROW_RIGHT, STR_CURRENCY_INCREASE_EXCHANGE_RATE_TOOLTIP}, // CUSTCURR_RATE_UP |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1863 { WWT_TEXT, RESIZE_NONE, COLOUR_BLUE, 35, 227, 21, 29, STR_CURRENCY_EXCHANGE_RATE, STR_CURRENCY_SET_EXCHANGE_RATE_TOOLTIP}, // CUSTCURR_RATE |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1864 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1865 { WWT_PUSHBTN, RESIZE_NONE, COLOUR_DARK_BLUE, 10, 29, 33, 41, 0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP}, // CUSTCURR_SEPARATOR_EDIT |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1866 { WWT_TEXT, RESIZE_NONE, COLOUR_BLUE, 35, 227, 33, 41, STR_CURRENCY_SEPARATOR, STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP}, // CUSTCURR_SEPARATOR |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1867 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1868 { WWT_PUSHBTN, RESIZE_NONE, COLOUR_DARK_BLUE, 10, 29, 45, 53, 0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP}, // CUSTCURR_PREFIX_EDIT |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1869 { WWT_TEXT, RESIZE_NONE, COLOUR_BLUE, 35, 227, 45, 53, STR_CURRENCY_PREFIX, STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP}, // CUSTCURR_PREFIX |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1870 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1871 { WWT_PUSHBTN, RESIZE_NONE, COLOUR_DARK_BLUE, 10, 29, 57, 65, 0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_SUFFIX_TOOLTIP}, // CUSTCURR_SUFFIX_EDIT |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1872 { WWT_TEXT, RESIZE_NONE, COLOUR_BLUE, 35, 227, 57, 65, STR_CURRENCY_SUFFIX, STR_CURRENCY_SET_CUSTOM_CURRENCY_SUFFIX_TOOLTIP}, // CUSTCURR_SUFFIX |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1873 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1874 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 10, 19, 69, 77, STR_BLACK_SMALL_ARROW_LEFT, STR_CURRENCY_DECREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP}, // CUSTCURR_YEAR_DOWN |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1875 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 20, 29, 69, 77, STR_BLACK_SMALL_ARROW_RIGHT, STR_CURRENCY_INCREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP}, // CUSTCURR_YEAR_UP |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1876 { WWT_TEXT, RESIZE_NONE, COLOUR_BLUE, 35, 227, 69, 77, STR_CURRENCY_SWITCH_TO_EURO, STR_CURRENCY_SET_CUSTOM_CURRENCY_TO_EURO_TOOLTIP}, // CUSTCURR_YEAR |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1877 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1878 { WWT_LABEL, RESIZE_NONE, COLOUR_BLUE, 2, 227, 93, 101, STR_CURRENCY_PREVIEW, STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP}, // CUSTCURR_PREVIEW |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1879 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1880 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1881 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1882 |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1883 static const NWidgetPart _nested_cust_currency_widgets[] = { |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1884 NWidget(NWID_HORIZONTAL), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1885 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CUSTCURR_CLOSEBOX), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1886 NWidget(WWT_CAPTION, COLOUR_GREY, CUSTCURR_CAPTION), SetDataTip(STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1887 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1888 NWidget(WWT_PANEL, COLOUR_GREY, CUSTCURR_BACKGROUND), |
12408
a1c0de97cd50
(svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents:
12391
diff
changeset
|
1889 NWidget(NWID_SPACER), SetMinimalSize(0, 7), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1890 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1891 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_RATE_DOWN), SetMinimalSize(10, 9), SetDataTip(STR_BLACK_SMALL_ARROW_LEFT, STR_CURRENCY_DECREASE_EXCHANGE_RATE_TOOLTIP), |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1892 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_RATE_UP), SetMinimalSize(10, 9), SetDataTip(STR_BLACK_SMALL_ARROW_RIGHT, STR_CURRENCY_INCREASE_EXCHANGE_RATE_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1893 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1894 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_RATE), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_EXCHANGE_RATE, STR_CURRENCY_SET_EXCHANGE_RATE_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1895 NWidget(NWID_SPACER), SetFill(1, 0), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1896 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1897 NWidget(NWID_SPACER), SetMinimalSize(0, 3), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1898 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1899 NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_SEPARATOR_EDIT), SetMinimalSize(20, 9), SetDataTip(0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1900 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1901 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_SEPARATOR), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_SEPARATOR, STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1902 NWidget(NWID_SPACER), SetFill(1, 0), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1903 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1904 NWidget(NWID_SPACER), SetMinimalSize(0, 3), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1905 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1906 NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_PREFIX_EDIT), SetMinimalSize(20, 9), SetDataTip(0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1907 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1908 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_PREFIX), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_PREFIX, STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1909 NWidget(NWID_SPACER), SetFill(1, 0), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1910 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1911 NWidget(NWID_SPACER), SetMinimalSize(0, 3), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1912 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1913 NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_SUFFIX_EDIT), SetMinimalSize(20, 9), SetDataTip(0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_SUFFIX_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1914 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1915 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_SUFFIX), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_SUFFIX, STR_CURRENCY_SET_CUSTOM_CURRENCY_SUFFIX_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1916 NWidget(NWID_SPACER), SetFill(1, 0), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1917 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1918 NWidget(NWID_SPACER), SetMinimalSize(0, 3), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1919 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1920 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_YEAR_DOWN), SetMinimalSize(10, 9), SetDataTip(STR_BLACK_SMALL_ARROW_LEFT, STR_CURRENCY_DECREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP), |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1921 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_YEAR_UP), SetMinimalSize(10, 9), SetDataTip(STR_BLACK_SMALL_ARROW_RIGHT, STR_CURRENCY_INCREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1922 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1923 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_YEAR), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_SWITCH_TO_EURO, STR_CURRENCY_SET_CUSTOM_CURRENCY_TO_EURO_TOOLTIP), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1924 NWidget(NWID_SPACER), SetFill(1, 0), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1925 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1926 NWidget(WWT_LABEL, COLOUR_BLUE, CUSTCURR_PREVIEW), SetMinimalSize(226, 9), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1927 SetDataTip(STR_CURRENCY_PREVIEW, STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP), SetPadding(15, 1, 18, 2), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1928 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1929 }; |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1930 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1931 static const WindowDesc _cust_currency_desc( |
7341
549c757023fc
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents:
7177
diff
changeset
|
1932 WDP_CENTER, WDP_CENTER, 230, 120, 230, 120, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
1933 WC_CUSTOM_CURRENCY, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1934 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1935 _cust_currency_widgets, _nested_cust_currency_widgets, lengthof(_nested_cust_currency_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1936 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1937 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
1938 static void ShowCustCurrency() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1939 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1940 DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1941 new CustomCurrencyWindow(&_cust_currency_desc); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1942 } |