Mercurial > hg > openttd
annotate src/settings_gui.cpp @ 17550:e80129e532c7 draft
(svn r22314) -Change: Put NewGRF supplied townnames at the top of the dropdown list.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 10 Apr 2011 16:08:14 +0000 |
parents | c0fce44f4000 |
children | 8fb428581ca6 |
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 "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
|
14 #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
|
15 #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
|
16 #include "command_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
|
17 #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
|
18 #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
|
19 #include "town.h" |
8208
ddc34919158f
(svn r11771) -Codechange: split settings.h into better separated headers.
rubidium <rubidium@openttd.org>
parents:
8191
diff
changeset
|
20 #include "settings_internal.h" |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
21 #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
|
22 #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
|
23 #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
|
24 #include "string_func.h" |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
25 #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
|
26 #include "widgets/dropdown_func.h" |
10558
15517829eb17
(svn r14815) -Codechange: separate 'highscore' code from 'company' code
smatz <smatz@openttd.org>
parents:
10543
diff
changeset
|
27 #include "highscore.h" |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
12676
diff
changeset
|
28 #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
|
29 #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
|
30 #include "company_func.h" |
13950
77bfe67f23bd
(svn r18486) -Fix: when switching language and you're getting a different font, recalculate the coordinates/sizes of the viewport signs. Otherwise it gets glitchy or abbreviated (in the smallmap)
rubidium <rubidium@openttd.org>
parents:
13834
diff
changeset
|
31 #include "viewport_func.h" |
14258
a899d4e5ee1a
(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents:
14155
diff
changeset
|
32 #include "core/geometry_func.hpp" |
14330
9caa7d57a6e3
(svn r18883) -Codechange: warn in the difficulty and AI configuration window when setting the number of AIs to non-zero when you don't have AIs
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
33 #include "ai/ai.hpp" |
16445
c7c3bb467609
(svn r21161) -Codechange: make the currently used language easier accessible
rubidium <rubidium@openttd.org>
parents:
16441
diff
changeset
|
34 #include "language.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
|
35 |
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
|
36 #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
|
37 #include "table/strings.h" |
17244
21dfb792a721
(svn r21984) -Fix: Compilation without AI was broken
planetmaker <planetmaker@openttd.org>
parents:
17234
diff
changeset
|
38 #include <map> |
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 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
46 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 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
|
51 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
52 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
61 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
62 int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; ///< Number of original town names. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
63 static StringID *_grf_names = NULL; ///< Pointer to town names defined by NewGRFs. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
64 static int _nb_grf_names = 0; ///< Number of town names defined by NewGRFs. |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
65 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
66 /** Allocate memory for the NewGRF town names. */ |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
67 void InitGRFTownGeneratorNames() |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
68 { |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
69 free(_grf_names); |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
70 _grf_names = GetGRFTownNameList(); |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
71 _nb_grf_names = 0; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
72 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
|
73 } |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
74 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
75 /** |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
76 * Get a town name. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
77 * @param town_name Number of the wanted town name. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
78 * @return Name of the town as string ID. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
79 */ |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
80 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
|
81 { |
12619
2f530108f787
(svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents:
12520
diff
changeset
|
82 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
|
83 town_name -= _nb_orig_names; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
84 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
|
85 return STR_UNDEFINED; |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
86 } |
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
87 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
88 /** |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
89 * Get index of the current screen resolution. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
90 * @return Index of the current screen resolution if it is a known resolution, #_num_resolutions otherwise. |
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
91 */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
92 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
|
93 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
94 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
|
95 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
96 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
|
97 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
|
98 (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
|
99 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
100 } |
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 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
|
103 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
104 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
105 /** 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
|
106 enum GameOptionsWidgets { |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
107 GOW_BACKGROUND, ///< Background of the window |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
108 GOW_CURRENCY_DROPDOWN, ///< Currency dropdown |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
109 GOW_DISTANCE_DROPDOWN, ///< Measuring unit dropdown |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
110 GOW_ROADSIDE_DROPDOWN, ///< Dropdown to select the road side (to set the right side ;)) |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
111 GOW_TOWNNAME_DROPDOWN, ///< Town name dropdown |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
112 GOW_AUTOSAVE_DROPDOWN, ///< Dropdown to say how often to autosave |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
113 GOW_LANG_DROPDOWN, ///< Language dropdown |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
114 GOW_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
115 GOW_FULLSCREEN_BUTTON, ///< Toggle fullscreen |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
116 GOW_SCREENSHOT_DROPDOWN, ///< Select the screenshot type... please use PNG! |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
117 GOW_BASE_GRF_DROPDOWN, ///< Use to select a base GRF |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
118 GOW_BASE_GRF_STATUS, ///< Info about missing files etc. |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
119 GOW_BASE_GRF_DESCRIPTION, ///< Description of selected base GRF |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
120 GOW_BASE_SFX_DROPDOWN, ///< Use to select a base SFX |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
121 GOW_BASE_SFX_DESCRIPTION, ///< Description of selected base SFX |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
122 GOW_BASE_MUSIC_DROPDOWN, ///< Use to select a base music set |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
123 GOW_BASE_MUSIC_STATUS, ///< Info about corrupted files etc. |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
124 GOW_BASE_MUSIC_DESCRIPTION, ///< Description of selected base music set |
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
|
125 }; |
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
|
126 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
127 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
|
128 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
129 template <class T> |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
130 static DropDownList *BuiltSetDropDownList(int *selected_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
|
131 { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
132 int n = T::GetNumSets(); |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
133 *selected_index = 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
|
134 |
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
|
135 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
|
136 for (int i = 0; i < n; i++) { |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
137 list->push_back(new DropDownListCharStringItem(T::GetSet(i)->name, i, (_game_mode == GM_MENU) ? false : (*selected_index != 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
|
138 } |
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
|
139 |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
140 return list; |
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
|
141 } |
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
|
142 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
143 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
|
144 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
|
145 bool reload; |
9346
0c181c088ed8
(svn r13242) -Codechange: remove _opt_ptr.
rubidium <rubidium@openttd.org>
parents:
9334
diff
changeset
|
146 |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
147 GameOptionsWindow(const WindowDesc *desc) : Window() |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
148 { |
16959
55b2bec60c52
(svn r21695) -Codechange: add helper function to get the currently applicable GameSettings object
yexo <yexo@openttd.org>
parents:
16945
diff
changeset
|
149 this->opt = &GetGameSettings(); |
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
|
150 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
|
151 |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
152 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
|
153 this->OnInvalidateData(0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
154 } |
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
|
155 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
156 ~GameOptionsWindow() |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
157 { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
158 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
|
159 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
|
160 } |
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
|
161 |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
162 /** |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
163 * Build the dropdown list for a specific widget. |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
164 * @param widget Widget to build list for |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
165 * @param selected_index Currently selected item |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
166 * @return the built dropdown list, or NULL if the widget has no dropdown menu. |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
167 */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
168 DropDownList *BuildDropDownList(int widget, int *selected_index) const |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
169 { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
170 DropDownList *list = NULL; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
171 switch (widget) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
172 case GOW_CURRENCY_DROPDOWN: { // Setup currencies dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
173 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
174 *selected_index = this->opt->locale.currency; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
175 StringID *items = BuildCurrencyDropdown(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
176 uint disabled = _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
177 int custom_index = -1; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
178 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
179 /* Add non-custom currencies; sorted naturally */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
180 for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
181 if (*items == STR_GAME_OPTIONS_CURRENCY_CUSTOM) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
182 custom_index = i; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
183 } else { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
184 list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i))); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
185 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
186 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
187 list->sort(DropDownListStringItem::NatSortFunc); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
188 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
189 /* Append custom currency at the end */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
190 if (custom_index >= 0) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
191 list->push_back(new DropDownListItem(-1, false)); // separator line |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
192 list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, custom_index, HasBit(disabled, custom_index))); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
193 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
194 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
195 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
196 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
197 case GOW_DISTANCE_DROPDOWN: { // Setup distance unit dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
198 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
199 *selected_index = this->opt->locale.units; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
200 const StringID *items = _units_dropdown; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
201 for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
202 list->push_back(new DropDownListStringItem(*items, i, false)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
203 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
204 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
205 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
206 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
207 case GOW_ROADSIDE_DROPDOWN: { // Setup road-side dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
208 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
209 *selected_index = this->opt->vehicle.road_side; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
210 const StringID *items = _driveside_dropdown; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
211 uint disabled = 0; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
212 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
213 /* You can only change the drive side if you are in the menu or ingame with |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
214 * no vehicles present. In a networking game only the server can change it */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
215 extern bool RoadVehiclesAreBuilt(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
216 if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
217 disabled = ~(1 << this->opt->vehicle.road_side); // disable the other value |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
218 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
219 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
220 for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
221 list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i))); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
222 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
223 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
224 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
225 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
226 case GOW_TOWNNAME_DROPDOWN: { // Setup townname dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
227 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
228 *selected_index = this->opt->game_creation.town_name; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
229 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
230 int enabled_item = (_game_mode == GM_MENU || Town::GetNumItems() == 0) ? -1 : *selected_index; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
231 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
232 /* Add and sort original townnames generators */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
233 for (int i = 0; i < _nb_orig_names; i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
234 list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
235 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
236 list->sort(DropDownListStringItem::NatSortFunc); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
237 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
238 /* Add and sort newgrf townnames generators */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
239 DropDownList newgrf_names; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
240 for (int i = 0; i < _nb_grf_names; i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
241 int result = _nb_orig_names + i; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
242 newgrf_names.push_back(new DropDownListStringItem(_grf_names[i], result, enabled_item != result && enabled_item >= 0)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
243 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
244 newgrf_names.sort(DropDownListStringItem::NatSortFunc); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
245 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
246 /* Append newgrf_names at the end of list */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
247 if (newgrf_names.size() > 0) { |
17550
e80129e532c7
(svn r22314) -Change: Put NewGRF supplied townnames at the top of the dropdown list.
frosch <frosch@openttd.org>
parents:
17548
diff
changeset
|
248 newgrf_names.push_back(new DropDownListItem(-1, false)); // separator line |
e80129e532c7
(svn r22314) -Change: Put NewGRF supplied townnames at the top of the dropdown list.
frosch <frosch@openttd.org>
parents:
17548
diff
changeset
|
249 list->splice(list->begin(), newgrf_names); |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
250 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
251 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
252 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
253 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
254 case GOW_AUTOSAVE_DROPDOWN: { // Setup autosave dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
255 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
256 *selected_index = _settings_client.gui.autosave; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
257 const StringID *items = _autosave_dropdown; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
258 for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
259 list->push_back(new DropDownListStringItem(*items, i, false)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
260 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
261 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
262 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
263 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
264 case GOW_LANG_DROPDOWN: { // Setup interface language dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
265 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
266 for (uint i = 0; i < _languages.Length(); i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
267 if (&_languages[i] == _current_language) *selected_index = i; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
268 list->push_back(new DropDownListStringItem(SPECSTR_LANGUAGE_START + i, i, false)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
269 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
270 list->sort(DropDownListStringItem::NatSortFunc); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
271 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
272 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
273 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
274 case GOW_RESOLUTION_DROPDOWN: // Setup resolution dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
275 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
276 *selected_index = GetCurRes(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
277 for (int i = 0; i < _num_resolutions; i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
278 list->push_back(new DropDownListStringItem(SPECSTR_RESOLUTION_START + i, i, false)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
279 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
280 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
281 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
282 case GOW_SCREENSHOT_DROPDOWN: // Setup screenshot format dropdown |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
283 list = new DropDownList(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
284 *selected_index = _cur_screenshot_format; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
285 for (uint i = 0; i < _num_screenshot_formats; i++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
286 list->push_back(new DropDownListStringItem(SPECSTR_SCREENSHOT_START + i, i, false)); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
287 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
288 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
289 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
290 case GOW_BASE_GRF_DROPDOWN: |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
291 list = BuiltSetDropDownList<BaseGraphics>(selected_index); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
292 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
293 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
294 case GOW_BASE_SFX_DROPDOWN: |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
295 list = BuiltSetDropDownList<BaseSounds>(selected_index); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
296 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
297 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
298 case GOW_BASE_MUSIC_DROPDOWN: |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
299 list = BuiltSetDropDownList<BaseMusic>(selected_index); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
300 break; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
301 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
302 default: |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
303 return NULL; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
304 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
305 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
306 return list; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
307 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
308 |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
309 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
|
310 { |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
311 switch (widget) { |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 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
|
316 case GOW_AUTOSAVE_DROPDOWN: SetDParam(0, _autosave_dropdown[_settings_client.gui.autosave]); break; |
16445
c7c3bb467609
(svn r21161) -Codechange: make the currently used language easier accessible
rubidium <rubidium@openttd.org>
parents:
16441
diff
changeset
|
317 case GOW_LANG_DROPDOWN: SetDParamStr(0, _current_language->own_name); break; |
16494
0673c1340cb1
(svn r21220) -Codechange: give a string a much better name
rubidium <rubidium@openttd.org>
parents:
16463
diff
changeset
|
318 case GOW_RESOLUTION_DROPDOWN: SetDParam(0, GetCurRes() == _num_resolutions ? STR_GAME_OPTIONS_RESOLUTION_OTHER : SPECSTR_RESOLUTION_START + GetCurRes()); break; |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
319 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
|
320 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
|
321 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
|
322 case GOW_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break; |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
323 case GOW_BASE_MUSIC_DROPDOWN: SetDParamStr(0, BaseMusic::GetUsedSet()->name); break; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
324 case GOW_BASE_MUSIC_STATUS: SetDParam(0, BaseMusic::GetUsedSet()->GetNumInvalid()); break; |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
325 } |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
326 } |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
327 |
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
328 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
|
329 { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
330 switch (widget) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
331 case GOW_BASE_GRF_DESCRIPTION: |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13277
diff
changeset
|
332 SetDParamStr(0, BaseGraphics::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode())); |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
333 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
|
334 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
|
335 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
336 case GOW_BASE_SFX_DESCRIPTION: |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13277
diff
changeset
|
337 SetDParamStr(0, BaseSounds::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode())); |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
338 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
|
339 break; |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
340 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
341 case GOW_BASE_MUSIC_DESCRIPTION: |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
342 SetDParamStr(0, BaseMusic::GetUsedSet()->GetDescription(GetCurrentLanguageIsoCode())); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
343 DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_BLACK_RAW_STRING); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
344 break; |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
345 } |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
346 } |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
347 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
348 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
349 { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
350 switch (widget) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
351 case GOW_BASE_GRF_DESCRIPTION: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
352 /* 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
|
353 for (int i = 0; i < BaseGraphics::GetNumSets(); i++) { |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13277
diff
changeset
|
354 SetDParamStr(0, BaseGraphics::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
355 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
|
356 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
357 break; |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
358 |
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
|
359 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
|
360 /* 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
|
361 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
|
362 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
|
363 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
|
364 |
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
|
365 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
|
366 *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
|
367 } |
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
|
368 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
|
369 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
370 case GOW_BASE_SFX_DESCRIPTION: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
371 /* 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
|
372 for (int i = 0; i < BaseSounds::GetNumSets(); i++) { |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13277
diff
changeset
|
373 SetDParamStr(0, BaseSounds::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
374 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
|
375 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
376 break; |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
377 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
378 case GOW_BASE_MUSIC_DESCRIPTION: |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
379 /* Find the biggest description for the default size. */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
380 for (int i = 0; i < BaseMusic::GetNumSets(); i++) { |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
381 SetDParamStr(0, BaseMusic::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
382 size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
383 } |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
384 break; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
385 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
386 case GOW_BASE_MUSIC_STATUS: |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
387 /* Find the biggest description for the default size. */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
388 for (int i = 0; i < BaseMusic::GetNumSets(); i++) { |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
389 uint invalid_files = BaseMusic::GetSet(i)->GetNumInvalid(); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
390 if (invalid_files == 0) continue; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
391 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
392 SetDParam(0, invalid_files); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
393 *size = maxdim(*size, GetStringBoundingBox(STR_GAME_OPTIONS_BASE_MUSIC_STATUS)); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
394 } |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
395 break; |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
396 |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
397 default: { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
398 int selected; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
399 DropDownList *list = this->BuildDropDownList(widget, &selected); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
400 if (list != NULL) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
401 /* Find the biggest item for the default size. */ |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
402 for (DropDownList::iterator it = list->begin(); it != list->end(); it++) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
403 static const Dimension extra = {WD_DROPDOWNTEXT_LEFT + WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM}; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
404 Dimension string_dim; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
405 int width = (*it)->Width(); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
406 string_dim.width = width + extra.width; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
407 string_dim.height = (*it)->Height(width) + extra.height; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
408 *size = maxdim(*size, string_dim); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
409 delete *it; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
410 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
411 delete list; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
412 } |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
413 } |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
414 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
415 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
416 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14385
diff
changeset
|
417 virtual void OnClick(Point pt, int widget, int click_count) |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
418 { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
419 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
|
420 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
|
421 /* 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
|
422 if (!ToggleFullScreen(!_fullscreen)) { |
14645
b7a22979b84e
(svn r19224) -Codechange: change parameters passed to ShowErrorMessage() a bit
smatz <smatz@openttd.org>
parents:
14510
diff
changeset
|
423 ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, WL_ERROR); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
424 } |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
425 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
|
426 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
427 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
428 |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
429 default: { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
430 int selected; |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
431 DropDownList *list = this->BuildDropDownList(widget, &selected); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
432 if (list != NULL) { |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
433 ShowDropDownList(this, list, selected, widget); |
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
434 } |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
435 break; |
17548
c0fce44f4000
(svn r22312) -Codechange: Add GameOptionsWindow::BuildDropDownList() for construction of all dropdown lists in the GameOptionsWindow.
frosch <frosch@openttd.org>
parents:
17486
diff
changeset
|
436 } |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
437 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
438 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
439 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
440 /** |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
441 * Set the base media set. |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
442 * @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
|
443 * @tparam T class of media set |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
444 */ |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
445 template <class T> |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
446 void SetMediaSet(int index) |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
447 { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
448 if (_game_mode == GM_MENU) { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
449 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
|
450 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
451 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
|
452 T::ini_set = strdup(name); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
453 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
454 T::SetSet(name); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
455 this->reload = true; |
13169
1f44cefc7825
(svn r17674) -Codechange: replace SetDirty + OnInvalidateData with InvalidateData (which does the same). Also call InvalidateData in a few cases where that was actually meant.
rubidium <rubidium@openttd.org>
parents:
13139
diff
changeset
|
456 this->InvalidateData(); |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
457 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
458 } |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
459 |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
460 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
|
461 { |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
462 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
|
463 case GOW_CURRENCY_DROPDOWN: // Currency |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
464 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
|
465 this->opt->locale.currency = index; |
16302
78ed3fe0f2ee
(svn r21010) -Fix [FS#4102]: the detailed performance rating window would occasionally be too narrow. Based on a patch by Krille
rubidium <rubidium@openttd.org>
parents:
16034
diff
changeset
|
466 ReInitAllWindows(); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
467 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
468 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
469 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
|
470 this->opt->locale.units = index; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
471 MarkWholeScreenDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
472 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
473 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 } |
adc269893bd0
(svn r15416) -Fix (r15412): revert the removal of the road side drop down box handling.
rubidium <rubidium@openttd.org>
parents:
11071
diff
changeset
|
481 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
|
482 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
483 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
|
484 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
|
485 this->opt->game_creation.town_name = index; |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
12880
diff
changeset
|
486 SetWindowDirty(WC_GAME_OPTIONS, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
487 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
488 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
489 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
490 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
|
491 _settings_client.gui.autosave = index; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
492 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
493 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
494 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
495 case GOW_LANG_DROPDOWN: // Change interface language |
16448
a94bb23bd67b
(svn r21164) -Codechange: replace the hardcoded array of language metadata with a list
rubidium <rubidium@openttd.org>
parents:
16447
diff
changeset
|
496 ReadLanguagePack(&_languages[index]); |
16823
3a844b1791a9
(svn r21557) -Change: close the query windows when changing the language as often the strings are partly translated, which causes trouble in some cases
rubidium <rubidium@openttd.org>
parents:
16772
diff
changeset
|
497 DeleteWindowByClass(WC_QUERY_STRING); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
498 CheckForMissingGlyphsInLoadedLanguagePack(); |
13950
77bfe67f23bd
(svn r18486) -Fix: when switching language and you're getting a different font, recalculate the coordinates/sizes of the viewport signs. Otherwise it gets glitchy or abbreviated (in the smallmap)
rubidium <rubidium@openttd.org>
parents:
13834
diff
changeset
|
499 UpdateAllVirtCoords(); |
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
|
500 ReInitAllWindows(); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
501 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
502 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
503 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
|
504 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
|
505 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
506 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
507 break; |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
508 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
509 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
|
510 SetScreenshotFormat(index); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
511 this->SetDirty(); |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
512 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
|
513 |
11479
ca01beb7e155
(svn r15840) -Codechange: complete the game option window widget enum and unify the naming.
rubidium <rubidium@openttd.org>
parents:
11474
diff
changeset
|
514 case GOW_BASE_GRF_DROPDOWN: |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
515 this->SetMediaSet<BaseGraphics>(index); |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
516 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
|
517 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
518 case GOW_BASE_SFX_DROPDOWN: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
519 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
|
520 break; |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
521 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
522 case GOW_BASE_MUSIC_DROPDOWN: |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
523 this->SetMediaSet<BaseMusic>(index); |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
524 break; |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
525 } |
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
526 } |
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 |
17486
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
528 /** |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
529 * Some data on this window has become invalid. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
530 * @param data Information about the changed data. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
531 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
532 */ |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
533 virtual void OnInvalidateData(int data = 0, bool gui_scope = true) |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
534 { |
17486
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
535 if (!gui_scope) return; |
12517
71027f744a29
(svn r16954) -Codechange: make the Game Options window use the nested widget system.
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
536 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
|
537 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
12676
diff
changeset
|
538 bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0; |
13072
75bd67594af2
(svn r17572) -Codechange: Use the Window::GetWidget() function to access nested widgets through the nested_array.
alberth <alberth@openttd.org>
parents:
13034
diff
changeset
|
539 this->GetWidget<NWidgetCore>(GOW_BASE_GRF_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_GRF_STATUS, STR_NULL); |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
540 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
541 missing_files = BaseMusic::GetUsedSet()->GetNumInvalid() == 0; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
542 this->GetWidget<NWidgetCore>(GOW_BASE_MUSIC_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_MUSIC_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
|
543 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
544 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
545 |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
546 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
|
547 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
548 NWidget(WWT_CLOSEBOX, COLOUR_GREY), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
549 NWidget(WWT_CAPTION, COLOUR_GREY), 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
|
550 EndContainer(), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
551 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
|
552 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
|
553 NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
554 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
555 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_CURRENCY_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
556 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
557 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
558 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_ROADSIDE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
559 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
560 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_AUTOSAVE_FRAME, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
561 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_AUTOSAVE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
562 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
563 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_RESOLUTION, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
564 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_RESOLUTION_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_RESOLUTION_TOOLTIP), SetFill(1, 0), SetPadding(0, 0, 3, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
565 NWidget(NWID_HORIZONTAL), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
566 NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_GAME_OPTIONS_FULLSCREEN, STR_NULL), |
13670
2e7ff39e2ec6
(svn r18195) -Codechange: move the child padding calculation/handling to WWT_FRAME
rubidium <rubidium@openttd.org>
parents:
13665
diff
changeset
|
567 NWidget(WWT_TEXTBTN, COLOUR_GREY, GOW_FULLSCREEN_BUTTON), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_FULLSCREEN_TOOLTIP), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
568 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
569 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
570 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
571 |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
572 NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
573 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_MEASURING_UNITS_FRAME, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
574 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_DISTANCE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_MEASURING_UNITS_DROPDOWN_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
575 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
576 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_TOWN_NAMES_FRAME, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
577 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_TOWNNAME_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_TOWN_NAMES_DROPDOWN_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
578 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
579 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_LANGUAGE, STR_NULL), |
16448
a94bb23bd67b
(svn r21164) -Codechange: replace the hardcoded array of language metadata with a list
rubidium <rubidium@openttd.org>
parents:
16447
diff
changeset
|
580 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_LANG_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_LANGUAGE_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
581 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
582 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_SCREENSHOT_FORMAT, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
583 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_SCREENSHOT_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_SCREENSHOT_FORMAT_TOOLTIP), SetFill(1, 0), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
584 EndContainer(), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
585 NWidget(NWID_SPACER), SetMinimalSize(0, 0), SetFill(0, 1), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
586 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
587 EndContainer(), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
588 |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
589 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_GRF, STR_NULL), SetPadding(0, 10, 0, 10), |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
590 NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), |
13670
2e7ff39e2ec6
(svn r18195) -Codechange: move the child padding calculation/handling to WWT_FRAME
rubidium <rubidium@openttd.org>
parents:
13665
diff
changeset
|
591 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_GRF_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_GRF_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
592 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_GRF_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0), |
11939
577d93a5e10d
(svn r16342) -Feature(tte): Display base graphics description in game options window.
frosch <frosch@openttd.org>
parents:
11913
diff
changeset
|
593 EndContainer(), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
594 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_GRF_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 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
|
595 EndContainer(), |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
596 |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
597 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_SFX, STR_NULL), SetPadding(0, 10, 0, 10), |
13670
2e7ff39e2ec6
(svn r18195) -Codechange: move the child padding calculation/handling to WWT_FRAME
rubidium <rubidium@openttd.org>
parents:
13665
diff
changeset
|
598 NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), |
2e7ff39e2ec6
(svn r18195) -Codechange: move the child padding calculation/handling to WWT_FRAME
rubidium <rubidium@openttd.org>
parents:
13665
diff
changeset
|
599 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_SFX_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_SFX_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
600 NWidget(NWID_SPACER), SetFill(1, 0), |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
601 EndContainer(), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
602 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_SFX_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0), |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12683
diff
changeset
|
603 EndContainer(), |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
604 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
605 NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_BASE_MUSIC, STR_NULL), SetPadding(0, 10, 0, 10), |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
606 NWidget(NWID_HORIZONTAL), SetPIP(0, 30, 0), |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
607 NWidget(WWT_DROPDOWN, COLOUR_GREY, GOW_BASE_MUSIC_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_RAW_STRING, STR_GAME_OPTIONS_BASE_MUSIC_TOOLTIP), |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
608 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_MUSIC_STATUS), SetMinimalSize(150, 12), SetDataTip(STR_EMPTY, STR_NULL), SetFill(1, 0), |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
609 EndContainer(), |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
610 NWidget(WWT_TEXT, COLOUR_GREY, GOW_BASE_MUSIC_DESCRIPTION), SetMinimalSize(330, 0), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP), SetFill(1, 0), SetPadding(6, 0, 0, 0), |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
14037
diff
changeset
|
611 EndContainer(), |
11513
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
612 EndContainer(), |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
613 }; |
060289e229f7
(svn r15874) -Codechange: New widgets for the game options window.
yexo <yexo@openttd.org>
parents:
11507
diff
changeset
|
614 |
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
|
615 static const WindowDesc _game_options_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
616 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
617 WC_GAME_OPTIONS, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13705
diff
changeset
|
618 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
619 _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
|
620 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
621 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
622 /** Open the game options window. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
623 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
|
624 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
625 DeleteWindowById(WC_GAME_OPTIONS, 0); |
9291
f9b184a11fea
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
626 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
|
627 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
628 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
629 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
|
630 |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
631 |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
632 /* 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
|
633 enum GameDifficultyWidgets { |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
634 GDW_LVL_EASY, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
635 GDW_LVL_MEDIUM, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
636 GDW_LVL_HARD, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
637 GDW_LVL_CUSTOM, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
638 GDW_HIGHSCORE, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
639 GDW_ACCEPT, |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
640 GDW_CANCEL, |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
641 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
642 GDW_OPTIONS_START, |
11505
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
643 }; |
fba50a5a947b
(svn r15866) -Codechange: New widgets for the difficulty window.
yexo <yexo@openttd.org>
parents:
11479
diff
changeset
|
644 |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
645 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
|
646 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
647 class GameDifficultyWindow : public Window { |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
648 private: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
649 /* 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
|
650 GameSettings opt_mod_temp; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
651 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
652 public: |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
653 /** The number of difficulty settings */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
654 static const uint GAME_DIFFICULTY_NUM = 18; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
655 /** The number of widgets per difficulty setting */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
656 static const uint WIDGETS_PER_DIFFICULTY = 3; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
657 |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
658 GameDifficultyWindow(const WindowDesc *desc) : Window() |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
659 { |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
660 this->InitNested(desc); |
13131
f78f54c02ea0
(svn r17636) -Codechange: make the difficulty setting window nested
rubidium <rubidium@openttd.org>
parents:
13088
diff
changeset
|
661 |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
662 /* 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
|
663 * change that when setting stuff, copy back on clicking 'OK' */ |
16959
55b2bec60c52
(svn r21695) -Codechange: add helper function to get the currently applicable GameSettings object
yexo <yexo@openttd.org>
parents:
16945
diff
changeset
|
664 this->opt_mod_temp = GetGameSettings(); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
665 /* Setup disabled buttons when creating window |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
666 * disable all other difficulty buttons during gameplay except for 'custom' */ |
13139
3064addfd0ec
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
rubidium <rubidium@openttd.org>
parents:
13136
diff
changeset
|
667 this->SetWidgetsDisabledState(_game_mode != GM_MENU, |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
668 GDW_LVL_EASY, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
669 GDW_LVL_MEDIUM, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
670 GDW_LVL_HARD, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
671 GDW_LVL_CUSTOM, |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
672 WIDGET_LIST_END); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
673 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
|
674 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
|
675 this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
676 this->OnInvalidateData(); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
677 } |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
678 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
679 virtual void SetStringParameters(int widget) const |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
680 { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
681 widget -= GDW_OPTIONS_START; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
682 if (widget < 0 || (widget % 3) != 2) return; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
683 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
684 widget /= 3; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
685 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
686 uint i; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
687 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + widget; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
688 int32 value = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
17456
6dce16791f02
(svn r22210) -Add: Add a variable for the value strings in the settings tables.
alberth <alberth@openttd.org>
parents:
17444
diff
changeset
|
689 SetDParam(0, sd->desc.val_str + value); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
690 } |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
691 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
692 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
693 { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
694 /* Only for the 'descriptions' */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
695 int index = widget - GDW_OPTIONS_START; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
696 if (index < 0 || (index % 3) != 2) return; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
697 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
698 index /= 3; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
699 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
700 uint i; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
701 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + index; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
702 const SettingDescBase *sdb = &sd->desc; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
703 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
704 /* Get the string and try all strings from the smallest to the highest value */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
705 StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
706 for (int32 value = sdb->min; (uint32)value <= sdb->max; value += sdb->interval) { |
17456
6dce16791f02
(svn r22210) -Add: Add a variable for the value strings in the settings tables.
alberth <alberth@openttd.org>
parents:
17444
diff
changeset
|
707 SetDParam(0, sdb->val_str + value); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
708 *size = maxdim(*size, GetStringBoundingBox(str)); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
709 } |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
710 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
711 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14385
diff
changeset
|
712 virtual void OnClick(Point pt, int widget, int click_count) |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
713 { |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
714 if (widget >= GDW_OPTIONS_START) { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
715 widget -= GDW_OPTIONS_START; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
716 if ((widget % 3) == 2) return; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
717 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
718 /* Don't allow clients to make any changes */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
719 if (_networking && !_network_server) return; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
720 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
721 uint i; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
722 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i) + (widget / 3); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
723 const SettingDescBase *sdb = &sd->desc; |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
724 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
725 int32 val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
726 if (widget % 3 == 1) { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
727 /* Increase button clicked */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
728 val = min(val + sdb->interval, (int32)sdb->max); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
729 } else { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
730 /* Decrease button clicked */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
731 val -= sdb->interval; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
732 val = max(val, sdb->min); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
733 } |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
734 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
735 /* save value in temporary variable */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
736 WriteValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv, val); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
737 this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
738 SetDifficultyLevel(3, &this->opt_mod_temp.difficulty); // set difficulty level to custom |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
739 this->LowerWidget(GDW_LVL_CUSTOM); |
13169
1f44cefc7825
(svn r17674) -Codechange: replace SetDirty + OnInvalidateData with InvalidateData (which does the same). Also call InvalidateData in a few cases where that was actually meant.
rubidium <rubidium@openttd.org>
parents:
13139
diff
changeset
|
740 this->InvalidateData(); |
14330
9caa7d57a6e3
(svn r18883) -Codechange: warn in the difficulty and AI configuration window when setting the number of AIs to non-zero when you don't have AIs
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
741 |
14510
38952764f91f
(svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel
rubidium <rubidium@openttd.org>
parents:
14493
diff
changeset
|
742 if (widget / 3 == 0 && |
38952764f91f
(svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel
rubidium <rubidium@openttd.org>
parents:
14493
diff
changeset
|
743 #ifdef ENABLE_AI |
38952764f91f
(svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel
rubidium <rubidium@openttd.org>
parents:
14493
diff
changeset
|
744 AI::GetInfoList()->size() == 0 && |
38952764f91f
(svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel
rubidium <rubidium@openttd.org>
parents:
14493
diff
changeset
|
745 #endif /* ENABLE_AI */ |
38952764f91f
(svn r19081) -Codechange: make it possible to disable compilation of the AI+Squirrel
rubidium <rubidium@openttd.org>
parents:
14493
diff
changeset
|
746 this->opt_mod_temp.difficulty.max_no_competitors != 0) { |
14645
b7a22979b84e
(svn r19224) -Codechange: change parameters passed to ShowErrorMessage() a bit
smatz <smatz@openttd.org>
parents:
14510
diff
changeset
|
747 ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL); |
14330
9caa7d57a6e3
(svn r18883) -Codechange: warn in the difficulty and AI configuration window when setting the number of AIs to non-zero when you don't have AIs
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
748 } |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
749 return; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
750 } |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
751 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
752 switch (widget) { |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
753 case GDW_LVL_EASY: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
754 case GDW_LVL_MEDIUM: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
755 case GDW_LVL_HARD: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
756 case GDW_LVL_CUSTOM: |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
757 /* temporarily change difficulty level */ |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
758 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
|
759 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
|
760 this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
13169
1f44cefc7825
(svn r17674) -Codechange: replace SetDirty + OnInvalidateData with InvalidateData (which does the same). Also call InvalidateData in a few cases where that was actually meant.
rubidium <rubidium@openttd.org>
parents:
13139
diff
changeset
|
761 this->InvalidateData(); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
762 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
763 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
764 case GDW_HIGHSCORE: // Highscore Table |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
765 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
|
766 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
767 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
768 case GDW_ACCEPT: { // Save button - save changes |
16959
55b2bec60c52
(svn r21695) -Codechange: add helper function to get the currently applicable GameSettings object
yexo <yexo@openttd.org>
parents:
16945
diff
changeset
|
769 GameSettings *opt_ptr = &GetGameSettings(); |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
770 |
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
771 uint i; |
13088
1008c63fa996
(svn r17588) -Fix [FS#3220]: erroneous message about changing the difficulty level
rubidium <rubidium@openttd.org>
parents:
13072
diff
changeset
|
772 GetSettingFromName("difficulty.diff_level", &i); |
1008c63fa996
(svn r17588) -Fix [FS#3220]: erroneous message about changing the difficulty level
rubidium <rubidium@openttd.org>
parents:
13072
diff
changeset
|
773 DoCommandP(0, i, this->opt_mod_temp.difficulty.diff_level, CMD_CHANGE_SETTING); |
1008c63fa996
(svn r17588) -Fix [FS#3220]: erroneous message about changing the difficulty level
rubidium <rubidium@openttd.org>
parents:
13072
diff
changeset
|
774 |
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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 /* 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
|
780 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
|
781 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
|
782 } |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
783 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
784 delete this; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
785 /* 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
|
786 * 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
|
787 * are loaded correctly. */ |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
788 if (_game_mode == GM_EDITOR) StartupEconomy(); |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
789 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
790 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
791 |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
792 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
|
793 delete this; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
794 break; |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
795 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
796 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
797 |
17486
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
798 /** |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
799 * Some data on this window has become invalid. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
800 * @param data Information about the changed data. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
801 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
802 */ |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
803 virtual void OnInvalidateData(int data = 0, bool gui_scope = true) |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
804 { |
17486
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17456
diff
changeset
|
805 if (!gui_scope) return; |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
806 uint i; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
807 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
808 for (i = 0; i < GAME_DIFFICULTY_NUM; i++, sd++) { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
809 const SettingDescBase *sdb = &sd->desc; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
810 /* skip deprecated difficulty options */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
811 if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
812 int32 value = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
13139
3064addfd0ec
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
rubidium <rubidium@openttd.org>
parents:
13136
diff
changeset
|
813 bool disable = (sd->desc.flags & SGF_NEWGAME_ONLY) && |
3064addfd0ec
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
rubidium <rubidium@openttd.org>
parents:
13136
diff
changeset
|
814 (_game_mode == GM_NORMAL || |
3064addfd0ec
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
rubidium <rubidium@openttd.org>
parents:
13136
diff
changeset
|
815 (_game_mode == GM_EDITOR && (sd->desc.flags & SGF_SCENEDIT_TOO) == 0)); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
816 |
13139
3064addfd0ec
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
rubidium <rubidium@openttd.org>
parents:
13136
diff
changeset
|
817 this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 0, disable || sdb->min == value); |
3064addfd0ec
(svn r17644) -Fix [FS#3219]: some inconsistencies with the difficulty settings in the scenario editor. Also re-enable changing some difficulty settings (e.g. max loan) in the scenario editor.
rubidium <rubidium@openttd.org>
parents:
13136
diff
changeset
|
818 this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 1, disable || sdb->max == (uint32)value); |
9231
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
819 } |
6ddeba445c3a
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx <glx@openttd.org>
parents:
9164
diff
changeset
|
820 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
821 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
822 |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
823 static NWidgetBase *MakeDifficultyOptionsWidgets(int *biggest_index) |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
824 { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
825 NWidgetVertical *vert_desc = new NWidgetVertical; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
826 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
827 int widnum = GDW_OPTIONS_START; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
828 uint i, j; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
829 const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
830 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
831 for (i = 0, j = 0; i < GameDifficultyWindow::GAME_DIFFICULTY_NUM; i++, sd++, widnum += GameDifficultyWindow::WIDGETS_PER_DIFFICULTY) { |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
832 if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
833 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
834 NWidgetHorizontal *hor = new NWidgetHorizontal; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
835 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
836 /* [<] button. */ |
15795
c9cf5fe6d6a1
(svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked.
frosch <frosch@openttd.org>
parents:
15787
diff
changeset
|
837 NWidgetLeaf *leaf = new NWidgetLeaf(WWT_PUSHARROWBTN, COLOUR_YELLOW, widnum, AWV_DECREASE, STR_TOOLTIP_HSCROLL_BAR_SCROLLS_LIST); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
838 hor->Add(leaf); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
839 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
840 /* [>] button. */ |
15795
c9cf5fe6d6a1
(svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked.
frosch <frosch@openttd.org>
parents:
15787
diff
changeset
|
841 leaf = new NWidgetLeaf(WWT_PUSHARROWBTN, COLOUR_YELLOW, widnum + 1, AWV_INCREASE, STR_TOOLTIP_HSCROLL_BAR_SCROLLS_LIST); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
842 hor->Add(leaf); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
843 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
844 /* Some spacing between the text and the description */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
845 NWidgetSpacer *spacer = new NWidgetSpacer(5, 0); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
846 hor->Add(spacer); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
847 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
848 /* Descriptive text. */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
849 leaf = new NWidgetLeaf(WWT_TEXT, COLOUR_YELLOW, widnum + 2, STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS + (j++), STR_NULL); |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
850 leaf->SetFill(1, 0); |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
851 hor->Add(leaf); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
852 vert_desc->Add(hor); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
853 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
854 /* Space vertically */ |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
855 vert_desc->Add(new NWidgetSpacer(0, 2)); |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
856 } |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
857 *biggest_index = widnum - 1; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
858 return vert_desc; |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
859 } |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
860 |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
861 |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
862 /** Widget definition for the game difficulty settings window */ |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
863 static const NWidgetPart _nested_game_difficulty_widgets[] = { |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
864 NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
865 NWidget(WWT_PANEL, COLOUR_MAUVE), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
866 NWidget(NWID_VERTICAL), SetPIP(2, 0, 2), |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
867 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
868 NWidget(WWT_TEXTBTN, COLOUR_YELLOW, GDW_LVL_EASY), SetDataTip(STR_DIFFICULTY_LEVEL_EASY, STR_NULL), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
869 NWidget(WWT_TEXTBTN, COLOUR_YELLOW, GDW_LVL_MEDIUM), SetDataTip(STR_DIFFICULTY_LEVEL_MEDIUM, STR_NULL), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
870 NWidget(WWT_TEXTBTN, COLOUR_YELLOW, GDW_LVL_HARD), SetDataTip(STR_DIFFICULTY_LEVEL_HARD, STR_NULL), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
871 NWidget(WWT_TEXTBTN, COLOUR_YELLOW, GDW_LVL_CUSTOM), SetDataTip(STR_DIFFICULTY_LEVEL_CUSTOM, STR_NULL), SetFill(1, 0), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
872 EndContainer(), |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
873 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
874 NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, GDW_HIGHSCORE), SetDataTip(STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL), SetFill(1, 0), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
875 EndContainer(), |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
876 EndContainer(), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
877 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
878 NWidget(WWT_PANEL, COLOUR_MAUVE), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
879 NWidget(NWID_VERTICAL), SetPIP(3, 0, 1), |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
880 NWidget(NWID_HORIZONTAL), SetPIP(5, 0, 5), |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
881 NWidgetFunction(MakeDifficultyOptionsWidgets), |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
882 EndContainer(), |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
883 EndContainer(), |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
884 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
885 NWidget(WWT_PANEL, COLOUR_MAUVE), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
886 NWidget(NWID_VERTICAL), SetPIP(2, 0, 2), |
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
887 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
888 NWidget(NWID_SPACER), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
889 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_ACCEPT), SetDataTip(STR_DIFFICULTY_LEVEL_SAVE, STR_NULL), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
890 NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, GDW_CANCEL), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
891 NWidget(NWID_SPACER), SetFill(1, 0), |
13134
54b65f0fc0ea
(svn r17639) -Codechange: let the difficulty settings GUI make really use the nested widget features
rubidium <rubidium@openttd.org>
parents:
13132
diff
changeset
|
892 EndContainer(), |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
893 EndContainer(), |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
894 EndContainer(), |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
895 }; |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
896 |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
897 /** Window definition for the game difficulty settings window */ |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
898 static const WindowDesc _game_difficulty_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
899 WDP_CENTER, 0, 0, |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
900 WC_GAME_OPTIONS, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13705
diff
changeset
|
901 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
902 _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets) |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
903 ); |
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
904 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
905 /** Open the game-difficulty window. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
906 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
|
907 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
908 DeleteWindowById(WC_GAME_OPTIONS, 0); |
13132
dc0ab6265137
(svn r17637) -Codechange: move the game difficulty window's window/widget description below the window class
rubidium <rubidium@openttd.org>
parents:
13131
diff
changeset
|
909 new GameDifficultyWindow(&_game_difficulty_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
|
910 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
911 |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
912 static int SETTING_HEIGHT = 11; ///< Height of a single setting in the tree view in pixels |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
913 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
|
914 |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
915 /** |
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
|
916 * 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
|
917 * @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
|
918 */ |
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
|
919 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
|
920 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
|
921 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
|
922 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
|
923 |
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
|
924 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
|
925 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
926 /* 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
|
927 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
|
928 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
|
929 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
|
930 }; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
931 |
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
|
932 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
|
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 /** 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
|
935 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
|
936 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
|
937 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
|
938 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
|
939 }; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
940 |
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
|
941 /** 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
|
942 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
|
943 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
|
944 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
|
945 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
|
946 }; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
947 |
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
|
948 /** 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
|
949 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
|
950 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
|
951 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
|
952 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
|
953 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
|
954 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
|
955 } 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
|
956 |
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
|
957 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
|
958 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
|
959 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
960 void Init(byte level, bool last_field); |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
961 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
|
962 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
|
963 |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
964 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
|
965 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
|
966 |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
967 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
|
968 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
969 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
|
970 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
|
971 }; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
972 |
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
|
973 /** 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
|
974 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
|
975 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
|
976 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
|
977 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
978 void Init(byte level = 0); |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
979 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
|
980 |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
981 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
|
982 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
|
983 |
11217
bbb1eaa48906
(svn r15570) -Fix: Too long strings in the advanced settings window are now truncated.
yexo <yexo@openttd.org>
parents:
11085
diff
changeset
|
984 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
|
985 }; |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
986 |
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
987 |
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
|
988 /* == 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
|
989 |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
990 /** |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
991 * 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
|
992 * @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
|
993 */ |
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
|
994 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
|
995 { |
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
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 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
|
1001 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1002 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1003 /** |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1004 * 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
|
1005 * @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
|
1006 * @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
|
1007 */ |
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
|
1008 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
|
1009 { |
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
|
1010 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
|
1011 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
|
1012 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
|
1013 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
|
1014 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
|
1015 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1016 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1017 /** |
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
|
1018 * 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
|
1019 * @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
|
1020 * @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
|
1021 */ |
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
|
1022 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
|
1023 { |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1024 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
|
1025 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
|
1026 |
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
|
1027 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
|
1028 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
|
1029 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
|
1030 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
|
1031 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
|
1032 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
|
1033 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
|
1034 break; |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1035 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
|
1036 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1037 } |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1038 |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1039 /** 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
|
1040 void SettingEntry::FoldAll() |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1041 { |
12676
d1ed749a9ce5
(svn r17131) -Codechange: apply coding style to some switch statements
smatz <smatz@openttd.org>
parents:
12632
diff
changeset
|
1042 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
|
1043 case SEF_SETTING_KIND: |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1044 break; |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1045 |
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
|
1046 case SEF_SUBTREE_KIND: |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1047 this->d.sub.folded = true; |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1048 this->d.sub.page->FoldAll(); |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1049 break; |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1050 |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1051 default: NOT_REACHED(); |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1052 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1053 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1054 |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1055 |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1056 /** |
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 * 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
|
1058 * @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
|
1059 * @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
|
1060 */ |
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
|
1061 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
|
1062 { |
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
|
1063 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
|
1064 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
|
1065 } |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1066 |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1067 /** 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
|
1068 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
|
1069 { |
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
|
1070 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
|
1071 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
|
1072 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
|
1073 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
|
1074 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
|
1075 |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1076 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
|
1077 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
|
1078 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1079 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1080 |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1081 /** |
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
|
1082 * 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
|
1083 * @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
|
1084 * @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
|
1085 * @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
|
1086 */ |
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
|
1087 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
|
1088 { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1089 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
|
1090 |
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
|
1091 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
|
1092 case SEF_SETTING_KIND: |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1093 (*cur_row)++; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1094 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
|
1095 case SEF_SUBTREE_KIND: |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1096 (*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
|
1097 if (this->d.sub.folded) { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1098 break; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1099 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1100 |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1101 /* 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
|
1102 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
|
1103 default: NOT_REACHED(); |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1104 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1105 return NULL; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1106 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1107 |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1108 /** |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1109 * Draw a row in the settings panel. |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1110 * |
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
|
1111 * 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
|
1112 * |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1113 * 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
|
1114 * 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
|
1115 * \verbatim |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1116 * |-- setting |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1117 * |-- (-) - Title |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1118 * | |-- setting |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1119 * | |-- setting |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1120 * \endverbatim |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1121 * 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
|
1122 * 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
|
1123 * |
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
|
1124 * @param settings_ptr Pointer to current values of all settings |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1125 * @param left Left-most position in window/panel to start drawing \a first_row |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1126 * @param right Right-most x position to draw strings at. |
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
|
1127 * @param base_y Upper-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
|
1128 * @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
|
1129 * @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
|
1130 * @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
|
1131 * @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
|
1132 * @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
|
1133 */ |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1134 uint SettingEntry::Draw(GameSettings *settings_ptr, int left, int right, int base_y, 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
|
1135 { |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1136 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
|
1137 |
16441
86fd9bcc9d2f
(svn r21157) -Codechange: remove information about the text direction out of the language "list"
rubidium <rubidium@openttd.org>
parents:
16302
diff
changeset
|
1138 bool rtl = _current_text_dir == TD_RTL; |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1139 int offset = rtl ? -4 : 4; |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1140 int level_width = rtl ? -LEVEL_WIDTH : LEVEL_WIDTH; |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1141 |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1142 int x = rtl ? right : left; |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1143 int y = base_y; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1144 if (cur_row >= first_row) { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1145 int colour = _colour_gradient[COLOUR_ORANGE][4]; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1146 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
|
1147 |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1148 /* Draw vertical for parent nesting levels */ |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1149 for (uint lvl = 0; lvl < this->level; lvl++) { |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1150 if (!HasBit(parent_last, lvl)) GfxDrawLine(x + offset, y, x + offset, y + SETTING_HEIGHT - 1, colour); |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1151 x += level_width; |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1152 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1153 /* draw own |- prefix */ |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1154 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
|
1155 int bottom_y = (flags & SEF_LAST_FIELD) ? halfway_y : y + SETTING_HEIGHT - 1; |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1156 GfxDrawLine(x + offset, y, x + offset, bottom_y, colour); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1157 /* Small horizontal line from the last vertical line */ |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1158 GfxDrawLine(x + offset, halfway_y, x + level_width - offset, halfway_y, colour); |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1159 x += level_width; |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1160 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1161 |
12676
d1ed749a9ce5
(svn r17131) -Codechange: apply coding style to some switch statements
smatz <smatz@openttd.org>
parents:
12632
diff
changeset
|
1162 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
|
1163 case SEF_SETTING_KIND: |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1164 if (cur_row >= first_row) { |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1165 DrawSetting(settings_ptr, this->d.entry.setting, rtl ? left : x, rtl ? x : right, y, this->flags & SEF_BUTTONS_MASK); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1166 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1167 cur_row++; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1168 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
|
1169 case SEF_SUBTREE_KIND: |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1170 if (cur_row >= first_row) { |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1171 DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? x - 8 : x, y + (SETTING_HEIGHT - 11) / 2); |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1172 DrawString(rtl ? left : x + 12, rtl ? x - 12 : right, y, this->d.sub.title); |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1173 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1174 cur_row++; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1175 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
|
1176 if (this->flags & SEF_LAST_FIELD) { |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1177 assert(this->level < sizeof(parent_last)); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1178 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
|
1179 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1180 |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1181 cur_row = this->d.sub.page->Draw(settings_ptr, left, right, base_y, 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
|
1182 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1183 break; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1184 default: NOT_REACHED(); |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1185 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1186 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
|
1187 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1188 |
13509
59959bee9f95
(svn r18028) -Codechange: unglobalise some functions
rubidium <rubidium@openttd.org>
parents:
13419
diff
changeset
|
1189 static const void *ResolveVariableAddress(const GameSettings *settings_ptr, const SettingDesc *sd) |
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
|
1190 { |
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
|
1191 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
|
1192 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
|
1193 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
|
1194 } 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
|
1195 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
|
1196 } |
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
|
1197 } 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
|
1198 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
|
1199 } |
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
|
1200 } |
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
|
1201 |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1202 /** |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1203 * 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
|
1204 * @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
|
1205 * @param sd Pointer to value description of setting to draw |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1206 * @param left Left-most position in window/panel to start drawing |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1207 * @param right Right-most position in window/panel to draw |
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
|
1208 * @param y Upper-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
|
1209 * @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
|
1210 */ |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1211 void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd, int left, int right, int y, 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
|
1212 { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1213 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
|
1214 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
|
1215 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
|
1216 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
|
1217 |
16441
86fd9bcc9d2f
(svn r21157) -Codechange: remove information about the text direction out of the language "list"
rubidium <rubidium@openttd.org>
parents:
16302
diff
changeset
|
1218 bool rtl = _current_text_dir == TD_RTL; |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1219 uint buttons_left = rtl ? right - 19 : left; |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1220 uint text_left = left + (rtl ? 0 : 25); |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1221 uint text_right = right - (rtl ? 25 : 0); |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1222 uint button_y = y + (SETTING_HEIGHT - 11) / 2; |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1223 |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1224 /* We do not allow changes of some items when we are a client in a networkgame */ |
17444
bf88fe868439
(svn r22198) -Codechange: make some constants name more explicit
rubidium <rubidium@openttd.org>
parents:
17244
diff
changeset
|
1225 if (!(sd->save.conv & SLF_NO_NETWORK_SYNC) && _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
|
1226 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
|
1227 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
|
1228 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1229 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
|
1230 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
|
1231 /* Draw checkbox for boolean-value either on/off */ |
16945
32309494f10d
(svn r21680) -Fix (r21656): of course MSVC complains
glx <glx@openttd.org>
parents:
16921
diff
changeset
|
1232 bool on = ReadValue(var, sd->save.conv) != 0; |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1233 |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1234 DrawFrameRect(buttons_left, button_y, buttons_left + 19, button_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
|
1235 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
|
1236 } else { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1237 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
|
1238 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1239 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
|
1240 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1241 /* Draw [<][>] boxes for settings of an integer-type */ |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1242 DrawArrowButtons(buttons_left, button_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
|
1243 |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1244 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
|
1245 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
|
1246 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
|
1247 } else { |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1248 if (sdb->flags & SGF_CURRENCY) { |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1249 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
|
1250 } else if (sdb->flags & SGF_MULTISTRING) { |
17456
6dce16791f02
(svn r22210) -Add: Add a variable for the value strings in the settings tables.
alberth <alberth@openttd.org>
parents:
17444
diff
changeset
|
1251 SetDParam(0, sdb->val_str - sdb->min + value); |
10665
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1252 } else { |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1253 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
|
1254 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1255 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
|
1256 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1257 } |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1258 DrawString(text_left, text_right, 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
|
1259 } |
5f8de7b4f4af
(svn r14967) -Codechange: split the drawing of the window into several smaller functions (Alberth)
rubidium <rubidium@openttd.org>
parents:
10664
diff
changeset
|
1260 |
10660
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
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 /* == 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
|
1263 |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1264 /** |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1265 * 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
|
1266 * @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
|
1267 */ |
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 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
|
1269 { |
13267d179635
(svn r14962) -Codechange: add the concept of patch entries and patch (sub) pages
rubidium <rubidium@openttd.org>
parents:
10659
diff
changeset
|
1270 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
|
1271 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
|
1272 } |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
1273 } |
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
1274 |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1275 /** 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
|
1276 void SettingsPage::FoldAll() |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1277 { |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1278 for (uint field = 0; field < this->num; field++) { |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1279 this->entries[field].FoldAll(); |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1280 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1281 } |
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1282 |
10662
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1283 /** 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
|
1284 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
|
1285 { |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1286 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
|
1287 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
|
1288 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
|
1289 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1290 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
|
1291 } |
5186b62666d4
(svn r14964) -Codechange: hide the length of a patch page behind a function (Alberth)
rubidium <rubidium@openttd.org>
parents:
10661
diff
changeset
|
1292 |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1293 /** |
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
|
1294 * 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
|
1295 * @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
|
1296 * @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
|
1297 * @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
|
1298 */ |
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
|
1299 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
|
1300 { |
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
|
1301 SettingEntry *pe = NULL; |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1302 |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1303 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
|
1304 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
|
1305 if (pe != NULL) { |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1306 break; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1307 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1308 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1309 return pe; |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1310 } |
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1311 |
10666
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1312 /** |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1313 * 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
|
1314 * |
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
|
1315 * 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
|
1316 * 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
|
1317 * 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
|
1318 * |
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
|
1319 * @param settings_ptr Pointer to current values of all settings |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1320 * @param left Left-most position in window/panel to start drawing of each setting row |
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1321 * @param right Right-most position in window/panel to draw at |
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
|
1322 * @param base_y Upper-most position in window/panel to start drawing of row number \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
|
1323 * @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
|
1324 * @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
|
1325 * @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
|
1326 * @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
|
1327 * @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
|
1328 */ |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1329 uint SettingsPage::Draw(GameSettings *settings_ptr, int left, int right, int base_y, 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
|
1330 { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1331 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
|
1332 |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1333 for (uint i = 0; i < this->num; i++) { |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1334 cur_row = this->entries[i].Draw(settings_ptr, left, right, base_y, 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
|
1335 if (cur_row >= max_row) { |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1336 break; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1337 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1338 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1339 return cur_row; |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1340 } |
eacae31e4fe5
(svn r14969) -Codechange: make drawing trees possible (Alberth)
rubidium <rubidium@openttd.org>
parents:
10665
diff
changeset
|
1341 |
10659
b800143c7941
(svn r14961) -Update: remove the string from r14960 from the other languages too.
rubidium <rubidium@openttd.org>
parents:
10658
diff
changeset
|
1342 |
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 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
|
1344 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
|
1345 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
|
1346 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
|
1347 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
|
1348 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
|
1349 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
|
1350 SettingEntry("gui.expenses_layout"), |
14493
522dc4972f9f
(svn r19064) -Feature: Allow to select different land colours for the smallmap (reworked by Alberth).
terkhen <terkhen@openttd.org>
parents:
14409
diff
changeset
|
1351 SettingEntry("gui.smallmap_land_colour"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1352 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1353 /** 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
|
1354 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
|
1355 |
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
|
1356 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
|
1357 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
|
1358 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
|
1359 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
|
1360 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
|
1361 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
|
1362 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
|
1363 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
|
1364 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
|
1365 /* 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
|
1366 * 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
|
1367 * 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
|
1368 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
|
1369 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
|
1370 #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
|
1371 /* 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
|
1372 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
|
1373 #endif |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1374 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1375 /** 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
|
1376 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
|
1377 |
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
|
1378 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
|
1379 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
|
1380 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
|
1381 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
|
1382 SettingEntry("gui.errmsg_duration"), |
15495
9cffefe9d5db
(svn r20144) -Feature: Allow to configure the delay of hover events, or to disable them completely.
terkhen <terkhen@openttd.org>
parents:
15405
diff
changeset
|
1383 SettingEntry("gui.hover_delay"), |
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
|
1384 SettingEntry("gui.toolbar_pos"), |
16463
4c4c9177f5eb
(svn r21179) -Fix [FS#4201] (r69): if the main toolbar's location is configurable, why isn't the statusbar's location configurable?
rubidium <rubidium@openttd.org>
parents:
16448
diff
changeset
|
1385 SettingEntry("gui.statusbar_pos"), |
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
|
1386 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
|
1387 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
|
1388 SettingEntry("gui.timetable_in_ticks"), |
13760
a9c5c2c91d71
(svn r18285) -Feature: show the expected arrival/departure dates in the timetable window. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13756
diff
changeset
|
1389 SettingEntry("gui.timetable_arrival_departure"), |
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
|
1390 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
|
1391 SettingEntry("gui.default_rail_type"), |
17089
6e590e642890
(svn r21826) -Fix [FS#4007]: the expectations from the "always build infrastructure" setting name/description didn't match the behaviour
rubidium <rubidium@openttd.org>
parents:
16959
diff
changeset
|
1392 SettingEntry("gui.disable_unsuitable_building"), |
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
|
1393 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
|
1394 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
|
1395 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1396 /** 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
|
1397 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
|
1398 |
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
|
1399 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
|
1400 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
|
1401 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
|
1402 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
|
1403 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
|
1404 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
|
1405 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
|
1406 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1407 /** 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
|
1408 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
|
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 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
|
1411 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
|
1412 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
|
1413 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
|
1414 SettingEntry("construction.extra_dynamite"), |
17220
026d5463e627
(svn r21959) -Change: replace longbridges with custom maximum bridge and tunnel length setting
rubidium <rubidium@openttd.org>
parents:
17219
diff
changeset
|
1415 SettingEntry("construction.max_bridge_length"), |
026d5463e627
(svn r21959) -Change: replace longbridges with custom maximum bridge and tunnel length setting
rubidium <rubidium@openttd.org>
parents:
17219
diff
changeset
|
1416 SettingEntry("construction.max_tunnel_length"), |
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
|
1417 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
|
1418 SettingEntry("construction.freeform_edges"), |
13983
aaf1fd51e6ac
(svn r18522) -Feature: add the possibility to not make new tree tiles in-game
rubidium <rubidium@openttd.org>
parents:
13950
diff
changeset
|
1419 SettingEntry("construction.extra_tree_placement"), |
16694
2b17fca1c754
(svn r21426) -Change: introduce a setting for the types of commands that are allowed to be executed while paused
rubidium <rubidium@openttd.org>
parents:
16601
diff
changeset
|
1420 SettingEntry("construction.command_pause_level"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1421 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1422 /** 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
|
1423 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
|
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 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
|
1426 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
|
1427 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
|
1428 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
|
1429 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1430 /** 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
|
1431 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
|
1432 |
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
|
1433 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
|
1434 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
|
1435 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
|
1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 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
|
1441 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
|
1442 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1443 /** 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
|
1444 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
|
1445 |
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 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
|
1447 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
|
1448 SettingEntry("economy.exclusive_rights"), |
17234
08d6a07fe4ce
(svn r21974) -Feature: Add a setting to enable/disable funding local road reconstruction.
terkhen <terkhen@openttd.org>
parents:
17223
diff
changeset
|
1449 SettingEntry("economy.fund_roads"), |
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
|
1450 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
|
1451 SettingEntry("economy.allow_town_roads"), |
15405
fa04125ca60d
(svn r20048) -Feature: Add a setting to forbid towns building level crossings.
michi_cc <michi_cc@openttd.org>
parents:
14902
diff
changeset
|
1452 SettingEntry("economy.allow_town_level_crossings"), |
13756
9f062af2f34a
(svn r18281) -Feature: founding towns in-game (based on work by Belugas, TheJosh, GeekToo, Terkhen and others)
smatz <smatz@openttd.org>
parents:
13755
diff
changeset
|
1453 SettingEntry("economy.found_town"), |
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
|
1454 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
|
1455 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
|
1456 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
|
1457 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
|
1458 }; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1459 /** 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
|
1460 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
|
1461 |
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
|
1462 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
|
1463 SettingEntry("construction.raw_industry_construction"), |
15971
4a7b8f4d73dc
(svn r20659) -Feature: make the (flat) area around an industry configurable (Eddi|zuHause)
rubidium <rubidium@openttd.org>
parents:
15944
diff
changeset
|
1464 SettingEntry("construction.industry_platform"), |
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
|
1465 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
|
1466 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
|
1467 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1468 /** 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
|
1469 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
|
1470 |
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
|
1471 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
|
1472 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
|
1473 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
|
1474 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
|
1475 SettingEntry("economy.smooth_economy"), |
14155
96be446af436
(svn r18703) -Feature-ish: allow virtually paying a percentage of the leg profit in feeder chains. This to give the user a better chance to get a feeder system without "losses".
rubidium <rubidium@openttd.org>
parents:
14127
diff
changeset
|
1476 SettingEntry("economy.feeder_payment_share"), |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1477 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1478 /** 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
|
1479 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
|
1480 |
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 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
|
1482 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
|
1483 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
|
1484 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
|
1485 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
|
1486 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
|
1487 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
|
1488 }; |
10671
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1489 /** 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
|
1490 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
|
1491 |
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
|
1492 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
|
1493 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
|
1494 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
|
1495 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
|
1496 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1497 /** 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
|
1498 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
|
1499 |
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
|
1500 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
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 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
|
1506 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1507 /** 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
|
1508 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
|
1509 |
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
|
1510 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
|
1511 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
|
1512 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
|
1513 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
|
1514 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1515 /** 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
|
1516 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
|
1517 |
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
|
1518 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
|
1519 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
|
1520 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
|
1521 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
|
1522 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
|
1523 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
|
1524 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
|
1525 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
|
1526 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1527 /** 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
|
1528 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
|
1529 |
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
|
1530 static SettingEntry _settings_vehicles_trains[] = { |
17223
a1dda316ecbe
(svn r21962) -Feature-ish: GUI setting to disable reversing at signals
rubidium <rubidium@openttd.org>
parents:
17221
diff
changeset
|
1531 SettingEntry("pf.reverse_at_signals"), |
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
|
1532 SettingEntry("vehicle.train_acceleration_model"), |
14127
39a257893f4c
(svn r18674) -Feature (FS#3459): Configurable slope steepness for trains from 0% to 10%, default is 3% as before (mostly by Terkhen)
peter1138 <peter1138@openttd.org>
parents:
14065
diff
changeset
|
1533 SettingEntry("vehicle.train_slope_steepness"), |
17221
edf36d7f3f86
(svn r21960) -Change: show the length of vehicles in tiles, instead of half tiles in the depot
rubidium <rubidium@openttd.org>
parents:
17220
diff
changeset
|
1534 SettingEntry("vehicle.max_train_length"), |
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
|
1535 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
|
1536 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
|
1537 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
|
1538 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
|
1539 }; |
ec6b9e8e01aa
(svn r14974) -Change: reorder/reorganise the entries of the settings window (Alberth)
rubidium <rubidium@openttd.org>
parents:
10670
diff
changeset
|
1540 /** 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
|
1541 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
|
1542 |
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
|
1543 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
|
1544 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
|
1545 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
|
1546 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
|
1547 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
|
1548 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
|
1549 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
|
1550 SettingEntry("gui.vehicle_income_warn"), |
16772
975815b08336
(svn r21505) -Change: generalise the lost_train_warning setting to lost_vehicle_warning
rubidium <rubidium@openttd.org>
parents:
16734
diff
changeset
|
1551 SettingEntry("gui.lost_vehicle_warn"), |
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
|
1552 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
|
1553 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
|
1554 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
|
1555 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
|
1556 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
|
1557 SettingEntry("vehicle.plane_speed"), |
14385
5539b78ca7a4
(svn r18942) -Feature [FS#2678]: add a setting to reduce/disable aircraft crashes
yexo <yexo@openttd.org>
parents:
14350
diff
changeset
|
1558 SettingEntry("vehicle.plane_crashes"), |
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
|
1559 SettingEntry("vehicle.dynamic_engines"), |
14757
1cefc36bd6b2
(svn r19345) -Feature: Realistic acceleration for road vehicles.
terkhen <terkhen@openttd.org>
parents:
14645
diff
changeset
|
1560 SettingEntry("vehicle.roadveh_acceleration_model"), |
14758
bb75781f712c
(svn r19346) -Feature: Configurable slope steepness for road vehicles from 0% to 10%, default is 7%.
terkhen <terkhen@openttd.org>
parents:
14757
diff
changeset
|
1561 SettingEntry("vehicle.roadveh_slope_steepness"), |
16505
0e4e40cd6128
(svn r21231) -Codechange: Generalize the naming of some settings and variables related to visual effects (Hirundo)
rubidium <rubidium@openttd.org>
parents:
16502
diff
changeset
|
1562 SettingEntry("vehicle.smoke_amount"), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1563 }; |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1564 /** 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
|
1565 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
|
1566 |
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
|
1567 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
|
1568 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
|
1569 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
|
1570 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
|
1571 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
|
1572 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
|
1573 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
|
1574 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1575 |
10667
0a7a8b6d89b3
(svn r14970) -Change: move all (patch) settings to a single "page" (Alberth)
rubidium <rubidium@openttd.org>
parents:
10666
diff
changeset
|
1576 /** 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
|
1577 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
|
1578 |
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
|
1579 /** 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
|
1580 enum GameSettingsWidgets { |
11697
ef293835ecc2
(svn r16082) -Codechange: Completed the widget numbers of the advanced settings window.
alberth <alberth@openttd.org>
parents:
11657
diff
changeset
|
1581 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
|
1582 SETTINGSEL_SCROLLBAR, ///< Scrollbar |
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
|
1583 }; |
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
|
1584 |
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
|
1585 struct GameSettingsWindow : Window { |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1586 static const int SETTINGTREE_LEFT_OFFSET = 5; ///< Position of left edge of setting values |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1587 static const int SETTINGTREE_RIGHT_OFFSET = 5; ///< Position of right edge of setting values |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1588 static const int SETTINGTREE_TOP_OFFSET = 5; ///< Position of top edge of setting values |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1589 static const int SETTINGTREE_BOTTOM_OFFSET = 5; ///< Position of bottom 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
|
1590 |
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
|
1591 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
|
1592 |
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 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
|
1594 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
|
1595 |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1596 Scrollbar *vscroll; |
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1597 |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1598 GameSettingsWindow(const WindowDesc *desc) : Window() |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1599 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1600 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
|
1601 |
16959
55b2bec60c52
(svn r21695) -Codechange: add helper function to get the currently applicable GameSettings object
yexo <yexo@openttd.org>
parents:
16945
diff
changeset
|
1602 settings_ptr = &GetGameSettings(); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1603 |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1604 /* 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
|
1605 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
|
1606 _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
|
1607 first_time = false; |
10670
22ffe020ed5d
(svn r14973) -Codechange: recursively fold subpages (Alberth)
rubidium <rubidium@openttd.org>
parents:
10667
diff
changeset
|
1608 } 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
|
1609 _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
|
1610 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1611 |
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 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
|
1613 this->clicked_entry = NULL; // No numeric setting buttons are depressed |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1614 |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1615 this->CreateNestedTree(desc); |
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1616 this->vscroll = this->GetScrollbar(SETTINGSEL_SCROLLBAR); |
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1617 this->FinishInitNested(desc, 0); |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1618 |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1619 this->vscroll->SetCount(_settings_main_page.Length()); |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1620 } |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1621 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1622 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1623 { |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1624 if (widget != SETTINGSEL_OPTIONSPANEL) return; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1625 |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1626 resize->height = SETTING_HEIGHT = max(11, FONT_HEIGHT_NORMAL + 1); |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1627 resize->width = 1; |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1628 |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1629 size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET; |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1630 } |
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
|
1631 |
13364
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1632 virtual void DrawWidget(const Rect &r, int widget) const |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1633 { |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1634 if (widget != SETTINGSEL_OPTIONSPANEL) return; |
f52b5b6c607b
(svn r17873) -Codechange: make the advanced settings window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
1635 |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1636 _settings_main_page.Draw(settings_ptr, r.left + SETTINGTREE_LEFT_OFFSET, r.right - SETTINGTREE_RIGHT_OFFSET, r.top + SETTINGTREE_TOP_OFFSET, |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1637 this->vscroll->GetPosition(), this->vscroll->GetPosition() + this->vscroll->GetCapacity()); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1638 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1639 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14385
diff
changeset
|
1640 virtual void OnClick(Point pt, int widget, int click_count) |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1641 { |
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
|
1642 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
|
1643 |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1644 uint btn = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SETTINGSEL_OPTIONSPANEL, SETTINGTREE_TOP_OFFSET - 1); |
15563
011c8bee59d1
(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
alberth <alberth@openttd.org>
parents:
15495
diff
changeset
|
1645 if (btn == INT_MAX) return; |
10664
5316fadc3fbd
(svn r14966) -Codechange: simplify and generalise finding patch entries (Alberth)
rubidium <rubidium@openttd.org>
parents:
10663
diff
changeset
|
1646 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1647 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
|
1648 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
|
1649 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1650 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
|
1651 |
16441
86fd9bcc9d2f
(svn r21157) -Codechange: remove information about the text direction out of the language "list"
rubidium <rubidium@openttd.org>
parents:
16302
diff
changeset
|
1652 int x = (_current_text_dir == TD_RTL ? this->width - pt.x : pt.x) - SETTINGTREE_LEFT_OFFSET - (pe->level + 1) * LEVEL_WIDTH; // Shift x coordinate |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1653 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
|
1654 |
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
|
1655 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
|
1656 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
|
1657 |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1658 this->vscroll->SetCount(_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
|
1659 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
|
1660 return; |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1661 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1662 |
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
|
1663 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
|
1664 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
|
1665 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1666 /* return if action is only active in network, or only settable by server */ |
17444
bf88fe868439
(svn r22198) -Codechange: make some constants name more explicit
rubidium <rubidium@openttd.org>
parents:
17244
diff
changeset
|
1667 if (!(sd->save.conv & SLF_NO_NETWORK_SYNC) && _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
|
1668 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
|
1669 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
|
1670 |
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
|
1671 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
|
1672 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
|
1673 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1674 /* 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
|
1675 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
|
1676 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
|
1677 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
|
1678 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1679 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
|
1680 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
|
1681 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
|
1682 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
|
1683 /* 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
|
1684 * 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
|
1685 * 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
|
1686 * 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
|
1687 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
|
1688 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
|
1689 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1690 /* 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
|
1691 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
|
1692 _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
|
1693 return; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1694 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1695 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1696 /* 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
|
1697 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
|
1698 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
|
1699 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
|
1700 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
|
1701 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
|
1702 } 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
|
1703 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
|
1704 } |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1705 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
|
1706 } else { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1707 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
|
1708 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
|
1709 } |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1710 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1711 /* 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
|
1712 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
|
1713 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
|
1714 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
|
1715 } |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1716 this->clicked_entry = pe; |
16441
86fd9bcc9d2f
(svn r21157) -Codechange: remove information about the text direction out of the language "list"
rubidium <rubidium@openttd.org>
parents:
16302
diff
changeset
|
1717 this->clicked_entry->SetButtons((x >= 10) != (_current_text_dir == TD_RTL) ? 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
|
1718 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
|
1719 _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
|
1720 } |
15618
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15563
diff
changeset
|
1721 break; |
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15563
diff
changeset
|
1722 } |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1723 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1724 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
|
1725 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1726 |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1727 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
|
1728 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
|
1729 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
|
1730 } 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
|
1731 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
|
1732 } |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1733 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
|
1734 } |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1735 } else { |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1736 /* 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
|
1737 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
|
1738 /* 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
|
1739 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
|
1740 |
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1741 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
|
1742 SetDParam(0, value); |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1743 ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, 100, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); |
10674
142d8484c2d8
(svn r14978) -Codechange: simplify the control flow of the OnClick of the settings window
rubidium <rubidium@openttd.org>
parents:
10671
diff
changeset
|
1744 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1745 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1746 } |
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
|
1747 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1748 virtual void OnTimeout() |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1749 { |
10661
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1750 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
|
1751 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
|
1752 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
|
1753 this->SetDirty(); |
ba3579a2b84f
(svn r14963) -Codechange: remember what entry was clicked instead of the index (Alberth)
rubidium <rubidium@openttd.org>
parents:
10660
diff
changeset
|
1754 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1755 } |
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
|
1756 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1757 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
|
1758 { |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1759 /* The user pressed cancel */ |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1760 if (str == NULL) return; |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1761 |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1762 assert(this->valuewindow_entry != NULL); |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1763 assert((this->valuewindow_entry->flags & SEF_KIND_MASK) == SEF_SETTING_KIND); |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1764 const SettingDesc *sd = this->valuewindow_entry->d.entry.setting; |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1765 |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1766 int32 value; |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1767 if (!StrEmpty(str)) { |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1768 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
|
1769 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1770 /* 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
|
1771 if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1772 } else { |
14350
1718b22a6aa8
(svn r18905) -Fix (r18902): Compile error on 64-bit with gcc
peter1138 <peter1138@openttd.org>
parents:
14347
diff
changeset
|
1773 value = (int32)(size_t)sd->desc.def; |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1774 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1775 |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1776 if ((sd->desc.flags & SGF_PER_COMPANY) != 0) { |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1777 SetCompanySetting(this->valuewindow_entry->d.entry.index, value); |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1778 } else { |
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1779 SetSettingValue(this->valuewindow_entry->d.entry.index, value); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1780 } |
14347
a3c6860ea115
(svn r18902) -Fix [FS#3559]: the default button for the advanced settings didn't work
rubidium <rubidium@openttd.org>
parents:
14330
diff
changeset
|
1781 this->SetDirty(); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1782 } |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1783 |
13344
04b02b2cfa2b
(svn r17853) -Codechange: remove the 'delta' parameter from OnResize; it was used in ways that aren't always wanted, causing bugs and the like. Also with nested widgets most reasons for handling OnResize have gone.
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
1784 virtual void OnResize() |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1785 { |
15779
9ad2843db6f4
(svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
frosch <frosch@openttd.org>
parents:
15778
diff
changeset
|
1786 this->vscroll->SetCapacityFromWidget(this, SETTINGSEL_OPTIONSPANEL, SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET); |
10543
0667832b2888
(svn r14800) -Codechange: make the advanced settings window resizeable and scrollable (most by Alberth)
rubidium <rubidium@openttd.org>
parents:
10542
diff
changeset
|
1787 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1788 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1789 |
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
|
1790 GameSettings *GameSettingsWindow::settings_ptr = NULL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1791 |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1792 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
|
1793 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1794 NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1795 NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_CONFIG_SETTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1796 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1797 NWidget(NWID_HORIZONTAL), |
15778
4f4c3160cca8
(svn r20452) -Codechange: Remove NWidgetCore::FindScrollbar() and associate scrollbar explicitly using a NWidgetPart via SetScrollbar().
frosch <frosch@openttd.org>
parents:
15710
diff
changeset
|
1798 NWidget(WWT_PANEL, COLOUR_MAUVE, SETTINGSEL_OPTIONSPANEL), SetMinimalSize(400, 174), SetScrollbar(SETTINGSEL_SCROLLBAR), EndContainer(), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1799 NWidget(NWID_VERTICAL), |
15787
6c4bec3b8401
(svn r20461) -Codechange: Replace WWT_HSCROLLBAR, WWT_SCROLLBAR and WWT_SCROLL2BAR with NWID_HSCROLLBAR and NWID_VSCROLLBAR.
frosch <frosch@openttd.org>
parents:
15779
diff
changeset
|
1800 NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, SETTINGSEL_SCROLLBAR), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1801 NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1802 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1803 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1804 }; |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
1805 |
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
|
1806 static const WindowDesc _settings_selection_desc( |
13796
3e68f07eb821
(svn r18322) -Codechange: remove the WDP duplication; no need to tell the same twice.
rubidium <rubidium@openttd.org>
parents:
13760
diff
changeset
|
1807 WDP_CENTER, 450, 397, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
1808 WC_GAME_OPTIONS, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13705
diff
changeset
|
1809 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
1810 _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
|
1811 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1812 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
1813 /** Open advanced settings window. */ |
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
|
1814 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
|
1815 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1816 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
|
1817 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
|
1818 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1819 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1820 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1821 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1822 * 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
|
1823 * @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
|
1824 * @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
|
1825 * @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
|
1826 * @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
|
1827 * @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
|
1828 * @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
|
1829 */ |
9872
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1830 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
|
1831 { |
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
|
1832 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
|
1833 |
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
|
1834 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
|
1835 DrawFrameRect(x + 10, y + 1, x + 19, y + 9, button_colour, (state == 2) ? FR_LOWERED : FR_NONE); |
13665
d9309c7b84bf
(svn r18189) -Codechange: remove some now unneeded strings
rubidium <rubidium@openttd.org>
parents:
13663
diff
changeset
|
1836 DrawSprite(SPR_ARROW_LEFT, PAL_NONE, x + WD_IMGBTN_LEFT, y + WD_IMGBTN_TOP); |
d9309c7b84bf
(svn r18189) -Codechange: remove some now unneeded strings
rubidium <rubidium@openttd.org>
parents:
13663
diff
changeset
|
1837 DrawSprite(SPR_ARROW_RIGHT, PAL_NONE, x + WD_IMGBTN_LEFT + 10, y + WD_IMGBTN_TOP); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1838 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1839 /* Grey out the buttons that aren't clickable */ |
16441
86fd9bcc9d2f
(svn r21157) -Codechange: remove information about the text direction out of the language "list"
rubidium <rubidium@openttd.org>
parents:
16302
diff
changeset
|
1840 bool rtl = _current_text_dir == TD_RTL; |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1841 if (rtl ? !clickable_right : !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
|
1842 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
|
1843 } |
13672
24880b3f9d87
(svn r18197) -Codechange: make the advanced settings window RTL aware and more big font aware
rubidium <rubidium@openttd.org>
parents:
13670
diff
changeset
|
1844 if (rtl ? !clickable_left : !clickable_right) { |
9872
c26adcd5367e
(svn r14018) -Fix (r14017): Typos prevented compilation.
peter1138 <peter1138@openttd.org>
parents:
9871
diff
changeset
|
1845 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
|
1846 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1847 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1848 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1849 /** 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
|
1850 enum CustomCurrencyWidgets { |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1851 CUSTCURR_RATE_DOWN, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1852 CUSTCURR_RATE_UP, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1853 CUSTCURR_RATE, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1854 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
|
1855 CUSTCURR_SEPARATOR, |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1856 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
|
1857 CUSTCURR_PREFIX, |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1858 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
|
1859 CUSTCURR_SUFFIX, |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1860 CUSTCURR_YEAR_DOWN, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1861 CUSTCURR_YEAR_UP, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1862 CUSTCURR_YEAR, |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1863 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
|
1864 }; |
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
|
1865 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1866 struct CustomCurrencyWindow : Window { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1867 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
|
1868 |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1869 CustomCurrencyWindow(const WindowDesc *desc) : Window() |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1870 { |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1871 this->InitNested(desc); |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1872 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1873 SetButtonState(); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1874 } |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1875 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1876 void SetButtonState() |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1877 { |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1878 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
|
1879 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
|
1880 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
|
1881 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
|
1882 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1883 |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1884 virtual void SetStringParameters(int widget) const |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1885 { |
13136
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1886 switch (widget) { |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1887 case CUSTCURR_RATE: SetDParam(0, 1); SetDParam(1, 1); break; |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1888 case CUSTCURR_SEPARATOR: SetDParamStr(0, _custom_currency.separator); break; |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1889 case CUSTCURR_PREFIX: SetDParamStr(0, _custom_currency.prefix); break; |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1890 case CUSTCURR_SUFFIX: SetDParamStr(0, _custom_currency.suffix); break; |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1891 case CUSTCURR_YEAR: |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1892 SetDParam(0, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER); |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1893 SetDParam(1, _custom_currency.to_euro); |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1894 break; |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1895 |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1896 case CUSTCURR_PREVIEW: |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1897 SetDParam(0, 10000); |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1898 break; |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1899 } |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1900 } |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1901 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1902 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1903 { |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1904 switch (widget) { |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1905 /* Set the appropriate width for the edit 'buttons' */ |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1906 case CUSTCURR_SEPARATOR_EDIT: |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1907 case CUSTCURR_PREFIX_EDIT: |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1908 case CUSTCURR_SUFFIX_EDIT: |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13672
diff
changeset
|
1909 size->width = this->GetWidget<NWidgetBase>(CUSTCURR_RATE_DOWN)->smallest_x + this->GetWidget<NWidgetBase>(CUSTCURR_RATE_UP)->smallest_x; |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1910 break; |
13136
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1911 |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1912 /* Make sure the window is wide enough for the widest exchange rate */ |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1913 case CUSTCURR_RATE: |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1914 SetDParam(0, 1); |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1915 SetDParam(1, INT32_MAX); |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1916 *size = GetStringBoundingBox(STR_CURRENCY_EXCHANGE_RATE); |
7db0723659c0
(svn r17641) -Codechange: remove the {N:...} that's not needed anymore since the currency window is nested.
rubidium <rubidium@openttd.org>
parents:
13135
diff
changeset
|
1917 break; |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1918 } |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1919 } |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
1920 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14385
diff
changeset
|
1921 virtual void OnClick(Point pt, int widget, int click_count) |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1922 { |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1923 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
|
1924 int len = 0; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1925 StringID str = 0; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1926 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
|
1927 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1928 switch (widget) { |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1929 case CUSTCURR_RATE_DOWN: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1930 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
|
1931 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
|
1932 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
|
1933 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
|
1934 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1935 case CUSTCURR_RATE_UP: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1936 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
|
1937 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
|
1938 this->EnableWidget(CUSTCURR_RATE_DOWN); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1939 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1940 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1941 case CUSTCURR_RATE: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1942 SetDParam(0, _custom_currency.rate); |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
1943 str = STR_JUST_INT; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1944 len = 5; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1945 line = CUSTCURR_RATE; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1946 afilter = CS_NUMERAL; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1947 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1948 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1949 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
|
1950 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
|
1951 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
|
1952 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
|
1953 len = 1; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1954 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
|
1955 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
|
1956 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1957 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
|
1958 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
|
1959 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
|
1960 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
|
1961 len = 12; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1962 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
|
1963 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
|
1964 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1965 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
|
1966 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
|
1967 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
|
1968 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
|
1969 len = 12; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1970 line = CUSTCURR_SUFFIX; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1971 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1972 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1973 case CUSTCURR_YEAR_DOWN: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1974 _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
|
1975 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
|
1976 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
|
1977 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
|
1978 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1979 case CUSTCURR_YEAR_UP: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1980 _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
|
1981 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
|
1982 this->EnableWidget(CUSTCURR_YEAR_DOWN); |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1983 break; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1984 |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1985 case CUSTCURR_YEAR: |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1986 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
|
1987 str = STR_JUST_INT; |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1988 len = 7; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1989 line = CUSTCURR_YEAR; |
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1990 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
|
1991 break; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1992 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1993 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1994 if (len != 0) { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
1995 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
|
1996 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
|
1997 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1998 |
10180
e024f1d28082
(svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents:
10145
diff
changeset
|
1999 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
|
2000 this->SetDirty(); |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2001 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2002 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2003 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
|
2004 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2005 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
|
2006 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2007 switch (this->query_widget) { |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
2008 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
|
2009 _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
|
2010 break; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2011 |
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
|
2012 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
|
2013 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
|
2014 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
|
2015 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2016 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
|
2017 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
|
2018 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
|
2019 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2020 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
|
2021 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
|
2022 break; |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2023 |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
2024 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
|
2025 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
|
2026 |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2027 _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
|
2028 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
|
2029 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2030 } |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2031 MarkWholeScreenDirty(); |
11752
99ab03ebd58c
(svn r16142) -Codechange: Use widgets in the custom currency window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
2032 SetButtonState(); |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2033 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2034 |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2035 virtual void OnTimeout() |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2036 { |
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2037 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
|
2038 } |
9246
1684bf12f0e0
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium <rubidium@openttd.org>
parents:
9231
diff
changeset
|
2039 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2040 |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
2041 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
|
2042 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
2043 NWidget(WWT_CLOSEBOX, COLOUR_GREY), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
2044 NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
2045 EndContainer(), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
2046 NWidget(WWT_PANEL, COLOUR_GREY), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2047 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(7, 3, 0), |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2048 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 5), |
15795
c9cf5fe6d6a1
(svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked.
frosch <frosch@openttd.org>
parents:
15787
diff
changeset
|
2049 NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, CUSTCURR_RATE_DOWN), SetDataTip(AWV_DECREASE, STR_CURRENCY_DECREASE_EXCHANGE_RATE_TOOLTIP), |
c9cf5fe6d6a1
(svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked.
frosch <frosch@openttd.org>
parents:
15787
diff
changeset
|
2050 NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, CUSTCURR_RATE_UP), SetDataTip(AWV_INCREASE, STR_CURRENCY_INCREASE_EXCHANGE_RATE_TOOLTIP), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2051 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2052 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_RATE), SetDataTip(STR_CURRENCY_EXCHANGE_RATE, STR_CURRENCY_SET_EXCHANGE_RATE_TOOLTIP), SetFill(1, 0), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2053 EndContainer(), |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2054 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2055 NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_SEPARATOR_EDIT), SetDataTip(0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP), SetFill(0, 1), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2056 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2057 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_SEPARATOR), SetDataTip(STR_CURRENCY_SEPARATOR, STR_CURRENCY_SET_CUSTOM_CURRENCY_SEPARATOR_TOOLTIP), SetFill(1, 0), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2058 EndContainer(), |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2059 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2060 NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_PREFIX_EDIT), SetDataTip(0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP), SetFill(0, 1), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2061 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2062 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_PREFIX), SetDataTip(STR_CURRENCY_PREFIX, STR_CURRENCY_SET_CUSTOM_CURRENCY_PREFIX_TOOLTIP), SetFill(1, 0), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2063 EndContainer(), |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2064 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2065 NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_SUFFIX_EDIT), SetDataTip(0x0, STR_CURRENCY_SET_CUSTOM_CURRENCY_SUFFIX_TOOLTIP), SetFill(0, 1), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2066 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2067 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_SUFFIX), SetDataTip(STR_CURRENCY_SUFFIX, STR_CURRENCY_SET_CUSTOM_CURRENCY_SUFFIX_TOOLTIP), SetFill(1, 0), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2068 EndContainer(), |
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2069 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 5), |
15795
c9cf5fe6d6a1
(svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked.
frosch <frosch@openttd.org>
parents:
15787
diff
changeset
|
2070 NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, CUSTCURR_YEAR_DOWN), SetDataTip(AWV_DECREASE, STR_CURRENCY_DECREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP), |
c9cf5fe6d6a1
(svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked.
frosch <frosch@openttd.org>
parents:
15787
diff
changeset
|
2071 NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, CUSTCURR_YEAR_UP), SetDataTip(AWV_INCREASE, STR_CURRENCY_INCREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2072 NWidget(NWID_SPACER), SetMinimalSize(5, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2073 NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_YEAR), SetDataTip(STR_JUST_STRING, STR_CURRENCY_SET_CUSTOM_CURRENCY_TO_EURO_TOOLTIP), SetFill(1, 0), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2074 EndContainer(), |
11762
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
2075 EndContainer(), |
13135
781c6205c0d7
(svn r17640) -Codechange: make the custom currency window nested
rubidium <rubidium@openttd.org>
parents:
13134
diff
changeset
|
2076 NWidget(WWT_LABEL, COLOUR_BLUE, CUSTCURR_PREVIEW), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
2077 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
|
2078 EndContainer(), |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
2079 }; |
6ee45c95e58e
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
alberth <alberth@openttd.org>
parents:
11754
diff
changeset
|
2080 |
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
|
2081 static const WindowDesc _cust_currency_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
2082 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
2083 WC_CUSTOM_CURRENCY, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13705
diff
changeset
|
2084 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
2085 _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
|
2086 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2087 |
16734
634ab1038a43
(svn r21467) -Doc: Add a few doxygen comments to config file settings code.
alberth <alberth@openttd.org>
parents:
16694
diff
changeset
|
2088 /** Open custom currency window. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
2089 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
|
2090 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2091 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
|
2092 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
|
2093 } |