author | richk |
Tue, 17 Jun 2008 13:22:13 +0000 | |
branch | NewGRF_ports |
changeset 10994 | cd9968b6f96b |
parent 10991 | d8811e327d12 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
3 |
/** @file settings_gui.cpp GUI for settings. */ |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
6704
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1806
diff
changeset
|
6 |
#include "openttd.h" |
2291
2b064aa97f91
(svn r2815) Store the currency information in one central place instead of scattering it in several unrelated files
tron
parents:
2231
diff
changeset
|
7 |
#include "currency.h" |
0 | 8 |
#include "gui.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
9 |
#include "window_gui.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
10 |
#include "textbuf_gui.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
11 |
#include "command_func.h" |
10184
fcf5fb2548eb
(svn r12715) [NewGRF_ports] -Sync: with trunk r12351:12644.
richk
parents:
6878
diff
changeset
|
12 |
#include "engine_func.h" |
430 | 13 |
#include "screenshot.h" |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
14 |
#include "newgrf.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5682
diff
changeset
|
15 |
#include "network/network.h" |
835
a22d6bc16a51
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
16 |
#include "town.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2140
diff
changeset
|
17 |
#include "variables.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
18 |
#include "settings_internal.h" |
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
19 |
#include "newgrf_townname.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
20 |
#include "strings_func.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
21 |
#include "functions.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
22 |
#include "window_func.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
23 |
#include "core/alloc_func.hpp" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
24 |
#include "string_func.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
25 |
#include "gfx_func.h" |
6878
7d1ff2f621c7
(svn r12351) [NewGRF_ports] -Sync: with trunk r12051:12350.
richk
parents:
6877
diff
changeset
|
26 |
#include "waypoint.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
27 |
#include "widgets/dropdown_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
28 |
#include "widgets/dropdown_func.h" |
10184
fcf5fb2548eb
(svn r12715) [NewGRF_ports] -Sync: with trunk r12351:12644.
richk
parents:
6878
diff
changeset
|
29 |
#include "station_func.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
30 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
31 |
#include "table/sprites.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
32 |
#include "table/strings.h" |
0 | 33 |
|
3342
0de5e6997611
(svn r4126) - Feature: A new multi-lingual multi-measuring-unit system:
peter1138
parents:
3247
diff
changeset
|
34 |
static const StringID _units_dropdown[] = { |
0de5e6997611
(svn r4126) - Feature: A new multi-lingual multi-measuring-unit system:
peter1138
parents:
3247
diff
changeset
|
35 |
STR_UNITS_IMPERIAL, |
0de5e6997611
(svn r4126) - Feature: A new multi-lingual multi-measuring-unit system:
peter1138
parents:
3247
diff
changeset
|
36 |
STR_UNITS_METRIC, |
0de5e6997611
(svn r4126) - Feature: A new multi-lingual multi-measuring-unit system:
peter1138
parents:
3247
diff
changeset
|
37 |
STR_UNITS_SI, |
0 | 38 |
INVALID_STRING_ID |
39 |
}; |
|
40 |
||
41 |
static const StringID _driveside_dropdown[] = { |
|
42 |
STR_02E9_DRIVE_ON_LEFT, |
|
43 |
STR_02EA_DRIVE_ON_RIGHT, |
|
44 |
INVALID_STRING_ID |
|
45 |
}; |
|
46 |
||
47 |
static const StringID _autosave_dropdown[] = { |
|
48 |
STR_02F7_OFF, |
|
49 |
STR_AUTOSAVE_1_MONTH, |
|
50 |
STR_02F8_EVERY_3_MONTHS, |
|
51 |
STR_02F9_EVERY_6_MONTHS, |
|
52 |
STR_02FA_EVERY_12_MONTHS, |
|
53 |
INVALID_STRING_ID, |
|
54 |
}; |
|
55 |
||
56 |
static const StringID _designnames_dropdown[] = { |
|
57 |
STR_02BE_DEFAULT, |
|
58 |
STR_02BF_CUSTOM, |
|
59 |
INVALID_STRING_ID |
|
60 |
}; |
|
61 |
||
62 |
static StringID *BuildDynamicDropdown(StringID base, int num) |
|
63 |
{ |
|
64 |
static StringID buf[32 + 1]; |
|
65 |
StringID *p = buf; |
|
10242
52b4a9006029
(svn r12774) [NewGRF_ports] -Sync: with trunk r12742:12772.
richk
parents:
10192
diff
changeset
|
66 |
while (--num >= 0) *p++ = base++; |
0 | 67 |
*p = INVALID_STRING_ID; |
68 |
return buf; |
|
69 |
} |
|
70 |
||
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
71 |
int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
72 |
static StringID *_grf_names = NULL; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
73 |
static int _nb_grf_names = 0; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
74 |
|
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
75 |
void InitGRFTownGeneratorNames() |
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
76 |
{ |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
77 |
free(_grf_names); |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
78 |
_grf_names = GetGRFTownNameList(); |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
79 |
_nb_grf_names = 0; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
80 |
for (StringID *s = _grf_names; *s != INVALID_STRING_ID; s++) _nb_grf_names++; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
81 |
} |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
82 |
|
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
83 |
static inline StringID TownName(int town_name) |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
84 |
{ |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
85 |
if (town_name < _nb_orig_names) return STR_TOWNNAME_ORIGINAL_ENGLISH + town_name; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
86 |
town_name -= _nb_orig_names; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
87 |
if (town_name < _nb_grf_names) return _grf_names[town_name]; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
88 |
return STR_UNDEFINED; |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
89 |
} |
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
90 |
|
6573 | 91 |
static int GetCurRes() |
0 | 92 |
{ |
93 |
int i; |
|
2639 | 94 |
|
95 |
for (i = 0; i != _num_resolutions; i++) { |
|
10994
cd9968b6f96b
(svn r13548) [NewGRF_ports] -Sync: with trunk r13412:13544.
richk
parents:
10991
diff
changeset
|
96 |
if (_resolutions[i].width == _screen.width && |
cd9968b6f96b
(svn r13548) [NewGRF_ports] -Sync: with trunk r13412:13544.
richk
parents:
10991
diff
changeset
|
97 |
_resolutions[i].height == _screen.height) { |
0 | 98 |
break; |
2639 | 99 |
} |
100 |
} |
|
0 | 101 |
return i; |
102 |
} |
|
103 |
||
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
104 |
enum GameOptionsWidgets { |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
105 |
GAMEOPT_CURRENCY_BTN = 4, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
106 |
GAMEOPT_DISTANCE_BTN = 6, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
107 |
GAMEOPT_ROADSIDE_BTN = 8, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
108 |
GAMEOPT_TOWNNAME_BTN = 10, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
109 |
GAMEOPT_AUTOSAVE_BTN = 12, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
110 |
GAMEOPT_VEHICLENAME_BTN = 14, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
111 |
GAMEOPT_VEHICLENAME_SAVE, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
112 |
GAMEOPT_LANG_BTN = 17, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
113 |
GAMEOPT_RESOLUTION_BTN = 19, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
114 |
GAMEOPT_FULLSCREEN, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
115 |
GAMEOPT_SCREENSHOT_BTN = 22, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
116 |
}; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
117 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
118 |
/** |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
119 |
* Update/redraw the townnames dropdown |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
120 |
* @param w the window the dropdown belongs to |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
121 |
* @param sel the currently selected townname generator |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
122 |
*/ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
123 |
static void ShowTownnameDropdown(Window *w, int sel) |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
124 |
{ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
125 |
typedef std::map<StringID, int, StringIDCompare> TownList; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
126 |
TownList townnames; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
127 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
128 |
/* Add and sort original townnames generators */ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
129 |
for (int i = 0; i < _nb_orig_names; i++) townnames[STR_TOWNNAME_ORIGINAL_ENGLISH + i] = i; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
130 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
131 |
/* Add and sort newgrf townnames generators */ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
132 |
for (int i = 0; i < _nb_grf_names; i++) townnames[_grf_names[i]] = _nb_orig_names + i; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
133 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
134 |
DropDownList *list = new DropDownList(); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
135 |
for (TownList::iterator it = townnames.begin(); it != townnames.end(); it++) { |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
136 |
list->push_back(new DropDownListStringItem((*it).first, (*it).second, !(_game_mode == GM_MENU || (*it).second == sel))); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
137 |
} |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
138 |
|
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
139 |
ShowDropDownList(w, list, sel, GAMEOPT_TOWNNAME_BTN); |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
140 |
} |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
141 |
|
6573 | 142 |
static void ShowCustCurrency(); |
2817 | 143 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
144 |
struct GameOptionsWindow : Window { |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
145 |
GameSettings *opt; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
146 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
147 |
GameOptionsWindow(const WindowDesc *desc) : Window(desc) |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
148 |
{ |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
149 |
this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
150 |
this->FindWindowPlacementAndResize(desc); |
0 | 151 |
} |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
152 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
153 |
~GameOptionsWindow() |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
154 |
{ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
155 |
DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
156 |
} |
0 | 157 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
158 |
virtual void OnPaint() |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
159 |
{ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
160 |
StringID str = STR_02BE_DEFAULT; |
1794
44f9deff97ed
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1781
diff
changeset
|
161 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
162 |
this->SetWidgetDisabledState(GAMEOPT_VEHICLENAME_SAVE, !(_vehicle_design_names & 1)); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
163 |
if (!this->IsWidgetDisabled(GAMEOPT_VEHICLENAME_SAVE)) str = STR_02BF_CUSTOM; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
164 |
SetDParam(0, str); |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
165 |
SetDParam(1, _currency_specs[this->opt->locale.currency].name); |
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
166 |
SetDParam(2, STR_UNITS_IMPERIAL + this->opt->locale.units); |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
167 |
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + this->opt->vehicle.road_side); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
168 |
SetDParam(4, TownName(this->opt->game_creation.town_name)); |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
169 |
SetDParam(5, _autosave_dropdown[_settings_client.gui.autosave]); |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
170 |
SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
171 |
int i = GetCurRes(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
172 |
SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
173 |
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
174 |
this->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
175 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
176 |
this->DrawWidgets(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
177 |
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen |
0 | 178 |
} |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
179 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
180 |
virtual void OnClick(Point pt, int widget) |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
181 |
{ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
182 |
switch (widget) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
183 |
case GAMEOPT_CURRENCY_BTN: // Setup currencies dropdown |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
184 |
ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->locale.currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
185 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
186 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
187 |
case GAMEOPT_DISTANCE_BTN: // Setup distance unit dropdown |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
188 |
ShowDropDownMenu(this, _units_dropdown, this->opt->locale.units, GAMEOPT_DISTANCE_BTN, 0, 0); |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
189 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
190 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
191 |
case GAMEOPT_ROADSIDE_BTN: { // Setup road-side dropdown |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
192 |
int i = 0; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
193 |
extern bool RoadVehiclesAreBuilt(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
194 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
195 |
/* You can only change the drive side if you are in the menu or ingame with |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
196 |
* no vehicles present. In a networking game only the server can change it */ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
197 |
if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
198 |
i = (-1) ^ (1 << this->opt->vehicle.road_side); // disable the other value |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
199 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
200 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
201 |
ShowDropDownMenu(this, _driveside_dropdown, this->opt->vehicle.road_side, GAMEOPT_ROADSIDE_BTN, i, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
202 |
} break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
203 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
204 |
case GAMEOPT_TOWNNAME_BTN: // Setup townname dropdown |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
205 |
ShowTownnameDropdown(this, this->opt->game_creation.town_name); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
206 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
207 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
208 |
case GAMEOPT_AUTOSAVE_BTN: // Setup autosave dropdown |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
209 |
ShowDropDownMenu(this, _autosave_dropdown, _settings_client.gui.autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0); |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
210 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
211 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
212 |
case GAMEOPT_VEHICLENAME_BTN: // Setup customized vehicle-names dropdown |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
213 |
ShowDropDownMenu(this, _designnames_dropdown, (_vehicle_design_names & 1) ? 1 : 0, GAMEOPT_VEHICLENAME_BTN, (_vehicle_design_names & 2) ? 0 : 2, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
214 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
215 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
216 |
case GAMEOPT_VEHICLENAME_SAVE: // Save customized vehicle-names to disk |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
217 |
break; // not implemented |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
218 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
219 |
case GAMEOPT_LANG_BTN: { // Setup interface language dropdown |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
220 |
typedef std::map<StringID, int, StringIDCompare> LangList; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
221 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
222 |
/* Sort language names */ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
223 |
LangList langs; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
224 |
for (int i = 0; i < _dynlang.num; i++) langs[SPECSTR_LANGUAGE_START + i] = i; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
225 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
226 |
DropDownList *list = new DropDownList(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
227 |
for (LangList::iterator it = langs.begin(); it != langs.end(); it++) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
228 |
list->push_back(new DropDownListStringItem((*it).first, (*it).second, false)); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
229 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
230 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
231 |
ShowDropDownList(this, list, _dynlang.curr, GAMEOPT_LANG_BTN); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
232 |
} break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
233 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
234 |
case GAMEOPT_RESOLUTION_BTN: // Setup resolution dropdown |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
235 |
ShowDropDownMenu(this, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), GAMEOPT_RESOLUTION_BTN, 0, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
236 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
237 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
238 |
case GAMEOPT_FULLSCREEN: // Click fullscreen on/off |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
239 |
/* try to toggle full-screen on/off */ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
240 |
if (!ToggleFullScreen(!_fullscreen)) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
241 |
ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
242 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
243 |
this->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
244 |
this->SetDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
245 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
246 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
247 |
case GAMEOPT_SCREENSHOT_BTN: // Setup screenshot format dropdown |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
248 |
ShowDropDownMenu(this, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, GAMEOPT_SCREENSHOT_BTN, 0, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
249 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
250 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
251 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
252 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
253 |
virtual void OnDropdownSelect(int widget, int index) |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
254 |
{ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
255 |
switch (widget) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
256 |
case GAMEOPT_VEHICLENAME_BTN: // Vehicle design names |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
257 |
if (index == 0) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
258 |
DeleteCustomEngineNames(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
259 |
MarkWholeScreenDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
260 |
} else if (!(_vehicle_design_names & 1)) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
261 |
LoadCustomEngineNames(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
262 |
MarkWholeScreenDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
263 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
264 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
265 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
266 |
case GAMEOPT_CURRENCY_BTN: /* Currency */ |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
267 |
if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency(); |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
268 |
this->opt->locale.currency = index; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
269 |
MarkWholeScreenDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
270 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
271 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
272 |
case GAMEOPT_DISTANCE_BTN: // Measuring units |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
273 |
this->opt->locale.units = index; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
274 |
MarkWholeScreenDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
275 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
276 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
277 |
case GAMEOPT_ROADSIDE_BTN: // Road side |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
278 |
if (this->opt->vehicle.road_side != index) { // only change if setting changed |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
279 |
DoCommandP(0, index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS)); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
280 |
MarkWholeScreenDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
281 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
282 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
283 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
284 |
case GAMEOPT_TOWNNAME_BTN: // Town names |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
285 |
if (_game_mode == GM_MENU) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
286 |
this->opt->game_creation.town_name = index; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
287 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
288 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
289 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
290 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
291 |
case GAMEOPT_AUTOSAVE_BTN: // Autosave options |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
292 |
_settings_client.gui.autosave = index; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
293 |
this->SetDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
294 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
295 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
296 |
case GAMEOPT_LANG_BTN: // Change interface language |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
297 |
ReadLanguagePack(index); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
298 |
CheckForMissingGlyphsInLoadedLanguagePack(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
299 |
UpdateAllStationVirtCoord(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
300 |
UpdateAllWaypointSigns(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
301 |
MarkWholeScreenDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
302 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
303 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
304 |
case GAMEOPT_RESOLUTION_BTN: // Change resolution |
10994
cd9968b6f96b
(svn r13548) [NewGRF_ports] -Sync: with trunk r13412:13544.
richk
parents:
10991
diff
changeset
|
305 |
if (index < _num_resolutions && ChangeResInGame(_resolutions[index].width, _resolutions[index].height)) { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
306 |
this->SetDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
307 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
308 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
309 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
310 |
case GAMEOPT_SCREENSHOT_BTN: // Change screenshot format |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
311 |
SetScreenshotFormat(index); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
312 |
this->SetDirty(); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
313 |
break; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
314 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
315 |
} |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
316 |
}; |
0 | 317 |
|
318 |
static const Widget _game_options_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
319 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
320 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
321 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 369, 14, 238, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
322 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
323 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
324 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 20, 55, STR_MEASURING_UNITS, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
325 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 34, 45, STR_02E4, STR_MEASURING_UNITS_SELECTION}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
326 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
327 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
328 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 62, 97, STR_02EB_TOWN_NAMES, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
329 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 76, 87, STR_02EC, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
330 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 104, 139, STR_02F4_AUTOSAVE, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
331 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 118, 129, STR_02F5, STR_02F6_SELECT_INTERVAL_BETWEEN}, |
0 | 332 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
333 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 359, 194, 228, STR_02BC_VEHICLE_DESIGN_NAMES, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
334 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 119, 207, 218, STR_02BD, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
335 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 130, 349, 207, 218, STR_02C0_SAVE_CUSTOM_NAMES, STR_02C2_SAVE_CUSTOMIZED_VEHICLE}, |
0 | 336 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
337 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 104, 139, STR_OPTIONS_LANG, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
338 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 118, 129, STR_OPTIONS_LANG_CBO, STR_OPTIONS_LANG_TIP}, |
298
b3e83b94be19
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
339 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
340 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 146, 190, STR_OPTIONS_RES, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
341 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 20, 169, 160, 171, STR_OPTIONS_RES_CBO, STR_OPTIONS_RES_TIP}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
342 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 149, 169, 176, 184, STR_EMPTY, STR_OPTIONS_FULLSCREEN_TIP}, |
0 | 343 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
344 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 146, 190, STR_OPTIONS_SCREENSHOT_FORMAT, STR_NULL}, |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
345 |
{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 200, 349, 160, 171, STR_OPTIONS_SCREENSHOT_FORMAT_CBO, STR_OPTIONS_SCREENSHOT_FORMAT_TIP}, |
0 | 346 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
347 |
{ WIDGETS_END}, |
0 | 348 |
}; |
349 |
||
350 |
static const WindowDesc _game_options_desc = { |
|
6743
cabfaa4a0295
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents:
6720
diff
changeset
|
351 |
WDP_CENTER, WDP_CENTER, 370, 239, 370, 239, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
352 |
WC_GAME_OPTIONS, WC_NONE, |
2064
c889fcc76398
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents:
2055
diff
changeset
|
353 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
0 | 354 |
_game_options_widgets, |
355 |
}; |
|
356 |
||
357 |
||
6573 | 358 |
void ShowGameOptions() |
0 | 359 |
{ |
360 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
361 |
new GameOptionsWindow(&_game_options_desc); |
6704
1d7e67bc3f7c
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium
parents:
6622
diff
changeset
|
362 |
} |
1d7e67bc3f7c
(svn r9455) -Fix: the values for diff_custom, diff_level and snow_line in the .cfg were not properly checked.
rubidium
parents:
6622
diff
changeset
|
363 |
|
6573 | 364 |
extern void StartupEconomy(); |
46
c9bdf1d58df6
(svn r47) -Fix StartupEconomy warning in settings_gui.c
darkvater
parents:
42
diff
changeset
|
365 |
|
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
366 |
/* Widget definition for the game difficulty settings window */ |
0 | 367 |
static const Widget _game_difficulty_widgets[] = { |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
368 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // GDW_CLOSEBOX |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
369 |
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_6800_DIFFICULTY_LEVEL, STR_018C_WINDOW_TITLE_DRAG_THIS}, // GDW_CAPTION |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
370 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, // GDW_UPPER_BG |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
371 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_6801_EASY, STR_NULL}, // GDW_LVL_EASY |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
372 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_6802_MEDIUM, STR_NULL}, // GDW_LVL_MEDIUM |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
373 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_6803_HARD, STR_NULL}, // GDW_LVL_HARD |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
374 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_6804_CUSTOM, STR_NULL}, // GDW_LVL_CUSTOM |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
375 |
{ WWT_TEXTBTN, RESIZE_NONE, 6, 10, 357, 28, 39, STR_6838_SHOW_HI_SCORE_CHART, STR_NULL}, // GDW_HIGHSCORE |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
376 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 262, 0x0, STR_NULL}, // GDW_SETTING_BG |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
377 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 263, 278, 0x0, STR_NULL}, // GDW_LOWER_BG |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
378 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 105, 185, 265, 276, STR_OPTIONS_SAVE_CHANGES, STR_NULL}, // GDW_ACCEPT |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
379 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 186, 266, 265, 276, STR_012E_CANCEL, STR_NULL}, // GDW_CANCEL |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
380 |
{ WIDGETS_END}, |
0 | 381 |
}; |
382 |
||
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
383 |
/* Window definition for the game difficulty settings window */ |
0 | 384 |
static const WindowDesc _game_difficulty_desc = { |
6743
cabfaa4a0295
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents:
6720
diff
changeset
|
385 |
WDP_CENTER, WDP_CENTER, 370, 279, 370, 279, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
386 |
WC_GAME_OPTIONS, WC_NONE, |
0 | 387 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
388 |
_game_difficulty_widgets, |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
389 |
}; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
390 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
391 |
void SetDifficultyLevel(int mode, DifficultySettings *gm_opt); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
392 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
393 |
struct GameDifficultyWindow : public Window { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
394 |
private: |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
395 |
static const uint GAME_DIFFICULTY_NUM = 18; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
396 |
bool clicked_increase; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
397 |
uint8 clicked_button; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
398 |
uint8 timeout; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
399 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
400 |
/* Temporary holding place of values in the difficulty window until 'Save' is clicked */ |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
401 |
GameSettings opt_mod_temp; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
402 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
403 |
enum { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
404 |
GAMEDIFF_WND_TOP_OFFSET = 45, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
405 |
GAMEDIFF_WND_ROWSIZE = 9, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
406 |
NO_SETTINGS_BUTTON = 0xFF, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
407 |
}; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
408 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
409 |
/* Names of the game difficulty settings window */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
410 |
enum GameDifficultyWidgets { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
411 |
GDW_CLOSEBOX = 0, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
412 |
GDW_CAPTION, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
413 |
GDW_UPPER_BG, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
414 |
GDW_LVL_EASY, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
415 |
GDW_LVL_MEDIUM, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
416 |
GDW_LVL_HARD, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
417 |
GDW_LVL_CUSTOM, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
418 |
GDW_HIGHSCORE, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
419 |
GDW_SETTING_BG, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
420 |
GDW_LOWER_BG, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
421 |
GDW_ACCEPT, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
422 |
GDW_CANCEL, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
423 |
}; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
424 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
425 |
public: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
426 |
GameDifficultyWindow() : Window(&_game_difficulty_desc) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
427 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
428 |
/* Copy current settings (ingame or in intro) to temporary holding place |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
429 |
* change that when setting stuff, copy back on clicking 'OK' */ |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
430 |
this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
431 |
this->clicked_increase = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
432 |
this->clicked_button = NO_SETTINGS_BUTTON; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
433 |
this->timeout = 0; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
434 |
/* Hide the closebox to make sure that the user aborts or confirms his changes */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
435 |
this->HideWidget(GDW_CLOSEBOX); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
436 |
this->widget[GDW_CAPTION].left = 0; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
437 |
/* Setup disabled buttons when creating window |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
438 |
* disable all other difficulty buttons during gameplay except for 'custom' */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
439 |
this->SetWidgetsDisabledState(_game_mode == GM_NORMAL, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
440 |
GDW_LVL_EASY, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
441 |
GDW_LVL_MEDIUM, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
442 |
GDW_LVL_HARD, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
443 |
GDW_LVL_CUSTOM, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
444 |
WIDGET_LIST_END); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
445 |
this->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
446 |
this->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client) |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
447 |
this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
448 |
this->FindWindowPlacementAndResize(&_game_difficulty_desc); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
449 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
450 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
451 |
virtual void OnPaint() |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
452 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
453 |
this->DrawWidgets(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
454 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
455 |
uint i; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
456 |
const SettingDesc *sd = GetPatchFromName("difficulty.max_no_competitors", &i); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
457 |
int y = GAMEDIFF_WND_TOP_OFFSET; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
458 |
for (i = 0; i < GAME_DIFFICULTY_NUM; i++, sd++) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
459 |
const SettingDescBase *sdb = &sd->desc; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
460 |
int32 value = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
461 |
bool editable = (_game_mode == GM_MENU || (sdb->flags & SGF_NEWGAME_ONLY) == 0); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
462 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
463 |
DrawArrowButtons(5, y, 3, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
464 |
(this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
465 |
editable && sdb->min != value, |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
466 |
editable && sdb->max != value); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
467 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
468 |
value += sdb->str; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
469 |
SetDParam(0, value); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
470 |
DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
471 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
472 |
y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
473 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
474 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
475 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
476 |
virtual void OnClick(Point pt, int widget) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
477 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
478 |
switch (widget) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
479 |
case GDW_SETTING_BG: { /* Difficulty settings widget, decode click */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
480 |
/* Don't allow clients to make any changes */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
481 |
if (_networking && !_network_server) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
482 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
483 |
const int x = pt.x - 5; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
484 |
if (!IsInsideMM(x, 0, 21)) return; // Button area |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
485 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
486 |
const int y = pt.y - GAMEDIFF_WND_TOP_OFFSET; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
487 |
if (y < 0) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
488 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
489 |
/* Get button from Y coord. */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
490 |
const uint8 btn = y / (GAMEDIFF_WND_ROWSIZE + 2); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
491 |
if (btn >= GAME_DIFFICULTY_NUM || y % (GAMEDIFF_WND_ROWSIZE + 2) >= 9) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
492 |
|
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
493 |
uint i; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
494 |
const SettingDesc *sd = GetPatchFromName("difficulty.max_no_competitors", &i) + btn; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
495 |
const SettingDescBase *sdb = &sd->desc; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
496 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
497 |
/* Clicked disabled button? */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
498 |
bool editable = (_game_mode == GM_MENU || (sdb->flags & SGF_NEWGAME_ONLY) == 0); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
499 |
if (!editable) return; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
500 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
501 |
this->timeout = 5; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
502 |
int32 val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
503 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
504 |
if (x >= 10) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
505 |
/* Increase button clicked */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
506 |
val = min(val + sdb->interval, sdb->max); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
507 |
this->clicked_increase = true; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
508 |
} else { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
509 |
/* Decrease button clicked */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
510 |
val -= sdb->interval; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
511 |
val = max(val, sdb->min); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
512 |
this->clicked_increase = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
513 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
514 |
this->clicked_button = btn; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
515 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
516 |
/* save value in temporary variable */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
517 |
WriteValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv, val); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
518 |
this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
519 |
SetDifficultyLevel(3, &this->opt_mod_temp.difficulty); // set difficulty level to custom |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
520 |
this->LowerWidget(GDW_LVL_CUSTOM); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
521 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
522 |
} break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
523 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
524 |
case GDW_LVL_EASY: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
525 |
case GDW_LVL_MEDIUM: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
526 |
case GDW_LVL_HARD: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
527 |
case GDW_LVL_CUSTOM: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
528 |
/* temporarily change difficulty level */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
529 |
this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
530 |
SetDifficultyLevel(widget - GDW_LVL_EASY, &this->opt_mod_temp.difficulty); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
531 |
this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
532 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
533 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
534 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
535 |
case GDW_HIGHSCORE: // Highscore Table |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
536 |
ShowHighscoreTable(this->opt_mod_temp.difficulty.diff_level, -1); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
537 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
538 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
539 |
case GDW_ACCEPT: { // Save button - save changes |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
540 |
GameSettings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
541 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
542 |
uint i; |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
543 |
const SettingDesc *sd = GetPatchFromName("difficulty.max_no_competitors", &i); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
544 |
for (uint btn = 0; btn != GAME_DIFFICULTY_NUM; btn++, sd++) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
545 |
int32 new_val = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
546 |
int32 cur_val = (int32)ReadValue(GetVariableAddress(opt_ptr, &sd->save), sd->save.conv); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
547 |
/* if setting has changed, change it */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
548 |
if (new_val != cur_val) { |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
549 |
DoCommandP(0, i + btn, new_val, NULL, CMD_CHANGE_PATCH_SETTING); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
550 |
} |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
551 |
} |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
552 |
|
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
553 |
GetPatchFromName("difficulty.diff_level", &i); |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
554 |
DoCommandP(0, i, this->opt_mod_temp.difficulty.diff_level, NULL, CMD_CHANGE_PATCH_SETTING); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
555 |
delete this; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
556 |
/* If we are in the editor, we should reload the economy. |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
557 |
* This way when you load a game, the max loan and interest rate |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
558 |
* are loaded correctly. */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
559 |
if (_game_mode == GM_EDITOR) StartupEconomy(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
560 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
561 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
562 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
563 |
case GDW_CANCEL: // Cancel button - close window, abandon changes |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
564 |
delete this; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
565 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
566 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
567 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
568 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
569 |
virtual void OnTick() |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
570 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
571 |
if (this->timeout != 0) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
572 |
this->timeout--; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
573 |
if (this->timeout == 0) this->clicked_button = NO_SETTINGS_BUTTON; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
574 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
575 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
576 |
} |
0 | 577 |
}; |
578 |
||
6573 | 579 |
void ShowGameDifficulty() |
0 | 580 |
{ |
581 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
582 |
new GameDifficultyWindow(); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
583 |
} |
0 | 584 |
|
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
585 |
static const char *_patches_ui[] = { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
586 |
"gui.vehicle_speed", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
587 |
"gui.status_long_date", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
588 |
"gui.show_finances", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
589 |
"gui.autoscroll", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
590 |
"gui.reverse_scroll", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
591 |
"gui.smooth_scroll", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
592 |
"gui.errmsg_duration", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
593 |
"gui.toolbar_pos", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
594 |
"gui.measure_tooltip", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
595 |
"gui.window_snap_radius", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
596 |
"gui.population_in_label", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
597 |
"gui.link_terraform_toolbar", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
598 |
"gui.liveries", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
599 |
"gui.prefer_teamchat", |
6615
96d30d65ed35
(svn r9111) -Feature: [OSX] mighty mice and touchpads can now scroll the map (in all directions)
bjarni
parents:
6585
diff
changeset
|
600 |
/* While the horizontal scrollwheel scrolling is written as general code, only |
96d30d65ed35
(svn r9111) -Feature: [OSX] mighty mice and touchpads can now scroll the map (in all directions)
bjarni
parents:
6585
diff
changeset
|
601 |
* the cocoa (OSX) driver generates input for it. |
6622
2ce7ffa9db00
(svn r9126) -Feature: "Function of scrollwheel" can now be set to off as well
bjarni
parents:
6619
diff
changeset
|
602 |
* Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
603 |
"gui.scrollwheel_scrolling", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
604 |
"gui.scrollwheel_multiplier", |
6868
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6743
diff
changeset
|
605 |
#ifdef __APPLE__ |
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6743
diff
changeset
|
606 |
/* We might need to emulate a right mouse button on mac */ |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
607 |
"gui.right_mouse_btn_emulation", |
6868
7eb395287b3d
(svn r11037) [NewGRF_ports] -Sync: with trunk r10844:11035.
rubidium
parents:
6743
diff
changeset
|
608 |
#endif |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
609 |
"gui.pause_on_newgame", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
610 |
"gui.advanced_vehicle_list", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
611 |
"gui.loading_indicators", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
612 |
"gui.timetable_in_ticks", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
613 |
"gui.default_rail_type", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
614 |
"gui.always_build_infrastructure", |
21 | 615 |
}; |
616 |
||
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
617 |
static const char *_patches_construction[] = { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
618 |
"construction.build_on_slopes", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
619 |
"construction.autoslope", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
620 |
"construction.extra_dynamite", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
621 |
"construction.longbridges", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
622 |
"construction.signal_side", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
623 |
"station.always_small_airport", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
624 |
"gui.enable_signal_gui", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
625 |
"gui.drag_signals_density", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
626 |
"game_creation.oil_refinery_limit", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
627 |
"gui.semaphore_build_before", |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
628 |
}; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
629 |
|
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
630 |
static const char *_patches_stations[] = { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
631 |
"station.join_stations", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
632 |
"order.improved_load", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
633 |
"order.selectgoods", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
634 |
"gui.new_nonstop", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
635 |
"station.nonuniform_stations", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
636 |
"station.station_spread", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
637 |
"order.serviceathelipad", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
638 |
"station.modified_catchment", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
639 |
"order.gradual_loading", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
640 |
"construction.road_stop_on_town_road", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
641 |
"station.adjacent_stations", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
642 |
"economy.station_noise_level", |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
643 |
}; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
644 |
|
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
645 |
static const char *_patches_economy[] = { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
646 |
"economy.inflation", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
647 |
"construction.raw_industry_construction", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
648 |
"economy.multiple_industry_per_town", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
649 |
"economy.same_industry_close", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
650 |
"economy.bribe", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
651 |
"economy.exclusive_rights", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
652 |
"economy.give_money", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
653 |
"gui.colored_news_year", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
654 |
"gui.ending_year", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
655 |
"economy.smooth_economy", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
656 |
"economy.allow_shares", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
657 |
"economy.town_layout", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
658 |
"economy.mod_road_rebuild", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
659 |
"economy.town_growth_rate", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
660 |
"economy.larger_towns", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
661 |
"economy.initial_city_size", |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
662 |
}; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
663 |
|
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
664 |
static const char *_patches_ai[] = { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
665 |
"ai.ainew_active", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
666 |
"ai.ai_in_multiplayer", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
667 |
"ai.ai_disable_veh_train", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
668 |
"ai.ai_disable_veh_roadveh", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
669 |
"ai.ai_disable_veh_aircraft", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
670 |
"ai.ai_disable_veh_ship", |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
671 |
}; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
672 |
|
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
673 |
static const char *_patches_vehicles[] = { |
10731
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
674 |
"vehicle.realistic_acceleration", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
675 |
"pf.forbid_90_deg", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
676 |
"vehicle.mammoth_trains", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
677 |
"order.gotodepot", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
678 |
"pf.roadveh_queue", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
679 |
"pf.pathfinder_for_trains", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
680 |
"pf.pathfinder_for_roadvehs", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
681 |
"pf.pathfinder_for_ships", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
682 |
"gui.train_income_warn", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
683 |
"gui.order_review_system", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
684 |
"vehicle.never_expire_vehicles", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
685 |
"gui.lost_train_warn", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
686 |
"gui.autorenew", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
687 |
"gui.autorenew_months", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
688 |
"gui.autorenew_money", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
689 |
"vehicle.max_trains", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
690 |
"vehicle.max_roadveh", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
691 |
"vehicle.max_aircraft", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
692 |
"vehicle.max_ships", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
693 |
"vehicle.servint_ispercent", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
694 |
"vehicle.servint_trains", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
695 |
"vehicle.servint_roadveh", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
696 |
"vehicle.servint_ships", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
697 |
"vehicle.servint_aircraft", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
698 |
"order.no_servicing_if_no_breakdowns", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
699 |
"vehicle.wagon_speed_limits", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
700 |
"vehicle.disable_elrails", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
701 |
"vehicle.freight_trains", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
702 |
"vehicle.plane_speed", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
703 |
"order.timetabling", |
67db0d431d5e
(svn r13281) [NewGRF_ports] -Sync: with trunk r13145:13280. Includes support for Noise Level on Prop 24 in .grf files.
richk
parents:
10724
diff
changeset
|
704 |
"vehicle.dynamic_engines", |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
705 |
}; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
706 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
707 |
struct PatchEntry { |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
708 |
const SettingDesc *setting; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
709 |
uint index; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
710 |
}; |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
711 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
712 |
struct PatchPage { |
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
713 |
const char **names; |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
714 |
PatchEntry *entries; |
3118
99926945ccb1
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater
parents:
3107
diff
changeset
|
715 |
byte num; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
716 |
}; |
0 | 717 |
|
3247
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
718 |
/* PatchPage holds the categories, the number of elements in each category |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
719 |
* and (in NULL) a dynamic array of settings based on the string-representations |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
720 |
* of the settings. This way there is no worry about indeces, and such */ |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
721 |
static PatchPage _patches_page[] = { |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
722 |
{_patches_ui, NULL, lengthof(_patches_ui)}, |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
723 |
{_patches_construction, NULL, lengthof(_patches_construction)}, |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
724 |
{_patches_vehicles, NULL, lengthof(_patches_vehicles)}, |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
725 |
{_patches_stations, NULL, lengthof(_patches_stations)}, |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
726 |
{_patches_economy, NULL, lengthof(_patches_economy)}, |
4e70e64adbb8
(svn r3930) - [Patches] Change the GUI-patch options from indeces to string representations. Not only makes this the part more humanly readable, but saves us from rewriting the whole index when a patch is added/removed/changed
Darkvater
parents:
3206
diff
changeset
|
727 |
{_patches_ai, NULL, lengthof(_patches_ai)}, |
0 | 728 |
}; |
729 |
||
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
730 |
enum PatchesSelectionWidgets { |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
731 |
PATCHSEL_OPTIONSPANEL = 3, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
732 |
PATCHSEL_INTERFACE, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
733 |
PATCHSEL_CONSTRUCTION, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
734 |
PATCHSEL_VEHICLES, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
735 |
PATCHSEL_STATIONS, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
736 |
PATCHSEL_ECONOMY, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
737 |
PATCHSEL_COMPETITORS |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
738 |
}; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
739 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
740 |
struct PatchesSelectionWindow : Window { |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
741 |
static GameSettings *patches_ptr; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
742 |
static int patches_max; |
3118
99926945ccb1
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater
parents:
3107
diff
changeset
|
743 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
744 |
int page; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
745 |
int entry; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
746 |
int click; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
747 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
748 |
PatchesSelectionWindow(const WindowDesc *desc) : Window(desc) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
749 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
750 |
static bool first_time = true; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
751 |
|
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
752 |
patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
753 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
754 |
/* Build up the dynamic settings-array only once per OpenTTD session */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
755 |
if (first_time) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
756 |
PatchPage *page; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
757 |
for (page = &_patches_page[0]; page != endof(_patches_page); page++) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
758 |
uint i; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
759 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
760 |
if (patches_max < page->num) patches_max = page->num; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
761 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
762 |
page->entries = MallocT<PatchEntry>(page->num); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
763 |
for (i = 0; i != page->num; i++) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
764 |
uint index; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
765 |
const SettingDesc *sd = GetPatchFromName(page->names[i], &index); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
766 |
assert(sd != NULL); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
767 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
768 |
page->entries[i].setting = sd; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
769 |
page->entries[i].index = index; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
770 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
771 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
772 |
first_time = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
773 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
774 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
775 |
/* Resize the window to fit the largest patch tab */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
776 |
ResizeWindowForWidget(this, PATCHSEL_OPTIONSPANEL, 0, patches_max * 11); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
777 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
778 |
/* Recentre the window for the new size */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
779 |
this->top = this->top - (patches_max * 11) / 2; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
780 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
781 |
this->LowerWidget(4); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
782 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
783 |
this->FindWindowPlacementAndResize(desc); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
784 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
785 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
786 |
virtual void OnPaint() |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
787 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
788 |
int x, y; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
789 |
const PatchPage *page = &_patches_page[this->page]; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
790 |
uint i; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
791 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
792 |
/* Set up selected category */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
793 |
this->DrawWidgets(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
794 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
795 |
x = 5; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
796 |
y = 47; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
797 |
for (i = 0; i != page->num; i++) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
798 |
const SettingDesc *sd = page->entries[i].setting; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
799 |
const SettingDescBase *sdb = &sd->desc; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
800 |
const void *var = GetVariableAddress(patches_ptr, &sd->save); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
801 |
bool editable = true; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
802 |
bool disabled = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
803 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
804 |
// We do not allow changes of some items when we are a client in a networkgame |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
805 |
if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) editable = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
806 |
if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
807 |
if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
808 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
809 |
if (sdb->cmd == SDT_BOOLX) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
810 |
static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}}; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
811 |
/* Draw checkbox for boolean-value either on/off */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
812 |
bool on = (*(bool*)var); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
813 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
814 |
DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
815 |
SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
816 |
} else { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
817 |
int32 value; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
818 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
819 |
value = (int32)ReadValue(var, sd->save.conv); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
820 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
821 |
/* Draw [<][>] boxes for settings of an integer-type */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
822 |
DrawArrowButtons(x, y, 3, this->click - (i * 2), (editable && value != sdb->min), (editable && value != sdb->max)); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
823 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
824 |
disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
825 |
if (disabled) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
826 |
SetDParam(0, STR_CONFIG_PATCHES_DISABLED); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
827 |
} else { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
828 |
if (sdb->flags & SGF_CURRENCY) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
829 |
SetDParam(0, STR_CONFIG_PATCHES_CURRENCY); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
830 |
} else if (sdb->flags & SGF_MULTISTRING) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
831 |
SetDParam(0, sdb->str + value + 1); |
0 | 832 |
} else { |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
833 |
SetDParam(0, (sdb->flags & SGF_NOCOMMA) ? STR_CONFIG_PATCHES_INT32 : STR_7024); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
834 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
835 |
SetDParam(1, value); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
836 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
837 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
838 |
DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
839 |
y += 11; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
840 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
841 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
842 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
843 |
virtual void OnClick(Point pt, int widget) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
844 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
845 |
switch (widget) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
846 |
case PATCHSEL_OPTIONSPANEL: { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
847 |
const PatchPage *page = &_patches_page[this->page]; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
848 |
const SettingDesc *sd; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
849 |
void *var; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
850 |
int32 value; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
851 |
int x, y; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
852 |
byte btn; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
853 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
854 |
y = pt.y - 46 - 1; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
855 |
if (y < 0) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
856 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
857 |
x = pt.x - 5; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
858 |
if (x < 0) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
859 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
860 |
btn = y / 11; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
861 |
if (y % 11 > 9) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
862 |
if (btn >= page->num) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
863 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
864 |
sd = page->entries[btn].setting; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
865 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
866 |
/* return if action is only active in network, or only settable by server */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
867 |
if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
868 |
if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
869 |
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
870 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
871 |
var = GetVariableAddress(patches_ptr, &sd->save); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
872 |
value = (int32)ReadValue(var, sd->save.conv); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
873 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
874 |
/* clicked on the icon on the left side. Either scroller or bool on/off */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
875 |
if (x < 21) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
876 |
const SettingDescBase *sdb = &sd->desc; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
877 |
int32 oldvalue = value; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
878 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
879 |
switch (sdb->cmd) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
880 |
case SDT_BOOLX: value ^= 1; break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
881 |
case SDT_NUMX: { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
882 |
/* Add a dynamic step-size to the scroller. In a maximum of |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
883 |
* 50-steps you should be able to get from min to max, |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
884 |
* unless specified otherwise in the 'interval' variable |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
885 |
* of the current patch. */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
886 |
uint32 step = (sdb->interval == 0) ? ((sdb->max - sdb->min) / 50) : sdb->interval; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
887 |
if (step == 0) step = 1; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
888 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
889 |
// don't allow too fast scrolling |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
890 |
if ((this->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
891 |
_left_button_clicked = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
892 |
return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
893 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
894 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
895 |
/* Increase or decrease the value and clamp it to extremes */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
896 |
if (x >= 10) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
897 |
value += step; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
898 |
if (value > sdb->max) value = sdb->max; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
899 |
} else { |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
900 |
value -= step; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
901 |
if (value < sdb->min) value = (sdb->flags & SGF_0ISDISABLED) ? 0 : sdb->min; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
902 |
} |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
903 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
904 |
/* Set up scroller timeout for numeric values */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
905 |
if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
906 |
this->click = btn * 2 + 1 + ((x >= 10) ? 1 : 0); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
907 |
this->flags4 |= 5 << WF_TIMEOUT_SHL; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
908 |
_left_button_clicked = false; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
909 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
910 |
} break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
911 |
default: NOT_REACHED(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
912 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
913 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
914 |
if (value != oldvalue) { |
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
915 |
SetPatchValue(page->entries[btn].index, value); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
916 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
917 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
918 |
} else { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
919 |
/* only open editbox for types that its sensible for */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
920 |
if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
921 |
/* Show the correct currency-translated value */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
922 |
if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
923 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
924 |
this->entry = btn; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
925 |
SetDParam(0, value); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
926 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, this, CS_NUMERAL); |
0 | 927 |
} |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
928 |
} |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
929 |
} break; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
930 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
931 |
case PATCHSEL_INTERFACE: case PATCHSEL_CONSTRUCTION: case PATCHSEL_VEHICLES: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
932 |
case PATCHSEL_STATIONS: case PATCHSEL_ECONOMY: case PATCHSEL_COMPETITORS: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
933 |
this->RaiseWidget(this->page + PATCHSEL_INTERFACE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
934 |
this->page = widget - PATCHSEL_INTERFACE; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
935 |
this->LowerWidget(this->page + PATCHSEL_INTERFACE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
936 |
DeleteWindowById(WC_QUERY_STRING, 0); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
937 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
938 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
939 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
940 |
} |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
941 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
942 |
virtual void OnTimeout() |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
943 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
944 |
this->click = 0; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
945 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
946 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
947 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
948 |
virtual void OnQueryTextFinished(char *str) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
949 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
950 |
if (!StrEmpty(str)) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
951 |
const PatchEntry *pe = &_patches_page[this->page].entries[this->entry]; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
952 |
const SettingDesc *sd = pe->setting; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
953 |
int32 value = atoi(str); |
3118
99926945ccb1
(svn r3722) - [4/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. The last part finishes the transition with the merging of the settings_gui table(s).
Darkvater
parents:
3107
diff
changeset
|
954 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
955 |
/* Save the correct currency-translated value */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
956 |
if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; |
0 | 957 |
|
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
958 |
SetPatchValue(pe->index, value); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
959 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
960 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
961 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
962 |
}; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
963 |
|
10991
d8811e327d12
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
richk
parents:
10731
diff
changeset
|
964 |
GameSettings *PatchesSelectionWindow::patches_ptr = NULL; |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
965 |
int PatchesSelectionWindow::patches_max = 0; |
0 | 966 |
|
967 |
static const Widget _patches_selection_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
968 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
969 |
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
970 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, |
6878
7d1ff2f621c7
(svn r12351) [NewGRF_ports] -Sync: with trunk r12051:12350.
richk
parents:
6877
diff
changeset
|
971 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 50, 0x0, STR_NULL}, |
0 | 972 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
973 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
974 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
975 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_CONFIG_PATCHES_VEHICLES, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
976 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_CONFIG_PATCHES_STATIONS, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
977 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 28, 39, STR_CONFIG_PATCHES_ECONOMY, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
978 |
{ WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 28, 39, STR_CONFIG_PATCHES_AI, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
979 |
{ WIDGETS_END}, |
0 | 980 |
}; |
981 |
||
982 |
static const WindowDesc _patches_selection_desc = { |
|
6878
7d1ff2f621c7
(svn r12351) [NewGRF_ports] -Sync: with trunk r12051:12350.
richk
parents:
6877
diff
changeset
|
983 |
WDP_CENTER, WDP_CENTER, 370, 51, 370, 51, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
984 |
WC_GAME_OPTIONS, WC_NONE, |
0 | 985 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
986 |
_patches_selection_widgets, |
|
987 |
}; |
|
988 |
||
6573 | 989 |
void ShowPatchesSelection() |
0 | 990 |
{ |
991 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
992 |
new PatchesSelectionWindow(&_patches_selection_desc); |
0 | 993 |
} |
478
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
994 |
|
19987403ee5d
(svn r745) Added newgrf GUI (in options menu)\nThe interface currently only displays the installed grf sets, you can't (de)activate them through the gui yet
dominik
parents:
430
diff
changeset
|
995 |
|
4211
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
996 |
/** |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
997 |
* Draw [<][>] boxes. |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
998 |
* @param x the x position to draw |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
999 |
* @param y the y position to draw |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1000 |
* @param ctab the color of the buttons |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1001 |
* @param state 0 = none clicked, 1 = first clicked, 2 = second clicked |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1002 |
* @param clickable_left is the left button clickable? |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1003 |
* @param clickable_right is the right button clickable? |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1004 |
*/ |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1005 |
void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right) |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1006 |
{ |
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5860
diff
changeset
|
1007 |
int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2]; |
3107
a6406bbecd3d
(svn r3710) - Use the general function DrawArrowButtons() instead of doing it manually. The function has two parameters added, colour and an enabled flag.
Darkvater
parents:
2952
diff
changeset
|
1008 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1009 |
DrawFrameRect(x, y + 1, x + 9, y + 9, ctab, (state == 1) ? FR_LOWERED : FR_NONE); |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1010 |
DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : FR_NONE); |
6871
5a9dc001e1ad
(svn r11566) [NewGRF_ports] -Sync: with trunk r11218:r11565.
rubidium
parents:
6870
diff
changeset
|
1011 |
DrawStringCentered(x + 5, y + 1, STR_6819, TC_FROMSTRING); // [<] |
5a9dc001e1ad
(svn r11566) [NewGRF_ports] -Sync: with trunk r11218:r11565.
rubidium
parents:
6870
diff
changeset
|
1012 |
DrawStringCentered(x + 15, y + 1, STR_681A, TC_FROMSTRING); // [>] |
4211
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1013 |
|
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1014 |
/* Grey out the buttons that aren't clickable */ |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1015 |
if (!clickable_left) |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1016 |
GfxFillRect(x + 1, y + 1, x + 1 + 8, y + 8, color); |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1017 |
if (!clickable_right) |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1018 |
GfxFillRect(x + 11, y + 1, x + 11 + 8, y + 8, color); |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1019 |
} |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1020 |
|
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1021 |
/** These are not, strickly speaking, widget enums, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1022 |
* since they have been changed as line coordinates. |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1023 |
* So, rather, they are more like order of appearance */ |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1024 |
enum CustomCurrenciesWidgets { |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1025 |
CUSTCURR_EXCHANGERATE = 0, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1026 |
CUSTCURR_SEPARATOR, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1027 |
CUSTCURR_PREFIX, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1028 |
CUSTCURR_SUFFIX, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1029 |
CUSTCURR_TO_EURO, |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1030 |
}; |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1031 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1032 |
struct CustomCurrencyWindow : Window { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1033 |
char separator[2]; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1034 |
int click; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1035 |
int query_widget; |
2639 | 1036 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1037 |
CustomCurrencyWindow(const WindowDesc *desc) : Window(desc) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1038 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1039 |
this->separator[0] = _custom_currency.separator; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1040 |
this->separator[1] = '\0'; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1041 |
this->FindWindowPlacementAndResize(desc); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1042 |
} |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1043 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1044 |
virtual void OnPaint() |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1045 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1046 |
int x; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1047 |
int y = 20; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1048 |
this->DrawWidgets(); |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1049 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1050 |
/* exchange rate */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1051 |
DrawArrowButtons(10, y, 3, GB(this->click, 0, 2), true, true); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1052 |
SetDParam(0, 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1053 |
SetDParam(1, 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1054 |
DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1055 |
y += 12; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1056 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1057 |
/* separator */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1058 |
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(this->click, 2, 2) ? FR_LOWERED : FR_NONE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1059 |
x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1060 |
DoDrawString(this->separator, x + 4, y + 1, TC_ORANGE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1061 |
y += 12; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1062 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1063 |
/* prefix */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1064 |
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(this->click, 4, 2) ? FR_LOWERED : FR_NONE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1065 |
x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1066 |
DoDrawString(_custom_currency.prefix, x + 4, y + 1, TC_ORANGE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1067 |
y += 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1068 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1069 |
/* suffix */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1070 |
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(this->click, 6, 2) ? FR_LOWERED : FR_NONE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1071 |
x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1072 |
DoDrawString(_custom_currency.suffix, x + 4, y + 1, TC_ORANGE); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1073 |
y += 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1074 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1075 |
/* switch to euro */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1076 |
DrawArrowButtons(10, y, 3, GB(this->click, 8, 2), true, true); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1077 |
SetDParam(0, _custom_currency.to_euro); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1078 |
DrawString(35, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1079 |
y += 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1080 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1081 |
/* Preview */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1082 |
y += 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1083 |
SetDParam(0, 10000); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1084 |
DrawString(35, y + 1, STR_CURRENCY_PREVIEW, TC_FROMSTRING); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1085 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1086 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1087 |
virtual void OnClick(Point pt, int widget) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1088 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1089 |
int line = (pt.y - 20) / 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1090 |
int len = 0; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1091 |
int x = pt.x; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1092 |
StringID str = 0; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1093 |
CharSetFilter afilter = CS_ALPHANUMERAL; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1094 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1095 |
switch (line) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1096 |
case CUSTCURR_EXCHANGERATE: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1097 |
if (IsInsideMM(x, 10, 30)) { // clicked buttons |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1098 |
if (x < 20) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1099 |
if (_custom_currency.rate > 1) _custom_currency.rate--; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1100 |
this->click = 1 << (line * 2 + 0); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1101 |
} else { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1102 |
if (_custom_currency.rate < 5000) _custom_currency.rate++; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1103 |
this->click = 1 << (line * 2 + 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1104 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1105 |
} else { // enter text |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1106 |
SetDParam(0, _custom_currency.rate); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1107 |
str = STR_CONFIG_PATCHES_INT32; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1108 |
len = 4; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1109 |
afilter = CS_NUMERAL; |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1110 |
} |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1111 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1112 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1113 |
case CUSTCURR_SEPARATOR: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1114 |
if (IsInsideMM(x, 10, 30)) { // clicked button |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1115 |
this->click = 1 << (line * 2 + 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1116 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1117 |
str = BindCString(this->separator); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1118 |
len = 1; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1119 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1120 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1121 |
case CUSTCURR_PREFIX: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1122 |
if (IsInsideMM(x, 10, 30)) { // clicked button |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1123 |
this->click = 1 << (line * 2 + 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1124 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1125 |
str = BindCString(_custom_currency.prefix); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1126 |
len = 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1127 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1128 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1129 |
case CUSTCURR_SUFFIX: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1130 |
if (IsInsideMM(x, 10, 30)) { // clicked button |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1131 |
this->click = 1 << (line * 2 + 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1132 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1133 |
str = BindCString(_custom_currency.suffix); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1134 |
len = 12; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1135 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1136 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1137 |
case CUSTCURR_TO_EURO: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1138 |
if (IsInsideMM(x, 10, 30)) { // clicked buttons |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1139 |
if (x < 20) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1140 |
_custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ? |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1141 |
CF_NOEURO : _custom_currency.to_euro - 1; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1142 |
this->click = 1 << (line * 2 + 0); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1143 |
} else { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1144 |
_custom_currency.to_euro = |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1145 |
Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1146 |
this->click = 1 << (line * 2 + 1); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1147 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1148 |
} else { // enter text |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1149 |
SetDParam(0, _custom_currency.to_euro); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1150 |
str = STR_CONFIG_PATCHES_INT32; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1151 |
len = 4; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1152 |
afilter = CS_NUMERAL; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1153 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1154 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1155 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1156 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1157 |
if (len != 0) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1158 |
this->query_widget = line; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1159 |
ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1160 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1161 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1162 |
this->flags4 |= 5 << WF_TIMEOUT_SHL; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1163 |
this->SetDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1164 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1165 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1166 |
virtual void OnQueryTextFinished(char *str) |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1167 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1168 |
if (str == NULL) return; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1169 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1170 |
switch (this->query_widget) { |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1171 |
case CUSTCURR_EXCHANGERATE: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1172 |
_custom_currency.rate = Clamp(atoi(str), 1, 5000); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1173 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1174 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1175 |
case CUSTCURR_SEPARATOR: /* Thousands seperator */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1176 |
_custom_currency.separator = StrEmpty(str) ? ' ' : str[0]; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1177 |
ttd_strlcpy(this->separator, str, lengthof(this->separator)); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1178 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1179 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1180 |
case CUSTCURR_PREFIX: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1181 |
ttd_strlcpy(_custom_currency.prefix, str, lengthof(_custom_currency.prefix)); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1182 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1183 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1184 |
case CUSTCURR_SUFFIX: |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1185 |
ttd_strlcpy(_custom_currency.suffix, str, lengthof(_custom_currency.suffix)); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1186 |
break; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1187 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1188 |
case CUSTCURR_TO_EURO: { /* Year to switch to euro */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1189 |
int val = atoi(str); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1190 |
|
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1191 |
_custom_currency.to_euro = (val < 2000 ? CF_NOEURO : min(val, MAX_YEAR)); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1192 |
break; |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
1193 |
} |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1194 |
} |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1195 |
MarkWholeScreenDirty(); |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1196 |
} |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1197 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1198 |
virtual void OnTimeout() |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1199 |
{ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1200 |
this->click = 0; |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1201 |
this->SetDirty(); |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1202 |
} |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1203 |
}; |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1204 |
|
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1205 |
static const Widget _cust_currency_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
1206 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
1207 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 229, 0, 13, STR_CURRENCY_WINDOW, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4300
diff
changeset
|
1208 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 229, 14, 119, 0x0, STR_NULL}, |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1209 |
{ WIDGETS_END}, |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1210 |
}; |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1211 |
|
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1212 |
static const WindowDesc _cust_currency_desc = { |
6743
cabfaa4a0295
(svn r10766) [NewGRF_ports] -Sync: with trunk r10651-10765
richk
parents:
6720
diff
changeset
|
1213 |
WDP_CENTER, WDP_CENTER, 230, 120, 230, 120, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
1214 |
WC_CUSTOM_CURRENCY, WC_NONE, |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1215 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1216 |
_cust_currency_widgets, |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1217 |
}; |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1218 |
|
6573 | 1219 |
static void ShowCustCurrency() |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1220 |
{ |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1221 |
DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
10242
diff
changeset
|
1222 |
new CustomCurrencyWindow(&_cust_currency_desc); |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1223 |
} |