author | rubidium |
Sun, 25 May 2008 19:17:03 +0000 | |
changeset 10703 | 2c998f3776d1 |
parent 10695 | 95e0154da7a0 |
child 10707 | 81a4013a7680 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10409
diff
changeset
|
3 |
/** @file settings_gui.cpp GUI for settings. */ |
6916
e87d54a598ea
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
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" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
9 |
#include "window_gui.h" |
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
10 |
#include "textbuf_gui.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
11 |
#include "command_func.h" |
9282
2bb9703aeb39
(svn r12490) -Codechange: rename engine.h to engine_func.h and remove unneeded inclusions of engine.h and/or replace them with engine_type.h.
rubidium
parents:
9281
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" |
8704
2857ec554839
(svn r11771) -Codechange: split settings.h into better separated headers.
rubidium
parents:
8687
diff
changeset
|
18 |
#include "settings_internal.h" |
7452
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
19 |
#include "newgrf_townname.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8603
diff
changeset
|
20 |
#include "strings_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
21 |
#include "functions.h" |
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
22 |
#include "window_func.h" |
8709
4187ad809fe7
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8704
diff
changeset
|
23 |
#include "core/alloc_func.hpp" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8709
diff
changeset
|
24 |
#include "string_func.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
25 |
#include "gfx_func.h" |
9001
a74251b49d1d
(svn r12080) -Fix: update waypoint signs when changing language
glx
parents:
8920
diff
changeset
|
26 |
#include "waypoint.h" |
8817
9df6e6b40d12
(svn r11886) -Add: sort the strings in languages dropdown
glx
parents:
8815
diff
changeset
|
27 |
#include "widgets/dropdown_type.h" |
8780
6f3f3ec6c69a
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
8760
diff
changeset
|
28 |
#include "widgets/dropdown_func.h" |
9281
d8cd9ac52a68
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
9144
diff
changeset
|
29 |
#include "station_func.h" |
0 | 30 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
31 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
32 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
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; |
|
10229
fba3f9fa44d7
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
10117
diff
changeset
|
66 |
while (--num >= 0) *p++ = base++; |
0 | 67 |
*p = INVALID_STRING_ID; |
68 |
return buf; |
|
69 |
} |
|
70 |
||
7452
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
71 |
int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
72 |
static StringID *_grf_names = NULL; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
73 |
static int _nb_grf_names = 0; |
7293
e5b1b6ef83db
(svn r10036) -Add: sort the strings in town names dropdown
glx
parents:
7226
diff
changeset
|
74 |
|
8819
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
75 |
void InitGRFTownGeneratorNames() |
7293
e5b1b6ef83db
(svn r10036) -Add: sort the strings in town names dropdown
glx
parents:
7226
diff
changeset
|
76 |
{ |
7452
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
77 |
free(_grf_names); |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
78 |
_grf_names = GetGRFTownNameList(); |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
79 |
_nb_grf_names = 0; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
80 |
for (StringID *s = _grf_names; *s != INVALID_STRING_ID; s++) _nb_grf_names++; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
81 |
} |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
82 |
|
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
83 |
static inline StringID TownName(int town_name) |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
84 |
{ |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
85 |
if (town_name < _nb_orig_names) return STR_TOWNNAME_ORIGINAL_ENGLISH + town_name; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
86 |
town_name -= _nb_orig_names; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
87 |
if (town_name < _nb_grf_names) return _grf_names[town_name]; |
f6fd23727af0
(svn r10211) -Feature: [NewGRF] Add support for action 0F
glx
parents:
7446
diff
changeset
|
88 |
return STR_UNDEFINED; |
7293
e5b1b6ef83db
(svn r10036) -Add: sort the strings in town names dropdown
glx
parents:
7226
diff
changeset
|
89 |
} |
e5b1b6ef83db
(svn r10036) -Add: sort the strings in town names dropdown
glx
parents:
7226
diff
changeset
|
90 |
|
6573 | 91 |
static int GetCurRes() |
0 | 92 |
{ |
93 |
int i; |
|
2639 | 94 |
|
95 |
for (i = 0; i != _num_resolutions; i++) { |
|
306
c44133836566
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
96 |
if (_resolutions[i][0] == _screen.width && |
2639 | 97 |
_resolutions[i][1] == _screen.height) { |
0 | 98 |
break; |
2639 | 99 |
} |
100 |
} |
|
0 | 101 |
return i; |
102 |
} |
|
103 |
||
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
104 |
enum GameOptionsWidgets { |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
105 |
GAMEOPT_CURRENCY_BTN = 4, |
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
106 |
GAMEOPT_DISTANCE_BTN = 6, |
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
107 |
GAMEOPT_ROADSIDE_BTN = 8, |
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
108 |
GAMEOPT_TOWNNAME_BTN = 10, |
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
109 |
GAMEOPT_AUTOSAVE_BTN = 12, |
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
110 |
GAMEOPT_VEHICLENAME_BTN = 14, |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
111 |
GAMEOPT_VEHICLENAME_SAVE, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
112 |
GAMEOPT_LANG_BTN = 17, |
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
113 |
GAMEOPT_RESOLUTION_BTN = 19, |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
114 |
GAMEOPT_FULLSCREEN, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
diff
changeset
|
115 |
GAMEOPT_SCREENSHOT_BTN = 22, |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
116 |
}; |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
117 |
|
8817
9df6e6b40d12
(svn r11886) -Add: sort the strings in languages dropdown
glx
parents:
8815
diff
changeset
|
118 |
/** |
8819
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
119 |
* Update/redraw the townnames dropdown |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
120 |
* @param w the window the dropdown belongs to |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
121 |
* @param sel the currently selected townname generator |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
122 |
*/ |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
123 |
static void ShowTownnameDropdown(Window *w, int sel) |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
124 |
{ |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
125 |
typedef std::map<StringID, int, StringIDCompare> TownList; |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
126 |
TownList townnames; |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
127 |
|
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
128 |
/* Add and sort original townnames generators */ |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
129 |
for (int i = 0; i < _nb_orig_names; i++) townnames[STR_TOWNNAME_ORIGINAL_ENGLISH + i] = i; |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
130 |
|
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
131 |
/* Add and sort newgrf townnames generators */ |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
132 |
for (int i = 0; i < _nb_grf_names; i++) townnames[_grf_names[i]] = _nb_orig_names + i; |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
133 |
|
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
134 |
DropDownList *list = new DropDownList(); |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
135 |
for (TownList::iterator it = townnames.begin(); it != townnames.end(); it++) { |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
136 |
list->push_back(new DropDownListStringItem((*it).first, (*it).second, !(_game_mode == GM_MENU || (*it).second == sel))); |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
137 |
} |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
138 |
|
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
139 |
ShowDropDownList(w, list, sel, GAMEOPT_TOWNNAME_BTN); |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
140 |
} |
86c6ce890d61
(svn r11888) -Codechange: simplify sorting of the strings in town names dropdown
glx
parents:
8817
diff
changeset
|
141 |
|
6573 | 142 |
static void ShowCustCurrency(); |
2817 | 143 |
|
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
144 |
struct GameOptionsWindow : Window { |
10695 | 145 |
GameOptions *opt; |
146 |
||
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
147 |
GameOptionsWindow(const WindowDesc *desc) : Window(desc) |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
148 |
{ |
10695 | 149 |
this->opt = (_game_mode == GM_MENU) ? &_opt_newgame : &_opt; |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
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 |
|
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
153 |
~GameOptionsWindow() |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
154 |
{ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
155 |
DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
156 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
157 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
158 |
virtual void OnPaint() |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
159 |
{ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
160 |
StringID str = STR_02BE_DEFAULT; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
161 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
162 |
this->SetWidgetDisabledState(GAMEOPT_VEHICLENAME_SAVE, !(_vehicle_design_names & 1)); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
163 |
if (!this->IsWidgetDisabled(GAMEOPT_VEHICLENAME_SAVE)) str = STR_02BF_CUSTOM; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
164 |
SetDParam(0, str); |
10695 | 165 |
SetDParam(1, _currency_specs[this->opt->currency].name); |
166 |
SetDParam(2, STR_UNITS_IMPERIAL + this->opt->units); |
|
167 |
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + this->opt->road_side); |
|
168 |
SetDParam(4, TownName(this->opt->town_name)); |
|
169 |
SetDParam(5, _autosave_dropdown[this->opt->autosave]); |
|
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
170 |
SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
171 |
int i = GetCurRes(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
172 |
SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
173 |
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
174 |
this->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
175 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
176 |
this->DrawWidgets(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
177 |
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
178 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
179 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
180 |
virtual void OnClick(Point pt, int widget) |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
181 |
{ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
182 |
switch (widget) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
183 |
case GAMEOPT_CURRENCY_BTN: // Setup currencies dropdown |
10695 | 184 |
ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
185 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
186 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
187 |
case GAMEOPT_DISTANCE_BTN: // Setup distance unit dropdown |
10695 | 188 |
ShowDropDownMenu(this, _units_dropdown, this->opt->units, GAMEOPT_DISTANCE_BTN, 0, 0); |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
189 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
190 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
191 |
case GAMEOPT_ROADSIDE_BTN: { // Setup road-side dropdown |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
192 |
int i = 0; |
10622
210493828852
(svn r13166) -Codechange: CmdSetRoadDriveSide belongs in road_cmd.cpp, not settings_gui.cpp.
rubidium
parents:
10614
diff
changeset
|
193 |
extern bool RoadVehiclesAreBuilt(); |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
194 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
195 |
/* You can only change the drive side if you are in the menu or ingame with |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
196 |
* no vehicles present. In a networking game only the server can change it */ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
197 |
if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) { |
10695 | 198 |
i = (-1) ^ (1 << this->opt->road_side); // disable the other value |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
199 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
200 |
|
10695 | 201 |
ShowDropDownMenu(this, _driveside_dropdown, this->opt->road_side, GAMEOPT_ROADSIDE_BTN, i, 0); |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
202 |
} break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
203 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
204 |
case GAMEOPT_TOWNNAME_BTN: // Setup townname dropdown |
10695 | 205 |
ShowTownnameDropdown(this, this->opt->town_name); |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
206 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
207 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
208 |
case GAMEOPT_AUTOSAVE_BTN: // Setup autosave dropdown |
10695 | 209 |
ShowDropDownMenu(this, _autosave_dropdown, this->opt->autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0); |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
210 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
211 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
212 |
case GAMEOPT_VEHICLENAME_BTN: // Setup customized vehicle-names dropdown |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
213 |
ShowDropDownMenu(this, _designnames_dropdown, (_vehicle_design_names & 1) ? 1 : 0, GAMEOPT_VEHICLENAME_BTN, (_vehicle_design_names & 2) ? 0 : 2, 0); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
214 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
215 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
216 |
case GAMEOPT_VEHICLENAME_SAVE: // Save customized vehicle-names to disk |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
217 |
break; // not implemented |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
218 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
219 |
case GAMEOPT_LANG_BTN: { // Setup interface language dropdown |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
220 |
typedef std::map<StringID, int, StringIDCompare> LangList; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
221 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
222 |
/* Sort language names */ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
223 |
LangList langs; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
224 |
for (int i = 0; i < _dynlang.num; i++) langs[SPECSTR_LANGUAGE_START + i] = i; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
225 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
226 |
DropDownList *list = new DropDownList(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
227 |
for (LangList::iterator it = langs.begin(); it != langs.end(); it++) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
228 |
list->push_back(new DropDownListStringItem((*it).first, (*it).second, false)); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
229 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
230 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
231 |
ShowDropDownList(this, list, _dynlang.curr, GAMEOPT_LANG_BTN); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
232 |
} break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
233 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
234 |
case GAMEOPT_RESOLUTION_BTN: // Setup resolution dropdown |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
235 |
ShowDropDownMenu(this, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), GAMEOPT_RESOLUTION_BTN, 0, 0); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
236 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
237 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
238 |
case GAMEOPT_FULLSCREEN: // Click fullscreen on/off |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
239 |
/* try to toggle full-screen on/off */ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
240 |
if (!ToggleFullScreen(!_fullscreen)) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
241 |
ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
242 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
243 |
this->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
244 |
this->SetDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
245 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
246 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
247 |
case GAMEOPT_SCREENSHOT_BTN: // Setup screenshot format dropdown |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
248 |
ShowDropDownMenu(this, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, GAMEOPT_SCREENSHOT_BTN, 0, 0); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
249 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
250 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
251 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
252 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
253 |
virtual void OnDropdownSelect(int widget, int index) |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
254 |
{ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
255 |
switch (widget) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
256 |
case GAMEOPT_VEHICLENAME_BTN: // Vehicle design names |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
257 |
if (index == 0) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
258 |
DeleteCustomEngineNames(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
259 |
MarkWholeScreenDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
260 |
} else if (!(_vehicle_design_names & 1)) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
261 |
LoadCustomEngineNames(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
262 |
MarkWholeScreenDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
263 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
264 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
265 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
266 |
case GAMEOPT_CURRENCY_BTN: /* Currency */ |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
267 |
if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency(); |
10695 | 268 |
this->opt->currency = index; |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
269 |
MarkWholeScreenDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
270 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
271 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
272 |
case GAMEOPT_DISTANCE_BTN: // Measuring units |
10695 | 273 |
this->opt->units = index; |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
274 |
MarkWholeScreenDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
275 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
276 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
277 |
case GAMEOPT_ROADSIDE_BTN: // Road side |
10695 | 278 |
if (this->opt->road_side != index) { // only change if setting changed |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
279 |
DoCommandP(0, index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS)); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
280 |
MarkWholeScreenDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
281 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
282 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
283 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
284 |
case GAMEOPT_TOWNNAME_BTN: // Town names |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
285 |
if (_game_mode == GM_MENU) { |
10695 | 286 |
this->opt->town_name = index; |
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
287 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
288 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
289 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
290 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
291 |
case GAMEOPT_AUTOSAVE_BTN: // Autosave options |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
292 |
_opt.autosave = _opt_newgame.autosave = index; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
293 |
this->SetDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
294 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
295 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
296 |
case GAMEOPT_LANG_BTN: // Change interface language |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
297 |
ReadLanguagePack(index); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
298 |
CheckForMissingGlyphsInLoadedLanguagePack(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
299 |
UpdateAllStationVirtCoord(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
300 |
UpdateAllWaypointSigns(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
301 |
MarkWholeScreenDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
302 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
303 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
304 |
case GAMEOPT_RESOLUTION_BTN: // Change resolution |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
305 |
if (index < _num_resolutions && ChangeResInGame(_resolutions[index][0], _resolutions[index][1])) { |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
306 |
this->SetDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
307 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
308 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
309 |
|
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
310 |
case GAMEOPT_SCREENSHOT_BTN: // Change screenshot format |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
311 |
SetScreenshotFormat(index); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
312 |
this->SetDirty(); |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
313 |
break; |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
314 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
315 |
} |
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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}, |
8832
e1fcfd2e6d75
(svn r11902) -Codechange: use new dropdown widget for game options window
peter1138
parents:
8819
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 = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7673
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); |
|
10614
04d1add9e12d
(svn r13158) -Codechange: make a class of the GameOptionsWindow.
rubidium
parents:
10595
diff
changeset
|
361 |
new GameOptionsWindow(&_game_options_desc); |
0 | 362 |
} |
363 |
||
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
364 |
struct GameSettingData { |
0 | 365 |
int16 min; |
366 |
int16 max; |
|
367 |
int16 step; |
|
368 |
StringID str; |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
369 |
}; |
0 | 370 |
|
371 |
static const GameSettingData _game_setting_info[] = { |
|
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
372 |
{ 0, 7, 1, STR_NULL}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
373 |
{ 0, 3, 1, STR_6830_IMMEDIATE}, |
7056
b4f146586c97
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas
parents:
7041
diff
changeset
|
374 |
{ 0, 3, 1, STR_NUM_VERY_LOW}, |
8920
04df97185061
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8904
diff
changeset
|
375 |
{ 0, 4, 1, STR_NONE}, |
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
376 |
{100, 500, 50, STR_NULL}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
377 |
{ 2, 4, 1, STR_NULL}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
378 |
{ 0, 2, 1, STR_6820_LOW}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
379 |
{ 0, 4, 1, STR_681B_VERY_SLOW}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
380 |
{ 0, 2, 1, STR_6820_LOW}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
381 |
{ 0, 2, 1, STR_6823_NONE}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
382 |
{ 0, 3, 1, STR_6826_X1_5}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
383 |
{ 0, 2, 1, STR_6820_LOW}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
384 |
{ 0, 3, 1, STR_682A_VERY_FLAT}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
385 |
{ 0, 3, 1, STR_VERY_LOW}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
386 |
{ 0, 1, 1, STR_682E_STEADY}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
387 |
{ 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS}, |
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
388 |
{ 0, 1, 1, STR_6836_OFF}, |
8920
04df97185061
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8904
diff
changeset
|
389 |
{ 0, 2, 1, STR_PERMISSIVE}, |
0 | 390 |
}; |
391 |
||
1385
324d3d06a930
(svn r1889) -Fix: [ 1108637 ] 'Play scenario' now loads game options and difficulty, 'Load game' starts game with user-selected values.
celestar
parents:
1363
diff
changeset
|
392 |
/* |
4549
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
393 |
* A: competitors |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
394 |
* B: start time in months / 3 |
10409
0ad254441c0c
(svn r12951) -Fix(r9762)[FS#1977): Revert the new difficulty settings of town and industries back to their initial values.
belugas
parents:
10382
diff
changeset
|
395 |
* C: town count (3 = high, 0 = very low) |
7056
b4f146586c97
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas
parents:
7041
diff
changeset
|
396 |
* D: industry count (4 = high, 0 = none) |
4549
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
397 |
* E: inital loan / 1000 (in GBP) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
398 |
* F: interest rate |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
399 |
* G: running costs (0 = low, 2 = high) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
400 |
* H: construction speed of competitors (0 = very slow, 4 = very fast) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
401 |
* I: intelligence (0-2) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
402 |
* J: breakdowns (0 = off, 2 = normal) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
403 |
* K: subsidy multiplier (0 = 1.5, 3 = 4.0) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
404 |
* L: construction cost (0-2) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
405 |
* M: terrain type (0 = very flat, 3 = mountainous) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
406 |
* N: amount of water (0 = very low, 3 = high) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
407 |
* O: economy (0 = steady, 1 = fluctuating) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
408 |
* P: Train reversing (0 = end of line + stations, 1 = end of line) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
409 |
* Q: disasters |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
410 |
* R: area restructuring (0 = permissive, 2 = hostile) |
60410aa1aa88
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4488
diff
changeset
|
411 |
*/ |
8238
29844a206bbe
(svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents:
8153
diff
changeset
|
412 |
static const GDType _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* |
1385
324d3d06a930
(svn r1889) -Fix: [ 1108637 ] 'Play scenario' now loads game options and difficulty, 'Load game' starts game with user-selected values.
celestar
parents:
1363
diff
changeset
|
413 |
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/ |
10409
0ad254441c0c
(svn r12951) -Fix(r9762)[FS#1977): Revert the new difficulty settings of town and industries back to their initial values.
belugas
parents:
10382
diff
changeset
|
414 |
{2, 2, 2, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy |
0ad254441c0c
(svn r12951) -Fix(r9762)[FS#1977): Revert the new difficulty settings of town and industries back to their initial values.
belugas
parents:
10382
diff
changeset
|
415 |
{4, 1, 2, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium |
0ad254441c0c
(svn r12951) -Fix(r9762)[FS#1977): Revert the new difficulty settings of town and industries back to their initial values.
belugas
parents:
10382
diff
changeset
|
416 |
{7, 0, 3, 3, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard |
0 | 417 |
}; |
418 |
||
419 |
void SetDifficultyLevel(int mode, GameOptions *gm_opt) |
|
420 |
{ |
|
421 |
int i; |
|
422 |
assert(mode <= 3); |
|
423 |
||
424 |
gm_opt->diff_level = mode; |
|
425 |
if (mode != 3) { // not custom |
|
1500
228f77e88adf
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
426 |
for (i = 0; i != GAME_DIFFICULTY_NUM; i++) |
8238
29844a206bbe
(svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents:
8153
diff
changeset
|
427 |
((GDType*)&gm_opt->diff)[i] = _default_game_diff[mode][i]; |
0 | 428 |
} |
429 |
} |
|
430 |
||
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
|
431 |
/** |
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
|
432 |
* Checks the difficulty levels read from the configuration and |
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
|
433 |
* forces them to be correct when invalid. |
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
|
434 |
*/ |
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
|
435 |
void CheckDifficultyLevels() |
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
|
436 |
{ |
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
|
437 |
if (_opt_newgame.diff_level != 3) { |
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
|
438 |
SetDifficultyLevel(_opt_newgame.diff_level, &_opt_newgame); |
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
|
439 |
} else { |
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
|
440 |
for (uint i = 0; i < GAME_DIFFICULTY_NUM; i++) { |
8238
29844a206bbe
(svn r11279) -Codechange: use a typedeffed type for all magic with GameDifficulty instead on relying ints to always be 32 bits, which they are not.
rubidium
parents:
8153
diff
changeset
|
441 |
GDType *diff = ((GDType*)&_opt_newgame.diff) + i; |
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8397
diff
changeset
|
442 |
*diff = Clamp(*diff, _game_setting_info[i].min, _game_setting_info[i].max); |
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
|
443 |
*diff -= *diff % _game_setting_info[i].step; |
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
|
444 |
} |
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
|
445 |
} |
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
|
446 |
} |
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
|
447 |
|
6573 | 448 |
extern void StartupEconomy(); |
46
c9bdf1d58df6
(svn r47) -Fix StartupEconomy warning in settings_gui.c
darkvater
parents:
42
diff
changeset
|
449 |
|
8632
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
450 |
/* Widget definition for the game difficulty settings window */ |
0 | 451 |
static const Widget _game_difficulty_widgets[] = { |
8632
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
452 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // GDW_CLOSEBOX |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
453 |
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_6800_DIFFICULTY_LEVEL, STR_018C_WINDOW_TITLE_DRAG_THIS}, // GDW_CAPTION |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
454 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, // GDW_UPPER_BG |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
455 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_6801_EASY, STR_NULL}, // GDW_LVL_EASY |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
456 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_6802_MEDIUM, STR_NULL}, // GDW_LVL_MEDIUM |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
457 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_6803_HARD, STR_NULL}, // GDW_LVL_HARD |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
458 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_6804_CUSTOM, STR_NULL}, // GDW_LVL_CUSTOM |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
459 |
{ WWT_TEXTBTN, RESIZE_NONE, 6, 10, 357, 28, 39, STR_6838_SHOW_HI_SCORE_CHART, STR_NULL}, // GDW_HIGHSCORE |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
460 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 262, 0x0, STR_NULL}, // GDW_SETTING_BG |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
461 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 263, 278, 0x0, STR_NULL}, // GDW_LOWER_BG |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
462 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 105, 185, 265, 276, STR_OPTIONS_SAVE_CHANGES, STR_NULL}, // GDW_ACCEPT |
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
463 |
{ 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
|
464 |
{ WIDGETS_END}, |
0 | 465 |
}; |
466 |
||
8632
f407b7a80d2d
(svn r11698) -Change: Make the abort/accept process of the difficulty window a bit less confusing
skidd13
parents:
8627
diff
changeset
|
467 |
/* Window definition for the game difficulty settings window */ |
0 | 468 |
static const WindowDesc _game_difficulty_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7673
diff
changeset
|
469 |
WDP_CENTER, WDP_CENTER, 370, 279, 370, 279, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
470 |
WC_GAME_OPTIONS, WC_NONE, |
0 | 471 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
472 |
_game_difficulty_widgets, |
|
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
473 |
}; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
474 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
475 |
struct GameDifficultyWindow : public Window { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
476 |
private: |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
477 |
bool clicked_increase; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
478 |
uint8 clicked_button; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
479 |
uint8 timeout; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
480 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
481 |
/* Temporary holding place of values in the difficulty window until 'Save' is clicked */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
482 |
GameOptions opt_mod_temp; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
483 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
484 |
enum { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
485 |
GAMEDIFF_WND_TOP_OFFSET = 45, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
486 |
GAMEDIFF_WND_ROWSIZE = 9, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
487 |
// 0x383E = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
488 |
DIFF_INGAME_DISABLED_BUTTONS = 0x383E, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
489 |
NO_SETTINGS_BUTTON = 0xFF, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
490 |
}; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
491 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
492 |
/* Names of the game difficulty settings window */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
493 |
enum GameDifficultyWidgets { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
494 |
GDW_CLOSEBOX = 0, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
495 |
GDW_CAPTION, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
496 |
GDW_UPPER_BG, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
497 |
GDW_LVL_EASY, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
498 |
GDW_LVL_MEDIUM, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
499 |
GDW_LVL_HARD, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
500 |
GDW_LVL_CUSTOM, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
501 |
GDW_HIGHSCORE, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
502 |
GDW_SETTING_BG, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
503 |
GDW_LOWER_BG, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
504 |
GDW_ACCEPT, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
505 |
GDW_CANCEL, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
506 |
}; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
507 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
508 |
public: |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
509 |
GameDifficultyWindow() : Window(&_game_difficulty_desc) |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
510 |
{ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
511 |
/* Copy current settings (ingame or in intro) to temporary holding place |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
512 |
* change that when setting stuff, copy back on clicking 'OK' */ |
10695 | 513 |
this->opt_mod_temp = (_game_mode == GM_MENU) ? _opt_newgame : _opt; |
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
514 |
this->clicked_increase = false; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
515 |
this->clicked_button = NO_SETTINGS_BUTTON; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
516 |
this->timeout = 0; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
517 |
/* Hide the closebox to make sure that the user aborts or confirms his changes */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
518 |
this->HideWidget(GDW_CLOSEBOX); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
519 |
this->widget[GDW_CAPTION].left = 0; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
520 |
/* Setup disabled buttons when creating window |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
521 |
* disable all other difficulty buttons during gameplay except for 'custom' */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
522 |
this->SetWidgetsDisabledState(_game_mode == GM_NORMAL, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
523 |
GDW_LVL_EASY, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
524 |
GDW_LVL_MEDIUM, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
525 |
GDW_LVL_HARD, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
526 |
GDW_LVL_CUSTOM, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
527 |
WIDGET_LIST_END); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
528 |
this->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
529 |
this->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client) |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
530 |
this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.diff_level); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
531 |
this->FindWindowPlacementAndResize(&_game_difficulty_desc); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
532 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
533 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
534 |
virtual void OnPaint() |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
535 |
{ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10568
diff
changeset
|
536 |
this->DrawWidgets(); |
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
537 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
538 |
/* XXX - Disabled buttons in normal gameplay or during muliplayer as non server. |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
539 |
* Bitshifted for each button to see if that bit is set. If it is set, the |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
540 |
* button is disabled */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
541 |
uint32 disabled = 0; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
542 |
if (_networking && !_network_server) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
543 |
disabled = MAX_UVALUE(uint32); // Disable all |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
544 |
} else if (_game_mode == GM_NORMAL) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
545 |
disabled = DIFF_INGAME_DISABLED_BUTTONS; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
546 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
547 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
548 |
int value; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
549 |
int y = GAMEDIFF_WND_TOP_OFFSET; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
550 |
for (uint i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
551 |
const GameSettingData *gsd = &_game_setting_info[i]; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
552 |
value = ((GDType*)&this->opt_mod_temp.diff)[i]; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
553 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
554 |
DrawArrowButtons(5, y, 3, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
555 |
(this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
556 |
!(HasBit(disabled, i) || gsd->min == value), |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
557 |
!(HasBit(disabled, i) || gsd->max == value)); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
558 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
559 |
value += _game_setting_info[i].str; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
560 |
if (i == 4) value *= 1000; // XXX - handle currency option |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
561 |
SetDParam(0, value); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
562 |
DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, TC_FROMSTRING); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
563 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
564 |
y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
565 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
566 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
567 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
568 |
virtual void OnClick(Point pt, int widget) |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
569 |
{ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
570 |
switch (widget) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
571 |
case GDW_SETTING_BG: { /* Difficulty settings widget, decode click */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
572 |
/* Don't allow clients to make any changes */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
573 |
if (_networking && !_network_server) return; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
574 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
575 |
const int x = pt.x - 5; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
576 |
if (!IsInsideMM(x, 0, 21)) return; // Button area |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
577 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
578 |
const int y = pt.y - GAMEDIFF_WND_TOP_OFFSET; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
579 |
if (y < 0) return; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
580 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
581 |
/* Get button from Y coord. */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
582 |
const uint8 btn = y / (GAMEDIFF_WND_ROWSIZE + 2); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
583 |
if (btn >= GAME_DIFFICULTY_NUM || y % (GAMEDIFF_WND_ROWSIZE + 2) >= 9) return; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
584 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
585 |
/* Clicked disabled button? */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
586 |
if (_game_mode == GM_NORMAL && HasBit((int)DIFF_INGAME_DISABLED_BUTTONS, btn)) return; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
587 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
588 |
this->timeout = 5; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
589 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
590 |
int16 val = ((GDType*)&this->opt_mod_temp.diff)[btn]; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
591 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
592 |
const GameSettingData *info = &_game_setting_info[btn]; // get information about the difficulty setting |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
593 |
if (x >= 10) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
594 |
/* Increase button clicked */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
595 |
val = min(val + info->step, info->max); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
596 |
this->clicked_increase = true; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
597 |
} else { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
598 |
/* Decrease button clicked */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
599 |
val -= info->step; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
600 |
val = max(val, info->min); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
601 |
this->clicked_increase = false; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
602 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
603 |
this->clicked_button = btn; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
604 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
605 |
/* save value in temporary variable */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
606 |
((GDType*)&this->opt_mod_temp.diff)[btn] = val; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
607 |
this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.diff_level); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
608 |
SetDifficultyLevel(3, &this->opt_mod_temp); // set difficulty level to custom |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
609 |
this->LowerWidget(GDW_LVL_CUSTOM); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
610 |
this->SetDirty(); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
611 |
} break; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
612 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
613 |
case GDW_LVL_EASY: |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
614 |
case GDW_LVL_MEDIUM: |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
615 |
case GDW_LVL_HARD: |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
616 |
case GDW_LVL_CUSTOM: |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
617 |
/* temporarily change difficulty level */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
618 |
this->RaiseWidget(GDW_LVL_EASY + this->opt_mod_temp.diff_level); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
619 |
SetDifficultyLevel(widget - GDW_LVL_EASY, &this->opt_mod_temp); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
620 |
this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.diff_level); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
621 |
this->SetDirty(); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
622 |
break; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
623 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
624 |
case GDW_HIGHSCORE: // Highscore Table |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
625 |
ShowHighscoreTable(this->opt_mod_temp.diff_level, -1); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
626 |
break; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
627 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
628 |
case GDW_ACCEPT: { // Save button - save changes |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
629 |
GDType btn, val; |
10695 | 630 |
GameOptions *opt_ptr = (_game_mode == GM_MENU) ? &_opt_newgame : &_opt; |
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
631 |
for (btn = 0; btn != GAME_DIFFICULTY_NUM; btn++) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
632 |
val = ((GDType*)&this->opt_mod_temp.diff)[btn]; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
633 |
/* if setting has changed, change it */ |
10695 | 634 |
if (val != ((GDType*)&opt_ptr->diff)[btn]) { |
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
635 |
DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
10695 | 636 |
} |
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
637 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
638 |
DoCommandP(0, UINT_MAX, this->opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
639 |
delete this; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
640 |
/* If we are in the editor, we should reload the economy. |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
641 |
* This way when you load a game, the max loan and interest rate |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
642 |
* are loaded correctly. */ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
643 |
if (_game_mode == GM_EDITOR) StartupEconomy(); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
644 |
break; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
645 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
646 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
647 |
case GDW_CANCEL: // Cancel button - close window, abandon changes |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
648 |
delete this; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
649 |
break; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
650 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
651 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
652 |
|
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
653 |
virtual void OnTick() |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
654 |
{ |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
655 |
if (this->timeout != 0) { |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
656 |
this->timeout--; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
657 |
if (this->timeout == 0) this->clicked_button = NO_SETTINGS_BUTTON; |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
658 |
this->SetDirty(); |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
659 |
} |
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
660 |
} |
0 | 661 |
}; |
662 |
||
6573 | 663 |
void ShowGameDifficulty() |
0 | 664 |
{ |
665 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
10553
cbcc7a6cf46f
(svn r13097) -Codechange: make a class of the GameDifficultyWindow.
glx
parents:
10484
diff
changeset
|
666 |
new GameDifficultyWindow(); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
667 |
} |
0 | 668 |
|
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
|
669 |
static const char *_patches_ui[] = { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
670 |
"gui.vehicle_speed", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
671 |
"gui.status_long_date", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
672 |
"gui.show_finances", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
673 |
"gui.autoscroll", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
674 |
"gui.reverse_scroll", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
675 |
"gui.smooth_scroll", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
676 |
"gui.errmsg_duration", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
677 |
"gui.toolbar_pos", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
678 |
"gui.measure_tooltip", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
679 |
"gui.window_snap_radius", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
680 |
"gui.population_in_label", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
681 |
"gui.link_terraform_toolbar", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
682 |
"gui.liveries", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
683 |
"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
|
684 |
/* 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
|
685 |
* 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
|
686 |
* Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
687 |
"gui.scrollwheel_scrolling", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
688 |
"gui.scrollwheel_multiplier", |
7981
506461241c0e
(svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni
parents:
7837
diff
changeset
|
689 |
#ifdef __APPLE__ |
506461241c0e
(svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni
parents:
7837
diff
changeset
|
690 |
/* We might need to emulate a right mouse button on mac */ |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
691 |
"gui.right_mouse_btn_emulation", |
7981
506461241c0e
(svn r10996) -Feature: [OSX] added more options for right click emulation (controlled from the interface tab in the patch window)
bjarni
parents:
7837
diff
changeset
|
692 |
#endif |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
693 |
"gui.pause_on_newgame", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
694 |
"gui.advanced_vehicle_list", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
695 |
"gui.loading_indicators", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
696 |
"gui.timetable_in_ticks", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
697 |
"gui.default_rail_type", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
698 |
"gui.always_build_infrastructure", |
21 | 699 |
}; |
700 |
||
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
|
701 |
static const char *_patches_construction[] = { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
702 |
"construction.build_on_slopes", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
703 |
"construction.autoslope", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
704 |
"construction.extra_dynamite", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
705 |
"construction.longbridges", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
706 |
"construction.signal_side", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
707 |
"station.always_small_airport", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
708 |
"gui.enable_signal_gui", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
709 |
"gui.drag_signals_density", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
710 |
"game_creation.oil_refinery_limit", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
711 |
"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
|
712 |
}; |
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 |
|
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 |
static const char *_patches_stations[] = { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
715 |
"station.join_stations", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
716 |
"order.improved_load", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
717 |
"order.selectgoods", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
718 |
"gui.new_nonstop", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
719 |
"station.nonuniform_stations", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
720 |
"station.station_spread", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
721 |
"order.serviceathelipad", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
722 |
"station.modified_catchment", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
723 |
"order.gradual_loading", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
724 |
"construction.road_stop_on_town_road", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
725 |
"station.adjacent_stations", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
726 |
"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
|
727 |
}; |
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
|
728 |
|
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
|
729 |
static const char *_patches_economy[] = { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
730 |
"economy.inflation", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
731 |
"construction.raw_industry_construction", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
732 |
"economy.multiple_industry_per_town", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
733 |
"economy.same_industry_close", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
734 |
"economy.bribe", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
735 |
"economy.exclusive_rights", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
736 |
"economy.give_money", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
737 |
"gui.colored_news_year", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
738 |
"gui.ending_year", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
739 |
"economy.smooth_economy", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
740 |
"economy.allow_shares", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
741 |
"economy.town_layout", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
742 |
"economy.mod_road_rebuild", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
743 |
"economy.town_growth_rate", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
744 |
"economy.larger_towns", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
745 |
"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
|
746 |
}; |
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
|
747 |
|
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
|
748 |
static const char *_patches_ai[] = { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
749 |
"ai.ainew_active", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
750 |
"ai.ai_in_multiplayer", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
751 |
"ai.ai_disable_veh_train", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
752 |
"ai.ai_disable_veh_roadveh", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
753 |
"ai.ai_disable_veh_aircraft", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
754 |
"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
|
755 |
}; |
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
|
756 |
|
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
|
757 |
static const char *_patches_vehicles[] = { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
758 |
"vehicle.realistic_acceleration", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
759 |
"pf.forbid_90_deg", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
760 |
"vehicle.mammoth_trains", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
761 |
"order.gotodepot", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
762 |
"pf.roadveh_queue", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
763 |
"pf.pathfinder_for_trains", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
764 |
"pf.pathfinder_for_roadvehs", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
765 |
"pf.pathfinder_for_ships", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
766 |
"gui.train_income_warn", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
767 |
"gui.order_review_system", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
768 |
"vehicle.never_expire_vehicles", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
769 |
"gui.lost_train_warn", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
770 |
"gui.autorenew", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
771 |
"gui.autorenew_months", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
772 |
"gui.autorenew_money", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
773 |
"vehicle.max_trains", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
774 |
"vehicle.max_roadveh", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
775 |
"vehicle.max_aircraft", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
776 |
"vehicle.max_ships", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
777 |
"vehicle.servint_ispercent", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
778 |
"vehicle.servint_trains", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
779 |
"vehicle.servint_roadveh", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
780 |
"vehicle.servint_ships", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
781 |
"vehicle.servint_aircraft", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
782 |
"order.no_servicing_if_no_breakdowns", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
783 |
"vehicle.wagon_speed_limits", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
784 |
"vehicle.disable_elrails", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
785 |
"vehicle.freight_trains", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
786 |
"vehicle.plane_speed", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
787 |
"order.timetabling", |
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
788 |
"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
|
789 |
}; |
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
|
790 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
791 |
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
|
792 |
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
|
793 |
uint index; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
794 |
}; |
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
|
795 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
796 |
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
|
797 |
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
|
798 |
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
|
799 |
byte num; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
800 |
}; |
0 | 801 |
|
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
|
802 |
/* 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
|
803 |
* 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
|
804 |
* 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
|
805 |
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
|
806 |
{_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
|
807 |
{_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
|
808 |
{_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
|
809 |
{_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
|
810 |
{_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
|
811 |
{_patches_ai, NULL, lengthof(_patches_ai)}, |
0 | 812 |
}; |
813 |
||
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
814 |
enum PatchesSelectionWidgets { |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
815 |
PATCHSEL_OPTIONSPANEL = 3, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
816 |
PATCHSEL_INTERFACE, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
817 |
PATCHSEL_CONSTRUCTION, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
818 |
PATCHSEL_VEHICLES, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
819 |
PATCHSEL_STATIONS, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
820 |
PATCHSEL_ECONOMY, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
821 |
PATCHSEL_COMPETITORS |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
822 |
}; |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
823 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
824 |
struct PatchesSelectionWindow : Window { |
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
825 |
static Settings *patches_ptr; |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
826 |
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
|
827 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
828 |
int page; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
829 |
int entry; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
830 |
int click; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
831 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
832 |
PatchesSelectionWindow(const WindowDesc *desc) : Window(desc) |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
833 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
834 |
static bool first_time = true; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
835 |
|
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
836 |
patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
837 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
838 |
/* Build up the dynamic settings-array only once per OpenTTD session */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
839 |
if (first_time) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
840 |
PatchPage *page; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
841 |
for (page = &_patches_page[0]; page != endof(_patches_page); page++) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
842 |
uint i; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
843 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
844 |
if (patches_max < page->num) patches_max = page->num; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
845 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
846 |
page->entries = MallocT<PatchEntry>(page->num); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
847 |
for (i = 0; i != page->num; i++) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
848 |
uint index; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
849 |
const SettingDesc *sd = GetPatchFromName(page->names[i], &index); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
850 |
assert(sd != NULL); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
851 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
852 |
page->entries[i].setting = sd; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
853 |
page->entries[i].index = index; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
854 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
855 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
856 |
first_time = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
857 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
858 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
859 |
/* Resize the window to fit the largest patch tab */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
860 |
ResizeWindowForWidget(this, PATCHSEL_OPTIONSPANEL, 0, patches_max * 11); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
861 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
862 |
/* Recentre the window for the new size */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
863 |
this->top = this->top - (patches_max * 11) / 2; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
864 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
865 |
this->LowerWidget(4); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
866 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
867 |
this->FindWindowPlacementAndResize(desc); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
868 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
869 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
870 |
virtual void OnPaint() |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
871 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
872 |
int x, y; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
873 |
const PatchPage *page = &_patches_page[this->page]; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
874 |
uint i; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
875 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
876 |
/* Set up selected category */ |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10568
diff
changeset
|
877 |
this->DrawWidgets(); |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
878 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
879 |
x = 5; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
880 |
y = 47; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
881 |
for (i = 0; i != page->num; i++) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
882 |
const SettingDesc *sd = page->entries[i].setting; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
883 |
const SettingDescBase *sdb = &sd->desc; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
884 |
const void *var = GetVariableAddress(patches_ptr, &sd->save); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
885 |
bool editable = true; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
886 |
bool disabled = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
887 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
888 |
// We do not allow changes of some items when we are a client in a networkgame |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
889 |
if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) editable = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
890 |
if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
891 |
if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
892 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
893 |
if (sdb->cmd == SDT_BOOLX) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
894 |
static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}}; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
895 |
/* Draw checkbox for boolean-value either on/off */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
896 |
bool on = (*(bool*)var); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
897 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
898 |
DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
899 |
SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
900 |
} else { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
901 |
int32 value; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
902 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
903 |
value = (int32)ReadValue(var, sd->save.conv); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
904 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
905 |
/* Draw [<][>] boxes for settings of an integer-type */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
906 |
DrawArrowButtons(x, y, 3, this->click - (i * 2), (editable && value != sdb->min), (editable && value != sdb->max)); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
907 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
908 |
disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
909 |
if (disabled) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
910 |
SetDParam(0, STR_CONFIG_PATCHES_DISABLED); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
911 |
} else { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
912 |
if (sdb->flags & SGF_CURRENCY) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
913 |
SetDParam(0, STR_CONFIG_PATCHES_CURRENCY); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
914 |
} else if (sdb->flags & SGF_MULTISTRING) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
915 |
SetDParam(0, sdb->str + value + 1); |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
916 |
} else { |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
917 |
SetDParam(0, (sdb->flags & SGF_NOCOMMA) ? STR_CONFIG_PATCHES_INT32 : STR_7024); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
918 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
919 |
SetDParam(1, value); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
920 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
921 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
922 |
DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
923 |
y += 11; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
924 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
925 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
926 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
927 |
virtual void OnClick(Point pt, int widget) |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
928 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
929 |
switch (widget) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
930 |
case PATCHSEL_OPTIONSPANEL: { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
931 |
const PatchPage *page = &_patches_page[this->page]; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
932 |
const SettingDesc *sd; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
933 |
void *var; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
934 |
int32 value; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
935 |
int x, y; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
936 |
byte btn; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
937 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
938 |
y = pt.y - 46 - 1; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
939 |
if (y < 0) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
940 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
941 |
x = pt.x - 5; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
942 |
if (x < 0) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
943 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
944 |
btn = y / 11; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
945 |
if (y % 11 > 9) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
946 |
if (btn >= page->num) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
947 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
948 |
sd = page->entries[btn].setting; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
949 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
950 |
/* return if action is only active in network, or only settable by server */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
951 |
if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
952 |
if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
953 |
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
954 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
955 |
var = GetVariableAddress(patches_ptr, &sd->save); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
956 |
value = (int32)ReadValue(var, sd->save.conv); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
957 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
958 |
/* clicked on the icon on the left side. Either scroller or bool on/off */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
959 |
if (x < 21) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
960 |
const SettingDescBase *sdb = &sd->desc; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
961 |
int32 oldvalue = value; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
962 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
963 |
switch (sdb->cmd) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
964 |
case SDT_BOOLX: value ^= 1; break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
965 |
case SDT_NUMX: { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
966 |
/* Add a dynamic step-size to the scroller. In a maximum of |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
967 |
* 50-steps you should be able to get from min to max, |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
968 |
* unless specified otherwise in the 'interval' variable |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
969 |
* of the current patch. */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
970 |
uint32 step = (sdb->interval == 0) ? ((sdb->max - sdb->min) / 50) : sdb->interval; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
971 |
if (step == 0) step = 1; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
972 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
973 |
// don't allow too fast scrolling |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
974 |
if ((this->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
975 |
_left_button_clicked = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
976 |
return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
977 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
978 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
979 |
/* Increase or decrease the value and clamp it to extremes */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
980 |
if (x >= 10) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
981 |
value += step; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
982 |
if (value > sdb->max) value = sdb->max; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
983 |
} else { |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
984 |
value -= step; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
985 |
if (value < sdb->min) value = (sdb->flags & SGF_0ISDISABLED) ? 0 : sdb->min; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
986 |
} |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
987 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
988 |
/* Set up scroller timeout for numeric values */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
989 |
if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
990 |
this->click = btn * 2 + 1 + ((x >= 10) ? 1 : 0); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
991 |
this->flags4 |= 5 << WF_TIMEOUT_SHL; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
992 |
_left_button_clicked = false; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
993 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
994 |
} break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
995 |
default: NOT_REACHED(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
996 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
997 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
998 |
if (value != oldvalue) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
999 |
SetPatchValue(page->entries[btn].index, patches_ptr, value); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1000 |
this->SetDirty(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1001 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1002 |
} else { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1003 |
/* only open editbox for types that its sensible for */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1004 |
if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1005 |
/* Show the correct currency-translated value */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1006 |
if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1007 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1008 |
this->entry = btn; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1009 |
SetDParam(0, value); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1010 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, this, CS_NUMERAL); |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
1011 |
} |
0 | 1012 |
} |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1013 |
} break; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
1014 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1015 |
case PATCHSEL_INTERFACE: case PATCHSEL_CONSTRUCTION: case PATCHSEL_VEHICLES: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1016 |
case PATCHSEL_STATIONS: case PATCHSEL_ECONOMY: case PATCHSEL_COMPETITORS: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1017 |
this->RaiseWidget(this->page + PATCHSEL_INTERFACE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1018 |
this->page = widget - PATCHSEL_INTERFACE; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1019 |
this->LowerWidget(this->page + PATCHSEL_INTERFACE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1020 |
DeleteWindowById(WC_QUERY_STRING, 0); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1021 |
this->SetDirty(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1022 |
break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1023 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1024 |
} |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
1025 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1026 |
virtual void OnTimeout() |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1027 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1028 |
this->click = 0; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1029 |
this->SetDirty(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1030 |
} |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
1031 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1032 |
virtual void OnQueryTextFinished(char *str) |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1033 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1034 |
if (!StrEmpty(str)) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1035 |
const PatchEntry *pe = &_patches_page[this->page].entries[this->entry]; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1036 |
const SettingDesc *sd = pe->setting; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1037 |
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
|
1038 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1039 |
/* Save the correct currency-translated value */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1040 |
if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; |
0 | 1041 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1042 |
SetPatchValue(pe->index, patches_ptr, value); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1043 |
this->SetDirty(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1044 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1045 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1046 |
}; |
8686
b1d73ae17e19
(svn r11753) -Codechange: re-indent the switch case structures, as to be more code style oriented.
belugas
parents:
8685
diff
changeset
|
1047 |
|
10703
2c998f3776d1
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents:
10695
diff
changeset
|
1048 |
Settings *PatchesSelectionWindow::patches_ptr = NULL; |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1049 |
int PatchesSelectionWindow::patches_max = 0; |
0 | 1050 |
|
1051 |
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
|
1052 |
{ 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
|
1053 |
{ 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
|
1054 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, |
9089
dd3df8d3ded0
(svn r12174) -Codechange: Make the patches window dynamically resize to the largest patch tab, so adding patch options is simply a case of adding to the lists.
peter1138
parents:
9047
diff
changeset
|
1055 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 50, 0x0, STR_NULL}, |
0 | 1056 |
|
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
|
1057 |
{ 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
|
1058 |
{ 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
|
1059 |
{ 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
|
1060 |
{ 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
|
1061 |
{ 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
|
1062 |
{ 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
|
1063 |
{ WIDGETS_END}, |
0 | 1064 |
}; |
1065 |
||
1066 |
static const WindowDesc _patches_selection_desc = { |
|
9089
dd3df8d3ded0
(svn r12174) -Codechange: Make the patches window dynamically resize to the largest patch tab, so adding patch options is simply a case of adding to the lists.
peter1138
parents:
9047
diff
changeset
|
1067 |
WDP_CENTER, WDP_CENTER, 370, 51, 370, 51, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
1068 |
WC_GAME_OPTIONS, WC_NONE, |
0 | 1069 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
1070 |
_patches_selection_widgets, |
|
1071 |
}; |
|
1072 |
||
6573 | 1073 |
void ShowPatchesSelection() |
0 | 1074 |
{ |
1075 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1076 |
new PatchesSelectionWindow(&_patches_selection_desc); |
0 | 1077 |
} |
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
|
1078 |
|
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
|
1079 |
|
4211
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1080 |
/** |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1081 |
* Draw [<][>] boxes. |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1082 |
* @param x the x position to draw |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1083 |
* @param y the y position to draw |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1084 |
* @param ctab the color of the buttons |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1085 |
* @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
|
1086 |
* @param clickable_left is the left button clickable? |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1087 |
* @param clickable_right is the right button clickable? |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1088 |
*/ |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1089 |
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
|
1090 |
{ |
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5860
diff
changeset
|
1091 |
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
|
1092 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
1093 |
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
|
1094 |
DrawFrameRect(x + 10, y + 1, x + 19, y + 9, ctab, (state == 2) ? FR_LOWERED : FR_NONE); |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8238
diff
changeset
|
1095 |
DrawStringCentered(x + 5, y + 1, STR_6819, TC_FROMSTRING); // [<] |
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8238
diff
changeset
|
1096 |
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
|
1097 |
|
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1098 |
/* Grey out the buttons that aren't clickable */ |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1099 |
if (!clickable_left) |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1100 |
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
|
1101 |
if (!clickable_right) |
d8c4c40eba62
(svn r5714) Backport from branches/TGP (r5701 and r5711)
miham
parents:
4196
diff
changeset
|
1102 |
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
|
1103 |
} |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1104 |
|
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1105 |
/** These are not, strickly speaking, widget enums, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1106 |
* since they have been changed as line coordinates. |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1107 |
* So, rather, they are more like order of appearance */ |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1108 |
enum CustomCurrenciesWidgets { |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1109 |
CUSTCURR_EXCHANGERATE = 0, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1110 |
CUSTCURR_SEPARATOR, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1111 |
CUSTCURR_PREFIX, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1112 |
CUSTCURR_SUFFIX, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1113 |
CUSTCURR_TO_EURO, |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1114 |
}; |
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1115 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1116 |
struct CustomCurrencyWindow : Window { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1117 |
char separator[2]; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1118 |
int click; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1119 |
int query_widget; |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1120 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1121 |
CustomCurrencyWindow(const WindowDesc *desc) : Window(desc) |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1122 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1123 |
this->separator[0] = _custom_currency.separator; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1124 |
this->separator[1] = '\0'; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1125 |
this->FindWindowPlacementAndResize(desc); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1126 |
} |
812
79c99885ad00
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
1127 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1128 |
virtual void OnPaint() |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1129 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1130 |
int x; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1131 |
int y = 20; |
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10568
diff
changeset
|
1132 |
this->DrawWidgets(); |
2639 | 1133 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1134 |
/* exchange rate */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1135 |
DrawArrowButtons(10, y, 3, GB(this->click, 0, 2), true, true); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1136 |
SetDParam(0, 1); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1137 |
SetDParam(1, 1); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1138 |
DrawString(35, y + 1, STR_CURRENCY_EXCHANGE_RATE, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1139 |
y += 12; |
2639 | 1140 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1141 |
/* separator */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1142 |
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(this->click, 2, 2) ? FR_LOWERED : FR_NONE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1143 |
x = DrawString(35, y + 1, STR_CURRENCY_SEPARATOR, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1144 |
DoDrawString(this->separator, x + 4, y + 1, TC_ORANGE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1145 |
y += 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1146 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1147 |
/* prefix */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1148 |
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(this->click, 4, 2) ? FR_LOWERED : FR_NONE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1149 |
x = DrawString(35, y + 1, STR_CURRENCY_PREFIX, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1150 |
DoDrawString(_custom_currency.prefix, x + 4, y + 1, TC_ORANGE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1151 |
y += 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1152 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1153 |
/* suffix */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1154 |
DrawFrameRect(10, y + 1, 29, y + 9, 0, GB(this->click, 6, 2) ? FR_LOWERED : FR_NONE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1155 |
x = DrawString(35, y + 1, STR_CURRENCY_SUFFIX, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1156 |
DoDrawString(_custom_currency.suffix, x + 4, y + 1, TC_ORANGE); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1157 |
y += 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1158 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1159 |
/* switch to euro */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1160 |
DrawArrowButtons(10, y, 3, GB(this->click, 8, 2), true, true); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1161 |
SetDParam(0, _custom_currency.to_euro); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1162 |
DrawString(35, y + 1, (_custom_currency.to_euro != CF_NOEURO) ? STR_CURRENCY_SWITCH_TO_EURO : STR_CURRENCY_SWITCH_TO_EURO_NEVER, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1163 |
y += 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1164 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1165 |
/* Preview */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1166 |
y += 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1167 |
SetDParam(0, 10000); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1168 |
DrawString(35, y + 1, STR_CURRENCY_PREVIEW, TC_FROMSTRING); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1169 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1170 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1171 |
virtual void OnClick(Point pt, int widget) |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1172 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1173 |
int line = (pt.y - 20) / 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1174 |
int len = 0; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1175 |
int x = pt.x; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1176 |
StringID str = 0; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1177 |
CharSetFilter afilter = CS_ALPHANUMERAL; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1178 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1179 |
switch (line) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1180 |
case CUSTCURR_EXCHANGERATE: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1181 |
if (IsInsideMM(x, 10, 30)) { // clicked buttons |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1182 |
if (x < 20) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1183 |
if (_custom_currency.rate > 1) _custom_currency.rate--; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1184 |
this->click = 1 << (line * 2 + 0); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1185 |
} else { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1186 |
if (_custom_currency.rate < 5000) _custom_currency.rate++; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1187 |
this->click = 1 << (line * 2 + 1); |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1188 |
} |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1189 |
} else { // enter text |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1190 |
SetDParam(0, _custom_currency.rate); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1191 |
str = STR_CONFIG_PATCHES_INT32; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1192 |
len = 4; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1193 |
afilter = CS_NUMERAL; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1194 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1195 |
break; |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1196 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1197 |
case CUSTCURR_SEPARATOR: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1198 |
if (IsInsideMM(x, 10, 30)) { // clicked button |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1199 |
this->click = 1 << (line * 2 + 1); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1200 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1201 |
str = BindCString(this->separator); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1202 |
len = 1; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1203 |
break; |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1204 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1205 |
case CUSTCURR_PREFIX: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1206 |
if (IsInsideMM(x, 10, 30)) { // clicked button |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1207 |
this->click = 1 << (line * 2 + 1); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1208 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1209 |
str = BindCString(_custom_currency.prefix); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1210 |
len = 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1211 |
break; |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1212 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1213 |
case CUSTCURR_SUFFIX: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1214 |
if (IsInsideMM(x, 10, 30)) { // clicked button |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1215 |
this->click = 1 << (line * 2 + 1); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1216 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1217 |
str = BindCString(_custom_currency.suffix); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1218 |
len = 12; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1219 |
break; |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1220 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1221 |
case CUSTCURR_TO_EURO: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1222 |
if (IsInsideMM(x, 10, 30)) { // clicked buttons |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1223 |
if (x < 20) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1224 |
_custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ? |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1225 |
CF_NOEURO : _custom_currency.to_euro - 1; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1226 |
this->click = 1 << (line * 2 + 0); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1227 |
} else { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1228 |
_custom_currency.to_euro = |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1229 |
Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1230 |
this->click = 1 << (line * 2 + 1); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1231 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1232 |
} else { // enter text |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1233 |
SetDParam(0, _custom_currency.to_euro); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1234 |
str = STR_CONFIG_PATCHES_INT32; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1235 |
len = 4; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1236 |
afilter = CS_NUMERAL; |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1237 |
} |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1238 |
break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1239 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1240 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1241 |
if (len != 0) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1242 |
this->query_widget = line; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1243 |
ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1244 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1245 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1246 |
this->flags4 |= 5 << WF_TIMEOUT_SHL; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1247 |
this->SetDirty(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1248 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1249 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1250 |
virtual void OnQueryTextFinished(char *str) |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1251 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1252 |
if (str == NULL) return; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1253 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1254 |
switch (this->query_widget) { |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1255 |
case CUSTCURR_EXCHANGERATE: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1256 |
_custom_currency.rate = Clamp(atoi(str), 1, 5000); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1257 |
break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1258 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1259 |
case CUSTCURR_SEPARATOR: /* Thousands seperator */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1260 |
_custom_currency.separator = StrEmpty(str) ? ' ' : str[0]; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1261 |
ttd_strlcpy(this->separator, str, lengthof(this->separator)); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1262 |
break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1263 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1264 |
case CUSTCURR_PREFIX: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1265 |
ttd_strlcpy(_custom_currency.prefix, str, lengthof(_custom_currency.prefix)); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1266 |
break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1267 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1268 |
case CUSTCURR_SUFFIX: |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1269 |
ttd_strlcpy(_custom_currency.suffix, str, lengthof(_custom_currency.suffix)); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1270 |
break; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1271 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1272 |
case CUSTCURR_TO_EURO: { /* Year to switch to euro */ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1273 |
int val = atoi(str); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1274 |
|
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1275 |
_custom_currency.to_euro = (val < 2000 ? CF_NOEURO : min(val, MAX_YEAR)); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1276 |
break; |
8684
ad348701d4e1
(svn r11751) -Codechange: Enumify some widgets (and others) and while at it, apply some code style
belugas
parents:
8678
diff
changeset
|
1277 |
} |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1278 |
} |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1279 |
MarkWholeScreenDirty(); |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1280 |
} |
4488
6eb5f6192c3a
(svn r6273) Clean up the custom currency window handler a bit
tron
parents:
4444
diff
changeset
|
1281 |
|
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1282 |
virtual void OnTimeout() |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1283 |
{ |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1284 |
this->click = 0; |
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1285 |
this->SetDirty(); |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1286 |
} |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1287 |
}; |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1288 |
|
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1289 |
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
|
1290 |
{ 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
|
1291 |
{ 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
|
1292 |
{ 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
|
1293 |
{ WIDGETS_END}, |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1294 |
}; |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1295 |
|
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1296 |
static const WindowDesc _cust_currency_desc = { |
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7673
diff
changeset
|
1297 |
WDP_CENTER, WDP_CENTER, 230, 120, 230, 120, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5939
diff
changeset
|
1298 |
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
|
1299 |
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
|
1300 |
_cust_currency_widgets, |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1301 |
}; |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1302 |
|
6573 | 1303 |
static void ShowCustCurrency() |
759
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1304 |
{ |
6d087784a08a
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1305 |
DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
10568
33792df463d7
(svn r13112) -Codechange: make classes of the patches and custom currency windows.
rubidium
parents:
10553
diff
changeset
|
1306 |
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
|
1307 |
} |