Mercurial > hg > openttd
annotate src/settings_gui.cpp @ 8593:90ffef351faa draft
(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.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Mon, 18 Feb 2008 12:36:10 +0000 |
parents | bfe75aee55ee |
children | 2ed0f71a87ff |
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 |
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
|
3 /** @file settings_gui.cpp */ |
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
|
4 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
5 #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
|
6 #include "openttd.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
7 #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
|
8 #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
|
9 #include "window_gui.h" |
f65cf2bc3255
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents:
8106
diff
changeset
|
10 #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
|
11 #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
|
12 #include "engine.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 "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
|
14 #include "newgrf.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
15 #include "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
|
16 #include "town.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
17 #include "variables.h" |
8208
ddc34919158f
(svn r11771) -Codechange: split settings.h into better separated headers.
rubidium <rubidium@openttd.org>
parents:
8191
diff
changeset
|
18 #include "settings_internal.h" |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
19 #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
|
20 #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
|
21 #include "functions.h" |
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
|
22 #include "window_func.h" |
8144
d18c8a0bb638
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium <rubidium@openttd.org>
parents:
8140
diff
changeset
|
23 #include "vehicle_base.h" |
8213
87c85bb42d6f
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents:
8208
diff
changeset
|
24 #include "core/alloc_func.hpp" |
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
|
25 #include "string_func.h" |
8224
c45446125bf0
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents:
8214
diff
changeset
|
26 #include "gfx_func.h" |
8505
1a32b4c9019b
(svn r12080) -Fix: update waypoint signs when changing language
glx <glx@openttd.org>
parents:
8424
diff
changeset
|
27 #include "waypoint.h" |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
28 #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
|
29 #include "widgets/dropdown_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
|
30 |
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
|
31 #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
|
32 #include "table/strings.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8224
diff
changeset
|
33 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
34 static const StringID _units_dropdown[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
35 STR_UNITS_IMPERIAL, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
36 STR_UNITS_METRIC, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
37 STR_UNITS_SI, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
38 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
|
39 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
40 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
41 static const StringID _driveside_dropdown[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
42 STR_02E9_DRIVE_ON_LEFT, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
43 STR_02EA_DRIVE_ON_RIGHT, |
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 _autosave_dropdown[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
48 STR_02F7_OFF, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
49 STR_AUTOSAVE_1_MONTH, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
50 STR_02F8_EVERY_3_MONTHS, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
51 STR_02F9_EVERY_6_MONTHS, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
52 STR_02FA_EVERY_12_MONTHS, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
53 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
|
54 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
55 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
56 static const StringID _designnames_dropdown[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
57 STR_02BE_DEFAULT, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
58 STR_02BF_CUSTOM, |
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 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
62 static StringID *BuildDynamicDropdown(StringID base, int num) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
63 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
64 static StringID buf[32 + 1]; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
65 StringID *p = buf; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
66 while (--num>=0) *p++ = base++; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
67 *p = INVALID_STRING_ID; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
68 return buf; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
69 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
70 |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
71 int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
72 static StringID *_grf_names = NULL; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
73 static int _nb_grf_names = 0; |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
74 |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
75 void InitGRFTownGeneratorNames() |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
76 { |
6956
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
77 free(_grf_names); |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
78 _grf_names = GetGRFTownNameList(); |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
79 _nb_grf_names = 0; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
80 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
|
81 } |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
82 |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
83 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
|
84 { |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
85 if (town_name < _nb_orig_names) return STR_TOWNNAME_ORIGINAL_ENGLISH + town_name; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
86 town_name -= _nb_orig_names; |
6d300d04ac5e
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx <glx@openttd.org>
parents:
6950
diff
changeset
|
87 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
|
88 return STR_UNDEFINED; |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
89 } |
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
90 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
91 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
|
92 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
93 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
|
94 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
95 for (i = 0; i != _num_resolutions; i++) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
96 if (_resolutions[i][0] == _screen.width && |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
97 _resolutions[i][1] == _screen.height) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
98 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
99 } |
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 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
|
102 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
103 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
104 static inline bool RoadVehiclesAreBuilt() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
105 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
106 const Vehicle* v; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
107 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
108 FOR_ALL_VEHICLES(v) { |
6259
4a39d6291d58
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium <rubidium@openttd.org>
parents:
6255
diff
changeset
|
109 if (v->type == VEH_ROAD) return true; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
110 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
111 return false; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
112 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
113 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
114 |
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
|
115 enum GameOptionsWidgets { |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
116 GAMEOPT_CURRENCY_BTN = 4, |
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
117 GAMEOPT_DISTANCE_BTN = 6, |
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
118 GAMEOPT_ROADSIDE_BTN = 8, |
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
119 GAMEOPT_TOWNNAME_BTN = 10, |
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
120 GAMEOPT_AUTOSAVE_BTN = 12, |
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
121 GAMEOPT_VEHICLENAME_BTN = 14, |
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
|
122 GAMEOPT_VEHICLENAME_SAVE, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
123 GAMEOPT_LANG_BTN = 17, |
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
124 GAMEOPT_RESOLUTION_BTN = 19, |
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 GAMEOPT_FULLSCREEN, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
126 GAMEOPT_SCREENSHOT_BTN = 22, |
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
|
127 }; |
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
|
128 |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
129 /** |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
130 * Update/redraw the townnames dropdown |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
131 * @param w the window the dropdown belongs to |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
132 * @param sel the currently selected townname generator |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
133 */ |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
134 static void ShowTownnameDropdown(Window *w, int sel) |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
135 { |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
136 typedef std::map<StringID, int, StringIDCompare> TownList; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
137 TownList townnames; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
138 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
139 /* Add and sort original townnames generators */ |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
140 for (int i = 0; i < _nb_orig_names; i++) townnames[STR_TOWNNAME_ORIGINAL_ENGLISH + i] = i; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
141 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
142 /* Add and sort newgrf townnames generators */ |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
143 for (int i = 0; i < _nb_grf_names; i++) townnames[_grf_names[i]] = _nb_orig_names + i; |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
144 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
145 DropDownList *list = new DropDownList(); |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
146 for (TownList::iterator it = townnames.begin(); it != townnames.end(); it++) { |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
147 list->push_back(new DropDownListStringItem((*it).first, (*it).second, !(_game_mode == GM_MENU || (*it).second == sel))); |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
148 } |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
149 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
150 ShowDropDownList(w, list, sel, GAMEOPT_TOWNNAME_BTN); |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
151 } |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
152 |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
153 /** |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
154 * Update/redraw the languages dropdown |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
155 * @param w the window the dropdown belongs to |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
156 */ |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
157 static void ShowLangDropdown(Window *w) |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
158 { |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
159 typedef std::map<StringID, int, StringIDCompare> LangList; |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
160 |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
161 /* Sort language names */ |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
162 LangList langs; |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
163 for (int i = 0; i < _dynlang.num; i++) langs[SPECSTR_LANGUAGE_START + i] = i; |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
164 |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
165 DropDownList *list = new DropDownList(); |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
166 for (LangList::iterator it = langs.begin(); it != langs.end(); it++) { |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
167 list->push_back(new DropDownListStringItem((*it).first, (*it).second, false)); |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
168 } |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
169 |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
170 ShowDropDownList(w, list, _dynlang.curr, GAMEOPT_LANG_BTN); |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
171 } |
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
172 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
173 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
|
174 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
175 static void GameOptionsWndProc(Window *w, WindowEvent *e) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
176 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
177 switch (e->event) { |
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
|
178 case WE_PAINT: { |
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
|
179 int i; |
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
|
180 StringID str = STR_02BE_DEFAULT; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
181 |
8319
b2743d3ccecb
(svn r11884) -Cleanup: leftover use of widget numbers instead of enum
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
182 w->SetWidgetDisabledState(GAMEOPT_VEHICLENAME_SAVE, !(_vehicle_design_names & 1)); |
b2743d3ccecb
(svn r11884) -Cleanup: leftover use of widget numbers instead of enum
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
183 if (!w->IsWidgetDisabled(GAMEOPT_VEHICLENAME_SAVE)) str = STR_02BF_CUSTOM; |
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
|
184 SetDParam(0, str); |
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
|
185 SetDParam(1, _currency_specs[_opt_ptr->currency].name); |
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
|
186 SetDParam(2, STR_UNITS_IMPERIAL + _opt_ptr->units); |
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
|
187 SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side); |
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
|
188 SetDParam(4, TownName(_opt_ptr->town_name)); |
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
|
189 SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]); |
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
190 SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr); |
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
|
191 i = GetCurRes(); |
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
|
192 SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); |
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
|
193 SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
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
|
194 w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); |
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
|
195 |
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
|
196 DrawWindowWidgets(w); |
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
|
197 DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen |
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
|
198 } break; |
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
|
199 |
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
|
200 case WE_CLICK: |
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
|
201 switch (e->we.click.widget) { |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
202 case GAMEOPT_CURRENCY_BTN: /* Setup currencies dropdown */ |
8191
48b17d8d12c7
(svn r11754) -Fix(r11753): One too much command separator (;). Thanks glx for spotting
belugas <belugas@openttd.org>
parents:
8190
diff
changeset
|
203 ShowDropDownMenu(w, BuildCurrencyDropdown(), _opt_ptr->currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); |
6797
d48143c8467b
(svn r10036) -Add: sort the strings in town names dropdown
glx <glx@openttd.org>
parents:
6730
diff
changeset
|
204 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
|
205 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
206 case GAMEOPT_DISTANCE_BTN: /* Setup distance unit dropdown */ |
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
|
207 ShowDropDownMenu(w, _units_dropdown, _opt_ptr->units, GAMEOPT_DISTANCE_BTN, 0, 0); |
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
|
208 break; |
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
|
209 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
210 case GAMEOPT_ROADSIDE_BTN: { /* Setup road-side dropdown */ |
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
|
211 int i = 0; |
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
|
212 |
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
|
213 /* You can only change the drive side if you are in the menu or ingame with |
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
|
214 * no vehicles present. In a networking game only the server can change it */ |
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
|
215 if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) |
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
|
216 i = (-1) ^ (1 << _opt_ptr->road_side); // disable the other value |
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
|
217 |
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
|
218 ShowDropDownMenu(w, _driveside_dropdown, _opt_ptr->road_side, GAMEOPT_ROADSIDE_BTN, i, 0); |
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
|
219 } 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
|
220 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
221 case GAMEOPT_TOWNNAME_BTN: /* Setup townname dropdown */ |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
222 ShowTownnameDropdown(w, _opt_ptr->town_name); |
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
223 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
|
224 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
225 case GAMEOPT_AUTOSAVE_BTN: /* Setup autosave dropdown */ |
8190
eb210e97738e
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas <belugas@openttd.org>
parents:
8189
diff
changeset
|
226 ShowDropDownMenu(w, _autosave_dropdown, _opt_ptr->autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0); |
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
|
227 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
|
228 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
229 case GAMEOPT_VEHICLENAME_BTN: /* Setup customized vehicle-names dropdown */ |
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
|
230 ShowDropDownMenu(w, _designnames_dropdown, (_vehicle_design_names & 1) ? 1 : 0, GAMEOPT_VEHICLENAME_BTN, (_vehicle_design_names & 2) ? 0 : 2, 0); |
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
|
231 break; |
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
|
232 |
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
|
233 case GAMEOPT_VEHICLENAME_SAVE: /* Save customized vehicle-names to disk */ |
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
|
234 break; // not implemented |
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
|
235 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
236 case GAMEOPT_LANG_BTN: /* Setup interface language dropdown */ |
8321
c361d51b1bb8
(svn r11886) -Add: sort the strings in languages dropdown
glx <glx@openttd.org>
parents:
8319
diff
changeset
|
237 ShowLangDropdown(w); |
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
|
238 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
|
239 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
240 case GAMEOPT_RESOLUTION_BTN: /* Setup resolution dropdown */ |
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
|
241 ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), GAMEOPT_RESOLUTION_BTN, 0, 0); |
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
|
242 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
|
243 |
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
|
244 case GAMEOPT_FULLSCREEN: /* Click fullscreen on/off */ |
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
|
245 /* try to toggle full-screen on/off */ |
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
|
246 if (!ToggleFullScreen(!_fullscreen)) { |
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
|
247 ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0); |
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
|
248 } |
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
|
249 w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); |
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
|
250 SetWindowDirty(w); |
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
|
251 break; |
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
|
252 |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
253 case GAMEOPT_SCREENSHOT_BTN: /* Setup screenshot format dropdown */ |
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
|
254 ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, GAMEOPT_SCREENSHOT_BTN, 0, 0); |
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
|
255 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
|
256 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
257 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
|
258 |
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
|
259 case WE_DROPDOWN_SELECT: |
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
|
260 switch (e->we.dropdown.button) { |
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
|
261 case GAMEOPT_VEHICLENAME_BTN: /* Vehicle design names */ |
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
|
262 if (e->we.dropdown.index == 0) { |
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
|
263 DeleteCustomEngineNames(); |
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
|
264 MarkWholeScreenDirty(); |
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
|
265 } else if (!(_vehicle_design_names & 1)) { |
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
|
266 LoadCustomEngineNames(); |
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
|
267 MarkWholeScreenDirty(); |
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
|
268 } |
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
|
269 break; |
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
|
270 |
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
|
271 case GAMEOPT_CURRENCY_BTN: /* Currency */ |
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
|
272 if (e->we.dropdown.index == CUSTOM_CURRENCY_ID) ShowCustCurrency(); |
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
|
273 _opt_ptr->currency = e->we.dropdown.index; |
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
|
274 MarkWholeScreenDirty(); |
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
|
275 break; |
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
|
276 |
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
|
277 case GAMEOPT_DISTANCE_BTN: /* Measuring units */ |
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
|
278 _opt_ptr->units = e->we.dropdown.index; |
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
|
279 MarkWholeScreenDirty(); |
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
|
280 break; |
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
|
281 |
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
|
282 case GAMEOPT_ROADSIDE_BTN: /* Road side */ |
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
|
283 if (_opt_ptr->road_side != e->we.dropdown.index) { // only change if setting changed |
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
|
284 DoCommandP(0, e->we.dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS)); |
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
|
285 MarkWholeScreenDirty(); |
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
|
286 } |
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
|
287 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
|
288 |
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
|
289 case GAMEOPT_TOWNNAME_BTN: /* Town names */ |
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
|
290 if (_game_mode == GM_MENU) { |
8323
803ed468fc77
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx <glx@openttd.org>
parents:
8321
diff
changeset
|
291 _opt_ptr->town_name = e->we.dropdown.index; |
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
|
292 InvalidateWindow(WC_GAME_OPTIONS, 0); |
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
|
293 } |
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
|
294 break; |
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
|
295 |
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
|
296 case GAMEOPT_AUTOSAVE_BTN: /* Autosave options */ |
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
|
297 _opt.autosave = _opt_newgame.autosave = e->we.dropdown.index; |
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
|
298 SetWindowDirty(w); |
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
|
299 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
|
300 |
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
|
301 case GAMEOPT_LANG_BTN: /* Change interface language */ |
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
|
302 ReadLanguagePack(e->we.dropdown.index); |
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
|
303 CheckForMissingGlyphsInLoadedLanguagePack(); |
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
|
304 UpdateAllStationVirtCoord(); |
8505
1a32b4c9019b
(svn r12080) -Fix: update waypoint signs when changing language
glx <glx@openttd.org>
parents:
8424
diff
changeset
|
305 UpdateAllWaypointSigns(); |
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
|
306 MarkWholeScreenDirty(); |
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
|
307 break; |
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
|
308 |
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
|
309 case GAMEOPT_RESOLUTION_BTN: /* Change resolution */ |
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
|
310 if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0],_resolutions[e->we.dropdown.index][1])) |
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
|
311 SetWindowDirty(w); |
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
|
312 break; |
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
|
313 |
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
|
314 case GAMEOPT_SCREENSHOT_BTN: /* Change screenshot format */ |
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
|
315 SetScreenshotFormat(e->we.dropdown.index); |
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
|
316 SetWindowDirty(w); |
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
|
317 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
|
318 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
319 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
|
320 |
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
|
321 case WE_DESTROY: |
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
|
322 DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
323 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
324 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
325 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
326 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
327 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
328 /** Change the side of the road vehicles drive on (server only). |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
329 * @param tile unused |
6483
f7bd49098924
(svn r9664) -Documentation: Doxygen corrections,errors and omissions
belugas <belugas@openttd.org>
parents:
6472
diff
changeset
|
330 * @param flags operation to perform |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
331 * @param p1 the side of the road; 0 = left side and 1 = right side |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
332 * @param p2 unused |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
333 */ |
6943
fd42cb9816c6
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium <rubidium@openttd.org>
parents:
6798
diff
changeset
|
334 CommandCost CmdSetRoadDriveSide(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
335 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
336 /* Check boundaries and you can only change this if NO vehicles have been built yet, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
337 * except in the intro-menu where of course it's always possible to do so. */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
338 if (p1 > 1 || (_game_mode != GM_MENU && RoadVehiclesAreBuilt())) return CMD_ERROR; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
339 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
340 if (flags & DC_EXEC) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
341 _opt_ptr->road_side = p1; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
342 InvalidateWindow(WC_GAME_OPTIONS,0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
343 } |
6950
d2846442a133
(svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium <rubidium@openttd.org>
parents:
6943
diff
changeset
|
344 return CommandCost(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
345 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
346 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
347 static const Widget _game_options_widgets[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
348 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
349 { WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
350 { WWT_PANEL, RESIZE_NONE, 14, 0, 369, 14, 238, 0x0, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
351 { WWT_FRAME, RESIZE_NONE, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
352 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
353 { WWT_FRAME, RESIZE_NONE, 14, 190, 359, 20, 55, STR_MEASURING_UNITS, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
354 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 34, 45, STR_02E4, STR_MEASURING_UNITS_SELECTION}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
355 { WWT_FRAME, RESIZE_NONE, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
356 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
357 { WWT_FRAME, RESIZE_NONE, 14, 190, 359, 62, 97, STR_02EB_TOWN_NAMES, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
358 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 76, 87, STR_02EC, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
359 { WWT_FRAME, RESIZE_NONE, 14, 10, 179, 104, 139, STR_02F4_AUTOSAVE, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
360 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 118, 129, STR_02F5, STR_02F6_SELECT_INTERVAL_BETWEEN}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
361 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
362 { WWT_FRAME, RESIZE_NONE, 14, 10, 359, 194, 228, STR_02BC_VEHICLE_DESIGN_NAMES, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
363 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 119, 207, 218, STR_02BD, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
364 { WWT_TEXTBTN, RESIZE_NONE, 14, 130, 349, 207, 218, STR_02C0_SAVE_CUSTOM_NAMES, STR_02C2_SAVE_CUSTOMIZED_VEHICLE}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
365 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
366 { WWT_FRAME, RESIZE_NONE, 14, 190, 359, 104, 139, STR_OPTIONS_LANG, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
367 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 118, 129, STR_OPTIONS_LANG_CBO, STR_OPTIONS_LANG_TIP}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
368 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
369 { WWT_FRAME, RESIZE_NONE, 14, 10, 179, 146, 190, STR_OPTIONS_RES, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
370 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 160, 171, STR_OPTIONS_RES_CBO, STR_OPTIONS_RES_TIP}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
371 { WWT_TEXTBTN, RESIZE_NONE, 14, 149, 169, 176, 184, STR_EMPTY, STR_OPTIONS_FULLSCREEN_TIP}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
372 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
373 { WWT_FRAME, RESIZE_NONE, 14, 190, 359, 146, 190, STR_OPTIONS_SCREENSHOT_FORMAT, STR_NULL}, |
8336
4f73dcb0e148
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138 <peter1138@openttd.org>
parents:
8323
diff
changeset
|
374 { WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 160, 171, STR_OPTIONS_SCREENSHOT_FORMAT_CBO, STR_OPTIONS_SCREENSHOT_FORMAT_TIP}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
375 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
376 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
377 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
378 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
379 static const WindowDesc _game_options_desc = { |
7341
549c757023fc
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents:
7177
diff
changeset
|
380 WDP_CENTER, WDP_CENTER, 370, 239, 370, 239, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
381 WC_GAME_OPTIONS, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
382 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
383 _game_options_widgets, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
384 GameOptionsWndProc |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
385 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
386 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
387 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
388 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
|
389 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
390 DeleteWindowById(WC_GAME_OPTIONS, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
391 AllocateWindowDesc(&_game_options_desc); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
392 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
393 |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
394 struct GameSettingData { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
395 int16 min; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
396 int16 max; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
397 int16 step; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
398 StringID str; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
399 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
400 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
401 static const GameSettingData _game_setting_info[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
402 { 0, 7, 1, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
403 { 0, 3, 1, STR_6830_IMMEDIATE}, |
6560
838badc858d3
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents:
6545
diff
changeset
|
404 { 0, 3, 1, STR_NUM_VERY_LOW}, |
8424
17e30bf8f359
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros <maedhros@openttd.org>
parents:
8408
diff
changeset
|
405 { 0, 4, 1, STR_NONE}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
406 {100, 500, 50, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
407 { 2, 4, 1, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
408 { 0, 2, 1, STR_6820_LOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
409 { 0, 4, 1, STR_681B_VERY_SLOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
410 { 0, 2, 1, STR_6820_LOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
411 { 0, 2, 1, STR_6823_NONE}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
412 { 0, 3, 1, STR_6826_X1_5}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
413 { 0, 2, 1, STR_6820_LOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
414 { 0, 3, 1, STR_682A_VERY_FLAT}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
415 { 0, 3, 1, STR_VERY_LOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
416 { 0, 1, 1, STR_682E_STEADY}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
417 { 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
418 { 0, 1, 1, STR_6836_OFF}, |
8424
17e30bf8f359
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros <maedhros@openttd.org>
parents:
8408
diff
changeset
|
419 { 0, 2, 1, STR_PERMISSIVE}, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
420 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
421 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
422 /* |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
423 * A: competitors |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
424 * B: start time in months / 3 |
6560
838badc858d3
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents:
6545
diff
changeset
|
425 * C: town count (2 = high, 0 = very low) |
838badc858d3
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents:
6545
diff
changeset
|
426 * D: industry count (4 = high, 0 = none) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
427 * E: inital loan / 1000 (in GBP) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
428 * F: interest rate |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
429 * G: running costs (0 = low, 2 = high) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
430 * H: construction speed of competitors (0 = very slow, 4 = very fast) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
431 * I: intelligence (0-2) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
432 * J: breakdowns (0 = off, 2 = normal) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
433 * K: subsidy multiplier (0 = 1.5, 3 = 4.0) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
434 * L: construction cost (0-2) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
435 * M: terrain type (0 = very flat, 3 = mountainous) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
436 * N: amount of water (0 = very low, 3 = high) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
437 * O: economy (0 = steady, 1 = fluctuating) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
438 * P: Train reversing (0 = end of line + stations, 1 = end of line) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
439 * Q: disasters |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
440 * R: area restructuring (0 = permissive, 2 = hostile) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
441 */ |
7742
948592b47ff4
(svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium <rubidium@openttd.org>
parents:
7657
diff
changeset
|
442 static const GDType _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
443 A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/ |
6560
838badc858d3
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents:
6545
diff
changeset
|
444 {2, 2, 1, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy |
838badc858d3
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents:
6545
diff
changeset
|
445 {4, 1, 1, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium |
838badc858d3
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents:
6545
diff
changeset
|
446 {7, 0, 0, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
447 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
448 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
449 void SetDifficultyLevel(int mode, GameOptions *gm_opt) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
450 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
451 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
|
452 assert(mode <= 3); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
453 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
454 gm_opt->diff_level = mode; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
455 if (mode != 3) { // not custom |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
456 for (i = 0; i != GAME_DIFFICULTY_NUM; i++) |
7742
948592b47ff4
(svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium <rubidium@openttd.org>
parents:
7657
diff
changeset
|
457 ((GDType*)&gm_opt->diff)[i] = _default_game_diff[mode][i]; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
458 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
459 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
460 |
6378
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
461 /** |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
462 * Checks the difficulty levels read from the configuration and |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
463 * forces them to be correct when invalid. |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
464 */ |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
465 void CheckDifficultyLevels() |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
466 { |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
467 if (_opt_newgame.diff_level != 3) { |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
468 SetDifficultyLevel(_opt_newgame.diff_level, &_opt_newgame); |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
469 } else { |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
470 for (uint i = 0; i < GAME_DIFFICULTY_NUM; i++) { |
7742
948592b47ff4
(svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium <rubidium@openttd.org>
parents:
7657
diff
changeset
|
471 GDType *diff = ((GDType*)&_opt_newgame.diff) + i; |
7922
ff1975ced735
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13 <skidd13@openttd.org>
parents:
7901
diff
changeset
|
472 *diff = Clamp(*diff, _game_setting_info[i].min, _game_setting_info[i].max); |
6378
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
473 *diff -= *diff % _game_setting_info[i].step; |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
474 } |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
475 } |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
476 } |
84b14ef6291a
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium <rubidium@openttd.org>
parents:
6296
diff
changeset
|
477 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
478 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
|
479 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
480 enum { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
481 GAMEDIFF_WND_TOP_OFFSET = 45, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
482 GAMEDIFF_WND_ROWSIZE = 9 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
483 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
484 |
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
|
485 /* Temporary holding place of values in the difficulty window until 'Save' is clicked */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
486 static GameOptions _opt_mod_temp; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
487 // 0x383E = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
488 #define DIFF_INGAME_DISABLED_BUTTONS 0x383E |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
489 |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
490 #define NO_SETTINGS_BUTTON 0xFF |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
491 |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
492 /** Carriage for the game settings window data */ |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
493 struct difficulty_d { |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
494 bool clicked_increase; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
495 uint8 clicked_button; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
496 uint8 timeout; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
497 }; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
498 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(difficulty_d)); |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
499 |
8136
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
500 /* Names of the game difficulty settings window */ |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
501 enum GameDifficultyWidgets { |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
502 GDW_CLOSEBOX = 0, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
503 GDW_CAPTION, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
504 GDW_UPPER_BG, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
505 GDW_LVL_EASY, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
506 GDW_LVL_MEDIUM, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
507 GDW_LVL_HARD, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
508 GDW_LVL_CUSTOM, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
509 GDW_HIGHSCORE, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
510 GDW_SETTING_BG, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
511 GDW_LOWER_BG, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
512 GDW_ACCEPT, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
513 GDW_CANCEL, |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
514 }; |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
515 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
516 static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
517 { |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
518 difficulty_d *diffic_d = &WP(w, difficulty_d); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
519 switch (e->event) { |
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
|
520 case WE_CREATE: |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
521 diffic_d->clicked_increase = false; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
522 diffic_d->clicked_button = NO_SETTINGS_BUTTON; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
523 diffic_d->timeout = 0; |
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
|
524 /* Hide the closebox to make sure that the user aborts or confirms his changes */ |
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
|
525 w->HideWidget(GDW_CLOSEBOX); |
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
|
526 w->widget[GDW_CAPTION].left = 0; |
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
|
527 /* Setup disabled buttons when creating window |
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
|
528 * disable all other difficulty buttons during gameplay except for 'custom' */ |
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
|
529 w->SetWidgetsDisabledState(_game_mode == GM_NORMAL, |
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
|
530 GDW_LVL_EASY, |
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
|
531 GDW_LVL_MEDIUM, |
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
|
532 GDW_LVL_HARD, |
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
|
533 GDW_LVL_CUSTOM, |
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
|
534 WIDGET_LIST_END); |
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
|
535 w->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer |
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
|
536 w->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client) |
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
|
537 w->LowerWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); |
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
|
538 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
|
539 |
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
|
540 case WE_PAINT: { |
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
|
541 DrawWindowWidgets(w); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
542 |
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
|
543 /* XXX - Disabled buttons in normal gameplay or during muliplayer as non server. |
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
|
544 * Bitshifted for each button to see if that bit is set. If it is set, the |
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
|
545 * button is disabled */ |
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
|
546 uint32 disabled = 0; |
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
|
547 if (_networking && !_network_server) { |
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
|
548 disabled = MAX_UVALUE(uint32); // Disable all |
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
|
549 } else if (_game_mode == GM_NORMAL) { |
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
|
550 disabled = DIFF_INGAME_DISABLED_BUTTONS; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
551 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
552 |
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
|
553 int value; |
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
|
554 int y = GAMEDIFF_WND_TOP_OFFSET; |
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
|
555 for (uint i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
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
|
556 const GameSettingData *gsd = &_game_setting_info[i]; |
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
|
557 value = ((GDType*)&_opt_mod_temp.diff)[i]; |
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
|
558 |
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
|
559 DrawArrowButtons(5, y, 3, |
8512 | 560 (diffic_d->clicked_button == i) ? 1 + !!diffic_d->clicked_increase : 0, |
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
|
561 !(HasBit(disabled, i) || gsd->min == value), |
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
|
562 !(HasBit(disabled, i) || gsd->max == value)); |
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
|
563 |
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
|
564 value += _game_setting_info[i].str; |
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
|
565 if (i == 4) value *= 1000; // XXX - handle currency option |
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
|
566 SetDParam(0, value); |
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
|
567 DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, TC_FROMSTRING); |
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
|
568 |
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
|
569 y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit |
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
|
570 } |
6492
e0b6c88a6650
(svn r9673) -Cleanup: remove spaces before tabs and replace non-indenting tabs with spaces.
rubidium <rubidium@openttd.org>
parents:
6486
diff
changeset
|
571 } 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
|
572 |
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
|
573 case WE_CLICK: |
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
|
574 switch (e->we.click.widget) { |
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
|
575 case GDW_SETTING_BG: { /* Difficulty settings widget, decode click */ |
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
|
576 /* Don't allow clients to make any changes */ |
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
|
577 if (_networking && !_network_server) return; |
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
|
578 |
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
|
579 const int x = e->we.click.pt.x - 5; |
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
|
580 if (!IsInsideMM(x, 0, 21)) // Button area |
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
|
581 return; |
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
|
582 |
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
|
583 const int y = e->we.click.pt.y - GAMEDIFF_WND_TOP_OFFSET; |
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
|
584 if (y < 0) return; |
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
|
585 |
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
|
586 /* Get button from Y coord. */ |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
587 const uint8 btn = y / (GAMEDIFF_WND_ROWSIZE + 2); |
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
|
588 if (btn >= GAME_DIFFICULTY_NUM || y % (GAMEDIFF_WND_ROWSIZE + 2) >= 9) |
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
|
589 return; |
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
|
590 |
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
|
591 /* Clicked disabled button? */ |
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
|
592 if (_game_mode == GM_NORMAL && HasBit(DIFF_INGAME_DISABLED_BUTTONS, btn)) |
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
|
593 return; |
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
|
594 |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
595 diffic_d->timeout = 5; |
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
|
596 |
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
|
597 int16 val = ((GDType*)&_opt_mod_temp.diff)[btn]; |
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
|
598 |
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
|
599 const GameSettingData *info = &_game_setting_info[btn]; // get information about the difficulty setting |
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
|
600 if (x >= 10) { |
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
|
601 /* Increase button clicked */ |
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
|
602 val = min(val + info->step, info->max); |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
603 diffic_d->clicked_increase = true; |
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
|
604 } else { |
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
|
605 /* Decrease button clicked */ |
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
|
606 val -= info->step; |
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
|
607 val = max(val, info->min); |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
608 diffic_d->clicked_increase = false; |
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
|
609 } |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
610 diffic_d->clicked_button = btn; |
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
|
611 |
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
|
612 /* save value in temporary variable */ |
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
|
613 ((GDType*)&_opt_mod_temp.diff)[btn] = val; |
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
|
614 w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); |
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
|
615 SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
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
|
616 w->LowerWidget(GDW_LVL_CUSTOM); |
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
|
617 SetWindowDirty(w); |
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
|
618 } break; |
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
|
619 |
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
|
620 case GDW_LVL_EASY: |
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
|
621 case GDW_LVL_MEDIUM: |
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
|
622 case GDW_LVL_HARD: |
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
|
623 case GDW_LVL_CUSTOM: |
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
|
624 /* temporarily change difficulty level */ |
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
|
625 w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); |
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
|
626 SetDifficultyLevel(e->we.click.widget - GDW_LVL_EASY, &_opt_mod_temp); |
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
|
627 w->LowerWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level); |
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
|
628 SetWindowDirty(w); |
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
|
629 break; |
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
|
630 |
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
|
631 case GDW_HIGHSCORE: // Highscore Table |
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
|
632 ShowHighscoreTable(_opt_mod_temp.diff_level, -1); |
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
|
633 break; |
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
|
634 |
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
|
635 case GDW_ACCEPT: { // Save button - save changes |
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
|
636 GDType btn, val; |
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
|
637 for (btn = 0; btn != GAME_DIFFICULTY_NUM; btn++) { |
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
|
638 val = ((GDType*)&_opt_mod_temp.diff)[btn]; |
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
|
639 /* if setting has changed, change it */ |
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
|
640 if (val != ((GDType*)&_opt_ptr->diff)[btn]) |
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
|
641 DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
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
|
642 } |
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
|
643 DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
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
|
644 DeleteWindow(w); |
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
|
645 /* If we are in the editor, we should reload the economy. |
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
|
646 * This way when you load a game, the max loan and interest rate |
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
|
647 * are loaded correctly. */ |
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
|
648 if (_game_mode == GM_EDITOR) StartupEconomy(); |
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
|
649 break; |
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
|
650 } |
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
|
651 |
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
|
652 case GDW_CANCEL: // Cancel button - close window, abandon changes |
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
|
653 DeleteWindow(w); |
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
|
654 break; |
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
|
655 } break; |
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
|
656 |
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
|
657 case WE_MOUSELOOP: /* Handle the visual 'clicking' of the buttons */ |
8408
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
658 if (diffic_d->timeout != 0) { |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
659 diffic_d->timeout--; |
e6f576f6e0e4
(svn r11978) -Codechange: Replace some global variables with window owned ones
skidd13 <skidd13@openttd.org>
parents:
8336
diff
changeset
|
660 if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON; |
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
|
661 SetWindowDirty(w); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
662 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
663 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
664 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
665 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
666 #undef DIFF_INGAME_DISABLED_BUTTONS |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
667 |
8136
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
668 /* Widget definition for the game difficulty settings window */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
669 static const Widget _game_difficulty_widgets[] = { |
8136
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
670 { WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // GDW_CLOSEBOX |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
671 { WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_6800_DIFFICULTY_LEVEL, STR_018C_WINDOW_TITLE_DRAG_THIS}, // GDW_CAPTION |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
672 { WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, // GDW_UPPER_BG |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
673 { WWT_PUSHTXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_6801_EASY, STR_NULL}, // GDW_LVL_EASY |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
674 { WWT_PUSHTXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_6802_MEDIUM, STR_NULL}, // GDW_LVL_MEDIUM |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
675 { WWT_PUSHTXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_6803_HARD, STR_NULL}, // GDW_LVL_HARD |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
676 { WWT_PUSHTXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_6804_CUSTOM, STR_NULL}, // GDW_LVL_CUSTOM |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
677 { WWT_TEXTBTN, RESIZE_NONE, 6, 10, 357, 28, 39, STR_6838_SHOW_HI_SCORE_CHART, STR_NULL}, // GDW_HIGHSCORE |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
678 { WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 262, 0x0, STR_NULL}, // GDW_SETTING_BG |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
679 { WWT_PANEL, RESIZE_NONE, 10, 0, 369, 263, 278, 0x0, STR_NULL}, // GDW_LOWER_BG |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
680 { WWT_PUSHTXTBTN, RESIZE_NONE, 3, 105, 185, 265, 276, STR_OPTIONS_SAVE_CHANGES, STR_NULL}, // GDW_ACCEPT |
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
681 { WWT_PUSHTXTBTN, RESIZE_NONE, 3, 186, 266, 265, 276, STR_012E_CANCEL, STR_NULL}, // GDW_CANCEL |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
682 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
683 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
684 |
8136
e96bc0580891
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13 <skidd13@openttd.org>
parents:
8131
diff
changeset
|
685 /* Window definition for the game difficulty settings window */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
686 static const WindowDesc _game_difficulty_desc = { |
7341
549c757023fc
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents:
7177
diff
changeset
|
687 WDP_CENTER, WDP_CENTER, 370, 279, 370, 279, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
688 WC_GAME_OPTIONS, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
689 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
690 _game_difficulty_widgets, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
691 GameDifficultyWndProc |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
692 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
693 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
694 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
|
695 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
696 DeleteWindowById(WC_GAME_OPTIONS, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
697 /* Copy current settings (ingame or in intro) to temporary holding place |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
698 * change that when setting stuff, copy back on clicking 'OK' */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
699 _opt_mod_temp = *_opt_ptr; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
700 AllocateWindowDesc(&_game_difficulty_desc); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
701 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
702 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
703 static const char *_patches_ui[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
704 "vehicle_speed", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
705 "status_long_date", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
706 "show_finances", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
707 "autoscroll", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
708 "reverse_scroll", |
6730
0b56358a0e3d
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138 <peter1138@openttd.org>
parents:
6674
diff
changeset
|
709 "smooth_scroll", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
710 "errmsg_duration", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
711 "toolbar_pos", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
712 "measure_tooltip", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
713 "window_snap_radius", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
714 "invisible_trees", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
715 "population_in_label", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
716 "link_terraform_toolbar", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
717 "liveries", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
718 "prefer_teamchat", |
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
|
719 /* 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
|
720 * 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
|
721 * Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ |
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
|
722 "scrollwheel_scrolling", |
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
|
723 "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
|
724 #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
|
725 /* We might need to emulate a right mouse button on mac */ |
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
|
726 "right_mouse_btn_emulation", |
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
|
727 #endif |
6543
f9fc925aafad
(svn r9734) -Feature: Add an option to automatically pause when starting a new game.
maedhros <maedhros@openttd.org>
parents:
6492
diff
changeset
|
728 "pause_on_newgame", |
6643
18d58b36b9b3
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium <rubidium@openttd.org>
parents:
6571
diff
changeset
|
729 "advanced_vehicle_list", |
6998
13ea0d5f8acf
(svn r10254) -Feature: loading indicator, which shows in % how full a vehicle is while loading/unloading (TheJosh)
truelight <truelight@openttd.org>
parents:
6980
diff
changeset
|
730 "loading_indicators", |
6980
cb6b3e277df0
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents:
6956
diff
changeset
|
731 "timetable_in_ticks", |
7064
a1b4950870eb
(svn r10329) -Feature [FS#812]: (patch) option to select the "default" rail type when you start a new game or load a game. This is done either static, i.e. rail, electrified rail, monorail and maglev, or dynamic which takes either the first or last available railtype or the railtype that is used most on the map.
rubidium <rubidium@openttd.org>
parents:
6998
diff
changeset
|
732 "default_rail_type", |
7086
787d1ac148e4
(svn r10353) -Fix/Feature [FS#669]: disallow (in the GUI) the building of infrastructure you do not have available vehicles for. This means that the airport building button is disabled till you can actually build aircraft. The game itself will not disallow you to build the infrastructure and this "new" behaviour can be overriden with a patch setting.
rubidium <rubidium@openttd.org>
parents:
7064
diff
changeset
|
733 "always_build_infrastructure", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
734 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
735 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
736 static const char *_patches_construction[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
737 "build_on_slopes", |
7582
e77bd387f449
(svn r11107) -Feature: some tool so one can still build tunnels under rails (and other structures) when the owner of the structure built it on foundations and if you have enough "empty" space ofcourse. One could use the tool for some other construction needs too. Patch by frosch.
rubidium <rubidium@openttd.org>
parents:
7485
diff
changeset
|
738 "autoslope", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
739 "extra_dynamite", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
740 "longbridges", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
741 "signal_side", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
742 "always_small_airport", |
7991
2b690afd01ca
(svn r11547) -Add: signal selection GUI for the ones that really like to use that over CTRL. Patch by BigBB.
rubidium <rubidium@openttd.org>
parents:
7954
diff
changeset
|
743 "enable_signal_gui", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
744 "drag_signals_density", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
745 "oil_refinery_limit", |
5688
4d109cf909b6
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
maedhros <maedhros@openttd.org>
parents:
5668
diff
changeset
|
746 "semaphore_build_before", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
747 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
748 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
749 static const char *_patches_stations[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
750 "join_stations", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
751 "full_load_any", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
752 "improved_load", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
753 "selectgoods", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
754 "new_nonstop", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
755 "nonuniform_stations", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
756 "station_spread", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
757 "serviceathelipad", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
758 "modified_catchment", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
759 "gradual_loading", |
6012
542153c1c803
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium <rubidium@openttd.org>
parents:
5893
diff
changeset
|
760 "road_stop_on_town_road", |
6674
2a72960b1ec6
(svn r9905) -Feature: Allow building new stations adjacent to existing stations by holding down control. Based on a patch by Wolf01.
maedhros <maedhros@openttd.org>
parents:
6643
diff
changeset
|
761 "adjacent_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
|
762 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
763 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
764 static const char *_patches_economy[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
765 "inflation", |
7177
e096437e1120
(svn r10451) -Add: support for "prospecting" raw industries, i.e. you pay an amount of money and then it might (with a given chance) build a raw industry somewhere on the map.
rubidium <rubidium@openttd.org>
parents:
7086
diff
changeset
|
766 "raw_industry_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
|
767 "multiple_industry_per_town", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
768 "same_industry_close", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
769 "bribe", |
7657
65ad965cd225
(svn r11188) -Codechange: rewrite of the town action related code (remove some of the magic).
rubidium <rubidium@openttd.org>
parents:
7641
diff
changeset
|
770 "exclusive_rights", |
65ad965cd225
(svn r11188) -Codechange: rewrite of the town action related code (remove some of the magic).
rubidium <rubidium@openttd.org>
parents:
7641
diff
changeset
|
771 "give_money", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
772 "colored_news_year", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
773 "ending_year", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
774 "smooth_economy", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
775 "allow_shares", |
7641
5e3cd60f89c4
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium <rubidium@openttd.org>
parents:
7582
diff
changeset
|
776 "town_layout", |
5e3cd60f89c4
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium <rubidium@openttd.org>
parents:
7582
diff
changeset
|
777 "mod_road_rebuild", |
6454
b0788d6496a9
(svn r9613) -Feature: Make it possible to have some control over the town growth. The
maedhros <maedhros@openttd.org>
parents:
6420
diff
changeset
|
778 "town_growth_rate", |
b0788d6496a9
(svn r9613) -Feature: Make it possible to have some control over the town growth. The
maedhros <maedhros@openttd.org>
parents:
6420
diff
changeset
|
779 "larger_towns", |
6486
12262d0c44ed
(svn r9667) -Feature: Add the concept of cities. A (configurable) proportion of towns can
maedhros <maedhros@openttd.org>
parents:
6483
diff
changeset
|
780 "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
|
781 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
782 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
783 static const char *_patches_ai[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
784 "ainew_active", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
785 "ai_in_multiplayer", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
786 "ai_disable_veh_train", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
787 "ai_disable_veh_roadveh", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
788 "ai_disable_veh_aircraft", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
789 "ai_disable_veh_ship", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
790 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
791 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
792 static const char *_patches_vehicles[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
793 "realistic_acceleration", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
794 "forbid_90_deg", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
795 "mammoth_trains", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
796 "gotodepot", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
797 "roadveh_queue", |
8551
bfe75aee55ee
(svn r12129) -Change [FS#1759]: simplified patch settings for pathfinders (Yorick)
smatz <smatz@openttd.org>
parents:
8512
diff
changeset
|
798 "pathfinder_for_trains", |
bfe75aee55ee
(svn r12129) -Change [FS#1759]: simplified patch settings for pathfinders (Yorick)
smatz <smatz@openttd.org>
parents:
8512
diff
changeset
|
799 "pathfinder_for_roadvehs", |
bfe75aee55ee
(svn r12129) -Change [FS#1759]: simplified patch settings for pathfinders (Yorick)
smatz <smatz@openttd.org>
parents:
8512
diff
changeset
|
800 "pathfinder_for_ships", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
801 "train_income_warn", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
802 "order_review_system", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
803 "never_expire_vehicles", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
804 "lost_train_warn", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
805 "autorenew", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
806 "autorenew_months", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
807 "autorenew_money", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
808 "max_trains", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
809 "max_roadveh", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
810 "max_aircraft", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
811 "max_ships", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
812 "servint_ispercent", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
813 "servint_trains", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
814 "servint_roadveh", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
815 "servint_ships", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
816 "servint_aircraft", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
817 "no_servicing_if_no_breakdowns", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
818 "wagon_speed_limits", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
819 "disable_elrails", |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
820 "freight_trains", |
6980
cb6b3e277df0
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents:
6956
diff
changeset
|
821 "timetabling", |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
822 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
823 |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
824 struct PatchEntry { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
825 const SettingDesc *setting; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
826 uint index; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
827 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
828 |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
829 struct PatchPage { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
830 const char **names; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
831 PatchEntry *entries; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
832 byte num; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
833 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
834 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
835 /* PatchPage holds the categories, the number of elements in each category |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
836 * and (in NULL) a dynamic array of settings based on the string-representations |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
837 * of the settings. This way there is no worry about indeces, and such */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
838 static PatchPage _patches_page[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
839 {_patches_ui, NULL, lengthof(_patches_ui)}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
840 {_patches_construction, NULL, lengthof(_patches_construction)}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
841 {_patches_vehicles, NULL, lengthof(_patches_vehicles)}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
842 {_patches_stations, NULL, lengthof(_patches_stations)}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
843 {_patches_economy, NULL, lengthof(_patches_economy)}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
844 {_patches_ai, NULL, lengthof(_patches_ai)}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
845 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
846 |
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
|
847 enum PatchesSelectionWidgets { |
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
|
848 PATCHSEL_OPTIONSPANEL = 3, |
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
|
849 PATCHSEL_INTERFACE, |
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
|
850 PATCHSEL_CONSTRUCTION, |
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
|
851 PATCHSEL_VEHICLES, |
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
|
852 PATCHSEL_STATIONS, |
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
|
853 PATCHSEL_ECONOMY, |
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
|
854 PATCHSEL_COMPETITORS |
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
|
855 }; |
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
|
856 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
857 /** The main patches window. Shows a number of categories on top and |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
858 * a selection of patches in that category. |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
859 * Uses WP(w, def_d) macro - data_1, data_2, data_3 */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
860 static void PatchesSelectionWndProc(Window *w, WindowEvent *e) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
861 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
862 static Patches *patches_ptr; |
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
|
863 static int patches_max = 0; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
864 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
865 switch (e->event) { |
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
|
866 case WE_CREATE: { |
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
|
867 static bool first_time = true; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
868 |
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
|
869 patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
870 |
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
|
871 /* Build up the dynamic settings-array only once per OpenTTD session */ |
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
|
872 if (first_time) { |
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
|
873 PatchPage *page; |
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
|
874 for (page = &_patches_page[0]; page != endof(_patches_page); page++) { |
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
|
875 uint i; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
876 |
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
|
877 if (patches_max < page->num) patches_max = page->num; |
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
|
878 |
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
|
879 page->entries = MallocT<PatchEntry>(page->num); |
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
|
880 for (i = 0; i != page->num; i++) { |
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
|
881 uint index; |
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
|
882 const SettingDesc *sd = GetPatchFromName(page->names[i], &index); |
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
|
883 assert(sd != 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
|
884 |
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
|
885 page->entries[i].setting = sd; |
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
|
886 page->entries[i].index = index; |
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
|
887 } |
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
|
888 } |
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
|
889 first_time = false; |
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
|
890 } |
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
|
891 |
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
|
892 /* Resize the window to fit the largest patch tab */ |
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
|
893 ResizeWindowForWidget(w, PATCHSEL_OPTIONSPANEL, 0, patches_max * 11); |
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
|
894 |
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
|
895 w->LowerWidget(4); |
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
|
896 } 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
|
897 |
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
|
898 case WE_PAINT: { |
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
|
899 int x, y; |
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
|
900 const PatchPage *page = &_patches_page[WP(w, def_d).data_1]; |
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
|
901 uint i; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
902 |
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
|
903 /* Set up selected category */ |
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
|
904 DrawWindowWidgets(w); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
905 |
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
|
906 x = 5; |
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
|
907 y = 47; |
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
|
908 for (i = 0; i != page->num; i++) { |
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
|
909 const SettingDesc *sd = page->entries[i].setting; |
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
|
910 const SettingDescBase *sdb = &sd->desc; |
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
|
911 const void *var = GetVariableAddress(patches_ptr, &sd->save); |
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
|
912 bool editable = true; |
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
|
913 bool disabled = false; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
914 |
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
|
915 // We do not allow changes of some items when we are a client in a networkgame |
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
|
916 if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) editable = false; |
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
|
917 if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false; |
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
|
918 if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
919 |
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
|
920 if (sdb->cmd == SDT_BOOLX) { |
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
|
921 static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}}; |
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
|
922 /* Draw checkbox for boolean-value either on/off */ |
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
|
923 bool on = (*(bool*)var); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
924 |
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
|
925 DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE); |
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
|
926 SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
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
|
927 } else { |
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
|
928 int32 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
|
929 |
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
|
930 value = (int32)ReadValue(var, sd->save.conv); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
931 |
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
|
932 /* Draw [<][>] boxes for settings of an integer-type */ |
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
|
933 DrawArrowButtons(x, y, 3, WP(w, def_d).data_2 - (i * 2), (editable && value != sdb->min), (editable && value != sdb->max)); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
934 |
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
|
935 disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED); |
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
|
936 if (disabled) { |
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
|
937 SetDParam(0, STR_CONFIG_PATCHES_DISABLED); |
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
|
938 } else { |
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
|
939 if (sdb->flags & SGF_CURRENCY) { |
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
|
940 SetDParam(0, STR_CONFIG_PATCHES_CURRENCY); |
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
|
941 } else if (sdb->flags & SGF_MULTISTRING) { |
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
|
942 SetDParam(0, sdb->str + value + 1); |
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
|
943 } else { |
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
|
944 SetDParam(0, (sdb->flags & SGF_NOCOMMA) ? STR_CONFIG_PATCHES_INT32 : STR_7024); |
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
|
945 } |
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
|
946 SetDParam(1, 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
|
947 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
948 } |
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
|
949 DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING); |
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
|
950 y += 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
|
951 } |
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
|
952 } 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
|
953 |
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
|
954 case WE_CLICK: |
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
|
955 switch (e->we.click.widget) { |
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
|
956 case PATCHSEL_OPTIONSPANEL: { |
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
|
957 const PatchPage *page = &_patches_page[WP(w, def_d).data_1]; |
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
|
958 const SettingDesc *sd; |
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
|
959 void *var; |
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
|
960 int32 value; |
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
|
961 int x, y; |
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
|
962 byte btn; |
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
|
963 |
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
|
964 y = e->we.click.pt.y - 46 - 1; |
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
|
965 if (y < 0) return; |
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
|
966 |
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
|
967 x = e->we.click.pt.x - 5; |
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
|
968 if (x < 0) return; |
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
|
969 |
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
|
970 btn = y / 11; |
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
|
971 if (y % 11 > 9) return; |
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
|
972 if (btn >= page->num) return; |
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
|
973 |
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
|
974 sd = page->entries[btn].setting; |
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
|
975 |
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
|
976 /* return if action is only active in network, or only settable by server */ |
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
|
977 if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) return; |
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
|
978 if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return; |
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
|
979 if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return; |
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
|
980 |
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
|
981 var = GetVariableAddress(patches_ptr, &sd->save); |
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
|
982 value = (int32)ReadValue(var, sd->save.conv); |
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
|
983 |
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
|
984 /* clicked on the icon on the left side. Either scroller or bool on/off */ |
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
|
985 if (x < 21) { |
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
|
986 const SettingDescBase *sdb = &sd->desc; |
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
|
987 int32 oldvalue = value; |
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
|
988 |
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
|
989 switch (sdb->cmd) { |
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
|
990 case SDT_BOOLX: value ^= 1; break; |
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
|
991 case SDT_NUMX: { |
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
|
992 /* Add a dynamic step-size to the scroller. In a maximum of |
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
|
993 * 50-steps you should be able to get from min to max, |
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
|
994 * unless specified otherwise in the 'interval' variable |
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
|
995 * of the current patch. */ |
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
|
996 uint32 step = (sdb->interval == 0) ? ((sdb->max - sdb->min) / 50) : sdb->interval; |
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
|
997 if (step == 0) step = 1; |
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
|
998 |
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
|
999 // don't allow too fast scrolling |
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
|
1000 if ((w->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) { |
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
|
1001 _left_button_clicked = false; |
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
|
1002 return; |
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
|
1003 } |
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
|
1004 |
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
|
1005 /* Increase or decrease the value and clamp it to extremes */ |
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
|
1006 if (x >= 10) { |
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
|
1007 value += step; |
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
|
1008 if (value > sdb->max) value = sdb->max; |
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
|
1009 } else { |
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
|
1010 value -= step; |
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
|
1011 if (value < sdb->min) value = (sdb->flags & SGF_0ISDISABLED) ? 0 : sdb->min; |
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
|
1012 } |
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
|
1013 |
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
|
1014 /* Set up scroller timeout for numeric values */ |
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
|
1015 if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) { |
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
|
1016 WP(w, def_d).data_2 = btn * 2 + 1 + ((x >= 10) ? 1 : 0); |
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
|
1017 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
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
|
1018 _left_button_clicked = false; |
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
|
1019 } |
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
|
1020 } break; |
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
|
1021 default: NOT_REACHED(); |
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
|
1022 } |
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
|
1023 |
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
|
1024 if (value != oldvalue) { |
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
|
1025 SetPatchValue(page->entries[btn].index, patches_ptr, value); |
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
|
1026 SetWindowDirty(w); |
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
|
1027 } |
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
|
1028 } else { |
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
|
1029 /* only open editbox for types that its sensible for */ |
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
|
1030 if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) { |
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
|
1031 /* Show the correct currency-translated value */ |
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
|
1032 if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate; |
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
|
1033 |
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
|
1034 WP(w, def_d).data_3 = btn; |
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
|
1035 SetDParam(0, value); |
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
|
1036 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, w, CS_NUMERAL); |
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
|
1037 } |
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
|
1038 } |
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
|
1039 } break; |
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
|
1040 |
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
|
1041 case PATCHSEL_INTERFACE: case PATCHSEL_CONSTRUCTION: case PATCHSEL_VEHICLES: |
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
|
1042 case PATCHSEL_STATIONS: case PATCHSEL_ECONOMY: case PATCHSEL_COMPETITORS: |
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
|
1043 w->RaiseWidget(WP(w, def_d).data_1 + PATCHSEL_INTERFACE); |
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
|
1044 WP(w, def_d).data_1 = e->we.click.widget - PATCHSEL_INTERFACE; |
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
|
1045 w->LowerWidget(WP(w, def_d).data_1 + PATCHSEL_INTERFACE); |
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
|
1046 DeleteWindowById(WC_QUERY_STRING, 0); |
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
|
1047 SetWindowDirty(w); |
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
|
1048 break; |
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
|
1049 } |
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
|
1050 break; |
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
|
1051 |
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
|
1052 case WE_TIMEOUT: |
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
|
1053 WP(w, def_d).data_2 = 0; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1054 SetWindowDirty(w); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1055 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1056 |
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
|
1057 case WE_ON_EDIT_TEXT: |
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
|
1058 if (e->we.edittext.str != NULL) { |
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
|
1059 const PatchEntry *pe = &_patches_page[WP(w, def_d).data_1].entries[WP(w,def_d).data_3]; |
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
|
1060 const SettingDesc *sd = pe->setting; |
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
|
1061 int32 value = atoi(e->we.edittext.str); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1062 |
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
|
1063 /* Save the correct currency-translated value */ |
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
|
1064 if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1065 |
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
|
1066 SetPatchValue(pe->index, patches_ptr, value); |
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
|
1067 SetWindowDirty(w); |
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
|
1068 } |
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
|
1069 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
|
1070 |
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
|
1071 case WE_DESTROY: |
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
|
1072 DeleteWindowById(WC_QUERY_STRING, 0); |
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
|
1073 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
|
1074 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1075 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1076 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1077 static const Widget _patches_selection_widgets[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1078 { WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1079 { WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1080 { WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, |
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
|
1081 { WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 50, 0x0, STR_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
|
1082 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1083 { WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1084 { WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1085 { WWT_TEXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_CONFIG_PATCHES_VEHICLES, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1086 { WWT_TEXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_CONFIG_PATCHES_STATIONS, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1087 { WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 28, 39, STR_CONFIG_PATCHES_ECONOMY, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1088 { WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 28, 39, STR_CONFIG_PATCHES_AI, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1089 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1090 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1091 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1092 static const WindowDesc _patches_selection_desc = { |
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
|
1093 WDP_CENTER, WDP_CENTER, 370, 51, 370, 51, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
1094 WC_GAME_OPTIONS, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1095 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1096 _patches_selection_widgets, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1097 PatchesSelectionWndProc, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1098 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1099 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
1100 void ShowPatchesSelection() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1101 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1102 DeleteWindowById(WC_GAME_OPTIONS, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1103 AllocateWindowDesc(&_patches_selection_desc); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1104 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1105 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1106 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1107 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1108 * 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
|
1109 * @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
|
1110 * @param y the y 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
|
1111 * @param ctab the color of the buttons |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1112 * @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
|
1113 * @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
|
1114 * @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
|
1115 */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1116 void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1117 { |
5668
3d6d9bff3dd8
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138 <peter1138@openttd.org>
parents:
5609
diff
changeset
|
1118 int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][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
|
1119 |
5587
c44c070c5032
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents:
5584
diff
changeset
|
1120 DrawFrameRect(x, y + 1, x + 9, y + 9, ctab, (state == 1) ? FR_LOWERED : FR_NONE); |
c44c070c5032
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents:
5584
diff
changeset
|
1121 DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : FR_NONE); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1122 DrawStringCentered(x + 5, y + 1, STR_6819, TC_FROMSTRING); // [<] |
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1123 DrawStringCentered(x + 15, y + 1, STR_681A, TC_FROMSTRING); // [>] |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1124 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1125 /* Grey out the buttons that aren't clickable */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1126 if (!clickable_left) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1127 GfxFillRect(x + 1, y + 1, x + 1 + 8, y + 8, color); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1128 if (!clickable_right) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1129 GfxFillRect(x + 11, y + 1, x + 11 + 8, y + 8, color); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1130 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1131 |
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
|
1132 /** These are not, strickly speaking, widget enums, |
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
|
1133 * since they have been changed as line coordinates. |
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
|
1134 * So, rather, they are more like order of appearance */ |
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
|
1135 enum CustomCurrenciesWidgets { |
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
|
1136 CUSTCURR_EXCHANGERATE = 0, |
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
|
1137 CUSTCURR_SEPARATOR, |
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
|
1138 CUSTCURR_PREFIX, |
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
|
1139 CUSTCURR_SUFFIX, |
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
|
1140 CUSTCURR_TO_EURO, |
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
|
1141 }; |
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
|
1142 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1143 static char _str_separator[2]; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1144 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1145 static void CustCurrencyWndProc(Window *w, WindowEvent *e) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1146 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1147 switch (e->event) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1148 case WE_PAINT: { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1149 int x; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1150 int y = 20; |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1151 int clk = WP(w, def_d).data_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
|
1152 DrawWindowWidgets(w); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1153 |
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
|
1154 /* exchange rate */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1155 DrawArrowButtons(10, y, 3, GB(clk, 0, 2), true, true); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1156 SetDParam(0, 1); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1157 SetDParam(1, 1); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1158 DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, TC_FROMSTRING); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1159 y += 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1160 |
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
|
1161 /* separator */ |
5587
c44c070c5032
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents:
5584
diff
changeset
|
1162 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 2, 2) ? FR_LOWERED : FR_NONE); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1163 x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, TC_FROMSTRING); |
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1164 DoDrawString(_str_separator, x + 4, y + 1, TC_ORANGE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1165 y += 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1166 |
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
|
1167 /* prefix */ |
5587
c44c070c5032
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents:
5584
diff
changeset
|
1168 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 4, 2) ? FR_LOWERED : FR_NONE); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1169 x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, TC_FROMSTRING); |
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1170 DoDrawString(_custom_currency.prefix, x + 4, y + 1, TC_ORANGE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1171 y += 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1172 |
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
|
1173 /* suffix */ |
5587
c44c070c5032
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents:
5584
diff
changeset
|
1174 DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(clk, 6, 2) ? FR_LOWERED : FR_NONE); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1175 x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, TC_FROMSTRING); |
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1176 DoDrawString(_custom_currency.suffix, x + 4, y + 1, TC_ORANGE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1177 y += 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1178 |
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
|
1179 /* switch to euro */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1180 DrawArrowButtons(10, y, 3, GB(clk, 8, 2), true, true); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1181 SetDParam(0, _custom_currency.to_euro); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1182 DrawString(35, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, TC_FROMSTRING); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1183 y += 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1184 |
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
|
1185 /* Preview */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1186 y += 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1187 SetDParam(0, 10000); |
7824
7ae5bda4e8dd
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas <belugas@openttd.org>
parents:
7742
diff
changeset
|
1188 DrawString(35, y + 1, STR_CURRENCY_PREVIEW, TC_FROMSTRING); |
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
|
1189 } 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
|
1190 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1191 case WE_CLICK: { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1192 int line = (e->we.click.pt.y - 20) / 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1193 int len = 0; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1194 int x = e->we.click.pt.x; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1195 StringID str = 0; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1196 CharSetFilter afilter = CS_ALPHANUMERAL; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1197 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1198 switch (line) { |
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
|
1199 case CUSTCURR_EXCHANGERATE: |
7954
38bb7c45688f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13 <skidd13@openttd.org>
parents:
7931
diff
changeset
|
1200 if (IsInsideMM(x, 10, 30)) { // clicked buttons |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1201 if (x < 20) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1202 if (_custom_currency.rate > 1) _custom_currency.rate--; |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1203 WP(w, def_d).data_1 = 1 << (line * 2 + 0); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1204 } else { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1205 if (_custom_currency.rate < 5000) _custom_currency.rate++; |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1206 WP(w, def_d).data_1 = 1 << (line * 2 + 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
|
1207 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1208 } else { // enter text |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1209 SetDParam(0, _custom_currency.rate); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1210 str = STR_CONFIG_PATCHES_INT32; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1211 len = 4; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1212 afilter = CS_NUMERAL; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1213 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1214 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1215 |
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
|
1216 case CUSTCURR_SEPARATOR: |
7954
38bb7c45688f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13 <skidd13@openttd.org>
parents:
7931
diff
changeset
|
1217 if (IsInsideMM(x, 10, 30)) { // clicked button |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1218 WP(w, def_d).data_1 = 1 << (line * 2 + 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
|
1219 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1220 str = BindCString(_str_separator); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1221 len = 1; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1222 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1223 |
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
|
1224 case CUSTCURR_PREFIX: |
7954
38bb7c45688f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13 <skidd13@openttd.org>
parents:
7931
diff
changeset
|
1225 if (IsInsideMM(x, 10, 30)) { // clicked button |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1226 WP(w, def_d).data_1 = 1 << (line * 2 + 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
|
1227 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1228 str = BindCString(_custom_currency.prefix); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1229 len = 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1230 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1231 |
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
|
1232 case CUSTCURR_SUFFIX: |
7954
38bb7c45688f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13 <skidd13@openttd.org>
parents:
7931
diff
changeset
|
1233 if (IsInsideMM(x, 10, 30)) { // clicked button |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1234 WP(w, def_d).data_1 = 1 << (line * 2 + 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
|
1235 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1236 str = BindCString(_custom_currency.suffix); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1237 len = 12; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1238 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1239 |
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
|
1240 case CUSTCURR_TO_EURO: |
7954
38bb7c45688f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13 <skidd13@openttd.org>
parents:
7931
diff
changeset
|
1241 if (IsInsideMM(x, 10, 30)) { // clicked buttons |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1242 if (x < 20) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1243 _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ? |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1244 CF_NOEURO : _custom_currency.to_euro - 1; |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1245 WP(w, def_d).data_1 = 1 << (line * 2 + 0); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1246 } else { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1247 _custom_currency.to_euro = |
7922
ff1975ced735
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13 <skidd13@openttd.org>
parents:
7901
diff
changeset
|
1248 Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR); |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1249 WP(w, def_d).data_1 = 1 << (line * 2 + 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
|
1250 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1251 } else { // enter text |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1252 SetDParam(0, _custom_currency.to_euro); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1253 str = STR_CONFIG_PATCHES_INT32; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1254 len = 4; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1255 afilter = CS_NUMERAL; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1256 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1257 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1258 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1259 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1260 if (len != 0) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1261 WP(w, def_d).data_2 = line; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1262 ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, w, afilter); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1263 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1264 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1265 w->flags4 |= 5 << WF_TIMEOUT_SHL; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1266 SetWindowDirty(w); |
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
|
1267 } 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
|
1268 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1269 case WE_ON_EDIT_TEXT: { |
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
|
1270 const char *b = e->we.edittext.str; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1271 |
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
|
1272 switch (WP(w, def_d).data_2) { |
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
|
1273 case CUSTCURR_EXCHANGERATE: |
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
|
1274 _custom_currency.rate = Clamp(atoi(b), 1, 5000); |
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
|
1275 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
|
1276 |
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
|
1277 case CUSTCURR_SEPARATOR: /* Thousands seperator */ |
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
|
1278 _custom_currency.separator = (b[0] == '\0') ? ' ' : b[0]; |
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
|
1279 ttd_strlcpy(_str_separator, b, lengthof(_str_separator)); |
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
|
1280 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
|
1281 |
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
|
1282 case CUSTCURR_PREFIX: |
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
|
1283 ttd_strlcpy(_custom_currency.prefix, b, lengthof(_custom_currency.prefix)); |
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
|
1284 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
|
1285 |
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
|
1286 case CUSTCURR_SUFFIX: |
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
|
1287 ttd_strlcpy(_custom_currency.suffix, b, lengthof(_custom_currency.suffix)); |
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
|
1288 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
|
1289 |
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
|
1290 case CUSTCURR_TO_EURO: { /* Year to switch to euro */ |
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
|
1291 int val = atoi(b); |
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
|
1292 |
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
|
1293 _custom_currency.to_euro = (val < 2000 ? CF_NOEURO : min(val, MAX_YEAR)); |
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
|
1294 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
|
1295 } |
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
|
1296 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1297 MarkWholeScreenDirty(); |
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
|
1298 } 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
|
1299 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1300 case WE_TIMEOUT: |
8082
4540919ba965
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
1301 WP(w, def_d).data_1 = 0; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1302 SetWindowDirty(w); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1303 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1304 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1305 case WE_DESTROY: |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1306 DeleteWindowById(WC_QUERY_STRING, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1307 MarkWholeScreenDirty(); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1308 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1309 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1310 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1311 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1312 static const Widget _cust_currency_widgets[] = { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1313 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1314 { WWT_CAPTION, RESIZE_NONE, 14, 11, 229, 0, 13, STR_CURRENCY_WINDOW, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1315 { WWT_PANEL, RESIZE_NONE, 14, 0, 229, 14, 119, 0x0, STR_NULL}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1316 { WIDGETS_END}, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1317 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1318 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1319 static const WindowDesc _cust_currency_desc = { |
7341
549c757023fc
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents:
7177
diff
changeset
|
1320 WDP_CENTER, WDP_CENTER, 230, 120, 230, 120, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5688
diff
changeset
|
1321 WC_CUSTOM_CURRENCY, WC_NONE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1322 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1323 _cust_currency_widgets, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1324 CustCurrencyWndProc, |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1325 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1326 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6012
diff
changeset
|
1327 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
|
1328 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1329 _str_separator[0] = _custom_currency.separator; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1330 _str_separator[1] = '\0'; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1331 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1332 DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1333 AllocateWindowDesc(&_cust_currency_desc); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1334 } |