author | truelight |
Thu, 24 Mar 2005 14:43:40 +0000 | |
changeset 1540 | 6eef12dab5bf |
parent 1501 | 0fc808b4e375 |
child 1739 | 4c8fb3905cbd |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
1317
3c90086ff34f
(svn r1821) Move generic string handling functions to string.[ch] and introduce stre{cpy,cat}, see string.h for their semantics
tron
parents:
1309
diff
changeset
|
3 |
#include "string.h" |
1309
4403a69da4f8
(svn r1813) Declare functions implemented in strings.c in their own shiny new header (though i think some of these function don't belong into strings.c)
tron
parents:
1282
diff
changeset
|
4 |
#include "strings.h" // XXX GetCurrentCurrencyRate() |
1363
775a7ee52369
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1323
diff
changeset
|
5 |
#include "table/sprites.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
502
diff
changeset
|
6 |
#include "table/strings.h" |
0 | 7 |
#include "window.h" |
8 |
#include "gui.h" |
|
9 |
#include "gfx.h" |
|
10 |
#include "command.h" |
|
11 |
#include "engine.h" |
|
430 | 12 |
#include "screenshot.h" |
478
3a161108a15d
(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
|
13 |
#include "newgrf.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
14 |
#include "network.h" |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
15 |
#include "console.h" |
835
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
16 |
#include "town.h" |
0 | 17 |
|
18 |
static uint32 _difficulty_click_a; |
|
19 |
static uint32 _difficulty_click_b; |
|
20 |
static byte _difficulty_timeout; |
|
21 |
||
22 |
extern const StringID _currency_string_list[]; |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
23 |
extern uint GetMaskOfAllowedCurrencies(void); |
0 | 24 |
|
25 |
static const StringID _distances_dropdown[] = { |
|
26 |
STR_0139_IMPERIAL_MILES, |
|
27 |
STR_013A_METRIC_KILOMETERS, |
|
28 |
INVALID_STRING_ID |
|
29 |
}; |
|
30 |
||
31 |
static const StringID _driveside_dropdown[] = { |
|
32 |
STR_02E9_DRIVE_ON_LEFT, |
|
33 |
STR_02EA_DRIVE_ON_RIGHT, |
|
34 |
INVALID_STRING_ID |
|
35 |
}; |
|
36 |
||
37 |
static const StringID _autosave_dropdown[] = { |
|
38 |
STR_02F7_OFF, |
|
39 |
STR_AUTOSAVE_1_MONTH, |
|
40 |
STR_02F8_EVERY_3_MONTHS, |
|
41 |
STR_02F9_EVERY_6_MONTHS, |
|
42 |
STR_02FA_EVERY_12_MONTHS, |
|
43 |
INVALID_STRING_ID, |
|
44 |
}; |
|
45 |
||
46 |
static const StringID _designnames_dropdown[] = { |
|
47 |
STR_02BE_DEFAULT, |
|
48 |
STR_02BF_CUSTOM, |
|
49 |
INVALID_STRING_ID |
|
50 |
}; |
|
51 |
||
52 |
static StringID *BuildDynamicDropdown(StringID base, int num) |
|
53 |
{ |
|
54 |
static StringID buf[32 + 1]; |
|
55 |
StringID *p = buf; |
|
56 |
while (--num>=0) *p++ = base++; |
|
57 |
*p = INVALID_STRING_ID; |
|
58 |
return buf; |
|
59 |
} |
|
60 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
61 |
static int GetCurRes(void) |
0 | 62 |
{ |
63 |
int i; |
|
306
9ba288cacf0a
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
64 |
for(i = 0; i != _num_resolutions; i++) |
9ba288cacf0a
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
65 |
if (_resolutions[i][0] == _screen.width && |
9ba288cacf0a
(svn r312) -Fix: [926105] ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
darkvater
parents:
298
diff
changeset
|
66 |
_resolutions[i][1] == _screen.height) |
0 | 67 |
break; |
68 |
return i; |
|
69 |
} |
|
70 |
||
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
71 |
static inline bool RoadVehiclesAreBuilt(void) |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
72 |
{ |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
73 |
Vehicle *v; |
915 | 74 |
FOR_ALL_VEHICLES(v) { |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
75 |
if (v->type == VEH_Road) return true; |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
76 |
} |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
77 |
return false; |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
78 |
} |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
79 |
|
0 | 80 |
static void GameOptionsWndProc(Window *w, WindowEvent *e) |
81 |
{ |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
82 |
switch (e->event) { |
0 | 83 |
case WE_PAINT: { |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
84 |
int i; |
0 | 85 |
StringID str = STR_02BE_DEFAULT; |
86 |
w->disabled_state = (_vehicle_design_names & 1) ? (++str, 0) : (1 << 21); |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
87 |
SetDParam(0, str); |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
88 |
SetDParam(1, _currency_string_list[_opt_ptr->currency]); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
89 |
SetDParam(2, _opt_ptr->kilometers + STR_0139_IMPERIAL_MILES); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
90 |
SetDParam(3, STR_02E9_DRIVE_ON_LEFT + _opt_ptr->road_side); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
91 |
SetDParam(4, STR_TOWNNAME_ORIGINAL_ENGLISH + _opt_ptr->town_name); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
92 |
SetDParam(5, _autosave_dropdown[_opt_ptr->autosave]); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
93 |
SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr); |
0 | 94 |
i = GetCurRes(); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
95 |
SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
96 |
SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format); |
298
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
97 |
(_fullscreen) ? SETBIT(w->click_state, 28) : CLRBIT(w->click_state, 28); // fullscreen button |
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
98 |
|
0 | 99 |
DrawWindowWidgets(w); |
298
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
100 |
DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen |
0 | 101 |
} break; |
102 |
||
103 |
case WE_CLICK: |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
104 |
switch (e->click.widget) { |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
105 |
case 5: /* Setup currencies dropdown */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
106 |
ShowDropDownMenu(w, _currency_string_list, _opt_ptr->currency, e->click.widget, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0); |
0 | 107 |
return; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
108 |
case 8: /* Setup distance unit dropdown */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
109 |
ShowDropDownMenu(w, _distances_dropdown, _opt_ptr->kilometers, e->click.widget, 0, 0); |
0 | 110 |
return; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
111 |
case 11: { /* Setup road-side dropdown */ |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
112 |
int i = 0; |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
113 |
|
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
114 |
/* You can only change the drive side if you are in the menu or ingame with |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
115 |
* no vehicles present. In a networking game only the server can change it */ |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
116 |
if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
117 |
i = (-1) ^ (1 << _opt_ptr->road_side); // disable the other value |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
118 |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
119 |
ShowDropDownMenu(w, _driveside_dropdown, _opt_ptr->road_side, e->click.widget, i, 0); |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
120 |
} return; |
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
121 |
case 14: { /* Setup townname dropdown */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
122 |
int i = _opt_ptr->town_name; |
842 | 123 |
ShowDropDownMenu(w, BuildDynamicDropdown(STR_TOWNNAME_ORIGINAL_ENGLISH, SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1), i, e->click.widget, (_game_mode == GM_MENU) ? 0 : (-1) ^ (1 << i), 0); |
0 | 124 |
return; |
125 |
} |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
126 |
case 17: /* Setup autosave dropdown */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
127 |
ShowDropDownMenu(w, _autosave_dropdown, _opt_ptr->autosave, e->click.widget, 0, 0); |
0 | 128 |
return; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
129 |
case 20: /* Setup customized vehicle-names dropdown */ |
842 | 130 |
ShowDropDownMenu(w, _designnames_dropdown, (_vehicle_design_names&1)?1:0, e->click.widget, (_vehicle_design_names&2)?0:2, 0); |
0 | 131 |
return; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
132 |
case 21: /* Save customized vehicle-names to disk */ |
0 | 133 |
return; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
134 |
case 24: /* Setup interface language dropdown */ |
842 | 135 |
ShowDropDownMenu(w, _dynlang.dropdown, _dynlang.curr, e->click.widget, 0, 0); |
0 | 136 |
return; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
137 |
case 27: /* Setup resolution dropdown */ |
842 | 138 |
ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), e->click.widget, 0, 0); |
0 | 139 |
return; |
298
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
140 |
case 28: /* Click fullscreen on/off */ |
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
141 |
(_fullscreen) ? CLRBIT(w->click_state, 28) : SETBIT(w->click_state, 28); |
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
142 |
ToggleFullScreen(!_fullscreen); // toggle full-screen on/off |
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
143 |
SetWindowDirty(w); |
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
144 |
return; |
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
145 |
case 31: /* Setup screenshot format dropdown */ |
842 | 146 |
ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, e->click.widget, 0, 0); |
0 | 147 |
return; |
148 |
} |
|
149 |
break; |
|
150 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
151 |
case WE_DROPDOWN_SELECT: |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
152 |
switch (e->dropdown.button) { |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
153 |
case 20: /* Vehicle design names */ |
0 | 154 |
if (e->dropdown.index == 0) { |
155 |
DeleteCustomEngineNames(); |
|
156 |
MarkWholeScreenDirty(); |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
157 |
} else if (!(_vehicle_design_names & 1)) { |
0 | 158 |
LoadCustomEngineNames(); |
159 |
MarkWholeScreenDirty(); |
|
160 |
} |
|
161 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
162 |
case 5: /* Currency */ |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
163 |
if (e->dropdown.index == 23) |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
164 |
ShowCustCurrency(); |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
165 |
_opt_ptr->currency = e->dropdown.index; |
0 | 166 |
MarkWholeScreenDirty(); |
167 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
168 |
case 8: /* Distance units */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
169 |
_opt_ptr->kilometers = e->dropdown.index; |
0 | 170 |
MarkWholeScreenDirty(); |
171 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
172 |
case 11: /* Road side */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
173 |
if (_opt_ptr->road_side != e->dropdown.index) { // only change if setting changed |
0 | 174 |
DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_EMPTY)); |
1113
da5c5c571541
(svn r1614) Fix: Signals were not updated correctly when the vehicle drive side was changed
dominik
parents:
1095
diff
changeset
|
175 |
MarkWholeScreenDirty(); |
da5c5c571541
(svn r1614) Fix: Signals were not updated correctly when the vehicle drive side was changed
dominik
parents:
1095
diff
changeset
|
176 |
} |
0 | 177 |
break; |
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
178 |
case 14: /* Town names */ |
0 | 179 |
if (_game_mode == GM_MENU) |
180 |
DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_TOWN_NAME_TYPE | CMD_MSG(STR_EMPTY)); |
|
181 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
182 |
case 17: /* Autosave options */ |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
183 |
_opt_ptr->autosave = e->dropdown.index; |
0 | 184 |
SetWindowDirty(w); |
185 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
186 |
case 24: /* Change interface language */ |
0 | 187 |
ReadLanguagePack(e->dropdown.index); |
188 |
MarkWholeScreenDirty(); |
|
189 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
190 |
case 27: /* Change resolution */ |
0 | 191 |
if (e->dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->dropdown.index][0],_resolutions[e->dropdown.index][1])) |
192 |
SetWindowDirty(w); |
|
193 |
break; |
|
871
0143ae5b4112
(svn r1352) -Fix: [1093200] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
darkvater
parents:
867
diff
changeset
|
194 |
case 31: /* Change screenshot format */ |
0 | 195 |
SetScreenshotFormat(e->dropdown.index); |
196 |
SetWindowDirty(w); |
|
197 |
break; |
|
198 |
} |
|
199 |
break; |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
200 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
201 |
case WE_DESTROY: |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
202 |
DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
203 |
break; |
0 | 204 |
} |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
205 |
|
0 | 206 |
} |
207 |
||
208 |
int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
209 |
{ |
|
210 |
if (flags & DC_EXEC) { |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
211 |
_opt_ptr->road_side = p1; |
0 | 212 |
InvalidateWindow(WC_GAME_OPTIONS,0); |
213 |
} |
|
214 |
return 0; |
|
215 |
} |
|
216 |
||
217 |
int32 CmdSetTownNameType(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
218 |
{ |
|
219 |
if (flags & DC_EXEC) { |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
220 |
_opt_ptr->town_name = p1; |
0 | 221 |
InvalidateWindow(WC_GAME_OPTIONS,0); |
222 |
} |
|
223 |
return 0; |
|
224 |
} |
|
225 |
||
226 |
||
227 |
static const Widget _game_options_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
228 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
229 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
230 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 369, 14, 238, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
231 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 20, 55, STR_02E0_CURRENCY_UNITS, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
232 |
{ WWT_6, RESIZE_NONE, 14, 20, 169, 34, 45, STR_02E1, STR_02E2_CURRENCY_UNITS_SELECTION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
233 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 158, 168, 35, 44, STR_0225, STR_02E2_CURRENCY_UNITS_SELECTION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
234 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 20, 55, STR_02E3_DISTANCE_UNITS, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
235 |
{ WWT_6, RESIZE_NONE, 14, 200, 349, 34, 45, STR_02E4, STR_02E5_DISTANCE_UNITS_SELECTION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
236 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 338, 348, 35, 44, STR_0225, STR_02E5_DISTANCE_UNITS_SELECTION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
237 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 62, 97, STR_02E6_ROAD_VEHICLES, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
238 |
{ WWT_6, RESIZE_NONE, 14, 20, 169, 76, 87, STR_02E7, STR_02E8_SELECT_SIDE_OF_ROAD_FOR}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
239 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 158, 168, 77, 86, STR_0225, STR_02E8_SELECT_SIDE_OF_ROAD_FOR}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
240 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 62, 97, STR_02EB_TOWN_NAMES, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
241 |
{ WWT_6, RESIZE_NONE, 14, 200, 349, 76, 87, STR_02EC, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
242 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 338, 348, 77, 86, STR_0225, STR_02ED_SELECT_STYLE_OF_TOWN_NAMES}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
243 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 104, 139, STR_02F4_AUTOSAVE, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
244 |
{ WWT_6, RESIZE_NONE, 14, 20, 169, 118, 129, STR_02F5, STR_02F6_SELECT_INTERVAL_BETWEEN}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
245 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 158, 168, 119, 128, STR_0225, STR_02F6_SELECT_INTERVAL_BETWEEN}, |
0 | 246 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
247 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 359, 194, 228, STR_02BC_VEHICLE_DESIGN_NAMES, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
248 |
{ WWT_6, RESIZE_NONE, 14, 20, 119, 207, 218, STR_02BD, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
249 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 108, 118, 208, 217, STR_0225, STR_02C1_VEHICLE_DESIGN_NAMES_SELECTION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
250 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 130, 349, 207, 218, STR_02C0_SAVE_CUSTOM_NAMES, STR_02C2_SAVE_CUSTOMIZED_VEHICLE}, |
0 | 251 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
252 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 104, 139, STR_OPTIONS_LANG, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
253 |
{ WWT_6, RESIZE_NONE, 14, 200, 349, 118, 129, STR_OPTIONS_LANG_CBO, STR_OPTIONS_LANG_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
254 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 338, 348, 119, 128, STR_0225, STR_OPTIONS_LANG_TIP}, |
298
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
255 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
256 |
{ WWT_FRAME, RESIZE_NONE, 14, 10, 179, 146, 190, STR_OPTIONS_RES, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
257 |
{ WWT_6, RESIZE_NONE, 14, 20, 169, 160, 171, STR_OPTIONS_RES_CBO, STR_OPTIONS_RES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
258 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 158, 168, 161, 170, STR_0225, STR_OPTIONS_RES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
259 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 149, 169, 176, 184, STR_EMPTY, STR_OPTIONS_FULLSCREEN_TIP}, |
0 | 260 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
261 |
{ WWT_FRAME, RESIZE_NONE, 14, 190, 359, 146, 190, STR_OPTIONS_SCREENSHOT_FORMAT, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
262 |
{ WWT_6, RESIZE_NONE, 14, 200, 349, 160, 171, STR_OPTIONS_SCREENSHOT_FORMAT_CBO, STR_OPTIONS_SCREENSHOT_FORMAT_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
263 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 338, 348, 161, 170, STR_0225, STR_OPTIONS_SCREENSHOT_FORMAT_TIP}, |
0 | 264 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
265 |
{ WIDGETS_END}, |
0 | 266 |
}; |
267 |
||
268 |
static const WindowDesc _game_options_desc = { |
|
298
0123c0489940
(svn r304) -Fix: [967096] fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
darkvater
parents:
193
diff
changeset
|
269 |
WDP_CENTER, WDP_CENTER, 370, 239, |
0 | 270 |
WC_GAME_OPTIONS,0, |
271 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESTORE_DPARAM | WDF_UNCLICK_BUTTONS, |
|
272 |
_game_options_widgets, |
|
273 |
GameOptionsWndProc |
|
274 |
}; |
|
275 |
||
276 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
277 |
void ShowGameOptions(void) |
0 | 278 |
{ |
279 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
280 |
AllocateWindowDesc(&_game_options_desc); |
|
281 |
} |
|
282 |
||
283 |
typedef struct { |
|
284 |
int16 min; |
|
285 |
int16 max; |
|
286 |
int16 step; |
|
287 |
StringID str; |
|
288 |
} GameSettingData; |
|
289 |
||
290 |
static const GameSettingData _game_setting_info[] = { |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
291 |
{ 0, 7, 1, STR_NULL}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
292 |
{ 0, 3, 1, STR_6830_IMMEDIATE}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
293 |
{ 0, 2, 1, STR_6816_LOW}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
294 |
{ 0, 3, 1, STR_26816_NONE}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
295 |
{100, 500, 50, STR_NULL}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
296 |
{ 2, 4, 1, STR_NULL}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
297 |
{ 0, 2, 1, STR_6820_LOW}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
298 |
{ 0, 4, 1, STR_681B_VERY_SLOW}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
299 |
{ 0, 2, 1, STR_6820_LOW}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
300 |
{ 0, 2, 1, STR_6823_NONE}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
301 |
{ 0, 3, 1, STR_6826_X1_5}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
302 |
{ 0, 2, 1, STR_6820_LOW}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
303 |
{ 0, 3, 1, STR_682A_VERY_FLAT}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
304 |
{ 0, 3, 1, STR_VERY_LOW}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
305 |
{ 0, 1, 1, STR_682E_STEADY}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
306 |
{ 0, 1, 1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
307 |
{ 0, 1, 1, STR_6836_OFF}, |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
308 |
{ 0, 2, 1, STR_6839_PERMISSIVE}, |
0 | 309 |
}; |
310 |
||
536 | 311 |
static inline bool GetBitAndShift(uint32 *b) |
0 | 312 |
{ |
313 |
uint32 x = *b; |
|
314 |
*b >>= 1; |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
315 |
return HASBIT(x, 0); |
0 | 316 |
} |
317 |
||
1385
91d75432f81e
(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
|
318 |
/* |
91d75432f81e
(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
|
319 |
A: competitors |
91d75432f81e
(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
|
320 |
B: start time in months / 3 |
91d75432f81e
(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
|
321 |
C: town count (2 = high, 0 = low) |
91d75432f81e
(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
|
322 |
D: industry count (3 = high, 0 = none) |
91d75432f81e
(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
|
323 |
E: inital loan / 1000 (in GBP) |
91d75432f81e
(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
|
324 |
F: interest rate |
91d75432f81e
(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
|
325 |
G: running costs (0 = low, 2 = high) |
91d75432f81e
(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
|
326 |
H: construction speed of competitors (0 = very slow, 4 = very fast) |
91d75432f81e
(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
|
327 |
I: intelligence (0-2) |
91d75432f81e
(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
|
328 |
J: breakdowns(0 = off, 2 = normal) |
91d75432f81e
(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
|
329 |
K: subsidy multiplier (0 = 1.5, 3 = 4.0) |
91d75432f81e
(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
|
330 |
L: construction cost (0-2) |
91d75432f81e
(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
|
331 |
M: terrain type (0 = very flat, 3 = mountainous) |
91d75432f81e
(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
|
332 |
N: amount of water (0 = very low, 3 = high) |
91d75432f81e
(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
|
333 |
O: economy (0 = steady, 1 = fluctuating) |
91d75432f81e
(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
|
334 |
P: Train reversing (0 = end of line + stations, 1 = end of line) |
91d75432f81e
(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
|
335 |
Q: disasters |
91d75432f81e
(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
|
336 |
R: area restructuring (0 = permissive, 2 = hostile) |
91d75432f81e
(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
|
337 |
*/ |
91d75432f81e
(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
|
338 |
static const int16 _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /* |
91d75432f81e
(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
|
339 |
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/ |
91d75432f81e
(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
|
340 |
{2, 2, 1, 3, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, //easy |
91d75432f81e
(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
|
341 |
{4, 1, 1, 2, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, //medium |
91d75432f81e
(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
|
342 |
{7, 0, 2, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, //hard |
0 | 343 |
}; |
344 |
||
345 |
void SetDifficultyLevel(int mode, GameOptions *gm_opt) |
|
346 |
{ |
|
347 |
int i; |
|
348 |
assert(mode <= 3); |
|
349 |
||
350 |
gm_opt->diff_level = mode; |
|
351 |
if (mode != 3) { // not custom |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
352 |
for (i = 0; i != GAME_DIFFICULTY_NUM; i++) |
0 | 353 |
((int*)&gm_opt->diff)[i] = _default_game_diff[mode][i]; |
354 |
} |
|
355 |
} |
|
356 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
357 |
extern void StartupEconomy(void); |
46
c9bdf1d58df6
(svn r47) -Fix StartupEconomy warning in settings_gui.c
darkvater
parents:
42
diff
changeset
|
358 |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
359 |
enum { |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
360 |
GAMEDIFF_WND_TOP_OFFSET = 45, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
361 |
GAMEDIFF_WND_ROWSIZE = 9 |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
362 |
}; |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
363 |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
364 |
// Temporary holding place of values in the difficulty window until 'Save' is clicked |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
365 |
static GameOptions _opt_mod_temp; |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
366 |
// 0x383E = (1 << 13) | (1 << 12) | (1 << 11) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
367 |
#define DIFF_INGAME_DISABLED_BUTTONS 0x383E |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
368 |
|
0 | 369 |
static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
370 |
{ |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
371 |
switch (e->event) { |
0 | 372 |
case WE_PAINT: { |
373 |
uint32 click_a, click_b, disabled; |
|
374 |
int i; |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
375 |
int y, value; |
0 | 376 |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
377 |
w->click_state = (1 << 3) << _opt_mod_temp.diff_level; // have current difficulty button clicked |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
378 |
// disable all other difficulty buttons during gameplay except for 'custom' |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
379 |
w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6); |
1249
3f6390064c63
(svn r1753) - Fix: [ 1113037 ] crash when accessing hi-scores in editor, it is now disabled.
darkvater
parents:
1247
diff
changeset
|
380 |
|
3f6390064c63
(svn r1753) - Fix: [ 1113037 ] crash when accessing hi-scores in editor, it is now disabled.
darkvater
parents:
1247
diff
changeset
|
381 |
if (_game_mode == GM_EDITOR) |
3f6390064c63
(svn r1753) - Fix: [ 1113037 ] crash when accessing hi-scores in editor, it is now disabled.
darkvater
parents:
1247
diff
changeset
|
382 |
SETBIT(w->disabled_state, 7); |
3f6390064c63
(svn r1753) - Fix: [ 1113037 ] crash when accessing hi-scores in editor, it is now disabled.
darkvater
parents:
1247
diff
changeset
|
383 |
|
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
384 |
if (_networking) { |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
385 |
SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
386 |
if (!_network_server) |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
387 |
SETBIT(w->disabled_state, 10); // Disable save-button in multiplayer (and if client) |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
388 |
} |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
389 |
|
0 | 390 |
DrawWindowWidgets(w); |
391 |
||
392 |
click_a = _difficulty_click_a; |
|
393 |
click_b = _difficulty_click_b; |
|
394 |
||
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
395 |
/* XXX - Disabled buttons in normal gameplay. Bitshifted for each button to see if |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
396 |
* that bit is set. If it is set, the button is disabled */ |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
397 |
disabled = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0; |
0 | 398 |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
399 |
y = GAMEDIFF_WND_TOP_OFFSET; |
0 | 400 |
for (i = 0; i != GAME_DIFFICULTY_NUM; i++) { |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
401 |
DrawFrameRect( 5, y, 5 + 8, y + 8, 3, GetBitAndShift(&click_a) ? (1 << 5) : 0); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
402 |
DrawFrameRect(15, y, 15 + 8, y + 8, 3, GetBitAndShift(&click_b) ? (1 << 5) : 0); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
403 |
if (GetBitAndShift(&disabled) || (_networking && !_network_server)) { |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
404 |
int color = PALETTE_MODIFIER_COLOR | _color_list[3].unk2; |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
405 |
GfxFillRect( 6, y + 1, 6 + 8, y + 8, color); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
406 |
GfxFillRect(16, y + 1, 16 + 8, y + 8, color); |
0 | 407 |
} |
408 |
||
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
409 |
DrawStringCentered(10, y, STR_6819, 0); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
410 |
DrawStringCentered(20, y, STR_681A, 0); |
0 | 411 |
|
412 |
||
413 |
value = _game_setting_info[i].str + ((int*)&_opt_mod_temp.diff)[i]; |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
414 |
if (i == 4) value *= 1000; // XXX - handle currency option |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
415 |
SetDParam(0, value); |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
416 |
DrawString(30, y, STR_6805_MAXIMUM_NO_COMPETITORS + i, 0); |
0 | 417 |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
418 |
y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit |
0 | 419 |
} |
420 |
} break; |
|
421 |
||
422 |
case WE_CLICK: |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
423 |
switch (e->click.widget) { |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
424 |
case 8: { /* Difficulty settings widget, decode click */ |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
425 |
const GameSettingData *info; |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
426 |
int x, y; |
0 | 427 |
uint btn, dis; |
428 |
int val; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
429 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
430 |
// Don't allow clients to make any changes |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
431 |
if (_networking && !_network_server) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
432 |
return; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
433 |
|
0 | 434 |
x = e->click.pt.x - 5; |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
435 |
if (!IS_INT_INSIDE(x, 0, 21)) // Button area |
0 | 436 |
return; |
437 |
||
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
438 |
y = e->click.pt.y - GAMEDIFF_WND_TOP_OFFSET; |
0 | 439 |
if (y < 0) |
440 |
return; |
|
441 |
||
442 |
// Get button from Y coord. |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
443 |
btn = y / (GAMEDIFF_WND_ROWSIZE + 2); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
444 |
if (btn >= GAME_DIFFICULTY_NUM || y % (GAMEDIFF_WND_ROWSIZE + 2) >= 9) |
0 | 445 |
return; |
446 |
||
447 |
// Clicked disabled button? |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
448 |
dis = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
449 |
|
0 | 450 |
if (HASBIT(dis, btn)) |
451 |
return; |
|
452 |
||
453 |
_difficulty_timeout = 5; |
|
454 |
||
455 |
val = ((int*)&_opt_mod_temp.diff)[btn]; |
|
456 |
||
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
457 |
info = &_game_setting_info[btn]; // get information about the difficulty setting |
0 | 458 |
if (x >= 10) { |
459 |
// Increase button clicked |
|
460 |
val = min(val + info->step, info->max); |
|
461 |
SETBIT(_difficulty_click_b, btn); |
|
462 |
} else { |
|
463 |
// Decrease button clicked |
|
464 |
val = max(val - info->step, info->min); |
|
465 |
SETBIT(_difficulty_click_a, btn); |
|
466 |
} |
|
467 |
||
468 |
// save value in temporary variable |
|
469 |
((int*)&_opt_mod_temp.diff)[btn] = val; |
|
470 |
SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom |
|
471 |
SetWindowDirty(w); |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
472 |
} break; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
473 |
case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */ |
0 | 474 |
// temporarily change difficulty level |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
475 |
SetDifficultyLevel(e->click.widget - 3, &_opt_mod_temp); |
0 | 476 |
SetWindowDirty(w); |
477 |
break; |
|
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
478 |
case 7: /* Highscore Table */ |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
479 |
ShowHighscoreTable(_opt_mod_temp.diff_level, -1); |
0 | 480 |
break; |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
481 |
case 10: { /* Save button - save changes */ |
0 | 482 |
int btn, val; |
483 |
for (btn = 0; btn != GAME_DIFFICULTY_NUM; btn++) { |
|
484 |
val = ((int*)&_opt_mod_temp.diff)[btn]; |
|
485 |
// if setting has changed, change it |
|
1501
0fc808b4e375
(svn r2005) - Fix: fix previous commit. Using 'New Game (scenario)' will use YOUR difficulty settings but ingame options (eg townnames, currency). Also settings are correctly saved when closing the difficulty window now.
Darkvater
parents:
1500
diff
changeset
|
486 |
if (val != ((int*)&_opt_ptr->diff)[btn]) |
0 | 487 |
DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
488 |
} |
|
489 |
DoCommandP(0, -1, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
|
490 |
DeleteWindow(w); |
|
42
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
491 |
// If we are in the editor, we should reload the economy. |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
492 |
// This way when you load a game, the max loan and interest rate |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
493 |
// are loaded correctly. |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
494 |
if (_game_mode == GM_EDITOR) |
567add3568d6
(svn r43) Fix: [ 982666 ] max_loan in editor bug (truelight)
dominik
parents:
26
diff
changeset
|
495 |
StartupEconomy(); |
0 | 496 |
break; |
497 |
} |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
498 |
case 11: /* Cancel button - close window, abandon changes */ |
0 | 499 |
DeleteWindow(w); |
500 |
break; |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
501 |
} break; |
0 | 502 |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
503 |
case WE_MOUSELOOP: /* Handle the visual 'clicking' of the buttons */ |
0 | 504 |
if (_difficulty_timeout != 0 && !--_difficulty_timeout) { |
505 |
_difficulty_click_a = 0; |
|
506 |
_difficulty_click_b = 0; |
|
507 |
SetWindowDirty(w); |
|
508 |
} |
|
509 |
break; |
|
510 |
} |
|
511 |
} |
|
512 |
||
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
513 |
#undef DIFF_INGAME_DISABLED_BUTTONS |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
514 |
|
0 | 515 |
static const Widget _game_difficulty_widgets[] = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
516 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
517 |
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_6800_DIFFICULTY_LEVEL, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
518 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 29, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
519 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_6801_EASY, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
520 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_6802_MEDIUM, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
521 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 184, 270, 16, 27, STR_6803_HARD, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
522 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 271, 357, 16, 27, STR_6804_CUSTOM, STR_NULL}, |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
523 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 369, 30, 41, STR_6838_SHOW_HI_SCORE_CHART,STR_NULL}, |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
524 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 262, 0x0, STR_NULL}, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
525 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 263, 278, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
526 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 105, 185, 265, 276, STR_OPTIONS_SAVE_CHANGES, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
527 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 186, 266, 265, 276, STR_012E_CANCEL, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
528 |
{ WIDGETS_END}, |
0 | 529 |
}; |
530 |
||
531 |
static const WindowDesc _game_difficulty_desc = { |
|
532 |
WDP_CENTER, WDP_CENTER, 370, 279, |
|
533 |
WC_GAME_OPTIONS,0, |
|
534 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
535 |
_game_difficulty_widgets, |
|
536 |
GameDifficultyWndProc |
|
537 |
}; |
|
538 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
539 |
void ShowGameDifficulty(void) |
0 | 540 |
{ |
541 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
542 |
/* Copy current settings (ingame or in intro) to temporary holding place |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
543 |
* change that when setting stuff, copy back on clicking 'OK' */ |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1477
diff
changeset
|
544 |
memcpy(&_opt_mod_temp, _opt_ptr, sizeof(GameOptions)); |
0 | 545 |
AllocateWindowDesc(&_game_difficulty_desc); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
546 |
} |
0 | 547 |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
548 |
// virtual PositionMainToolbar function, calls the right one. |
1095 | 549 |
static int32 v_PositionMainToolbar(int32 p1) |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
550 |
{ |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
551 |
if (_game_mode != GM_MENU) |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
552 |
PositionMainToolbar(NULL); |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
553 |
|
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
554 |
return 0; |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
555 |
} |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
556 |
|
1095 | 557 |
static int32 AiNew_PatchActive_Warning(int32 p1) |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
558 |
{ |
155
81e9878f3678
(svn r156) -Codechange: remove obsolete callback arrays
darkvater
parents:
91
diff
changeset
|
559 |
if (p1 == 1) |
81e9878f3678
(svn r156) -Codechange: remove obsolete callback arrays
darkvater
parents:
91
diff
changeset
|
560 |
ShowErrorMessage(-1, TEMP_AI_ACTIVATED, 0, 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
561 |
|
155
81e9878f3678
(svn r156) -Codechange: remove obsolete callback arrays
darkvater
parents:
91
diff
changeset
|
562 |
return 0; |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
563 |
} |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
564 |
|
1095 | 565 |
static int32 PopulationInLabelActive(int32 p1) |
835
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
566 |
{ |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
567 |
Town *t; |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
568 |
|
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
569 |
FOR_ALL_TOWNS(t) { |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
570 |
if (t->xy) { |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
571 |
UpdateTownVirtCoord(t); |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
572 |
} |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
573 |
} |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
574 |
|
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
575 |
return 0; |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
576 |
} |
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
577 |
|
1095 | 578 |
static int32 InvisibleTreesActive(int32 p1) |
91
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
579 |
{ |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
580 |
MarkWholeScreenDirty(); |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
581 |
return 0; |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
582 |
} |
6477ea0c240d
(svn r92) Feature: invisible trees when in transparent mode (patch entry)
dominik
parents:
84
diff
changeset
|
583 |
|
1095 | 584 |
static int32 InValidateDetailsWindow(int32 p1) |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
585 |
{ |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
586 |
InvalidateWindowClasses(WC_VEHICLE_DETAILS); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
587 |
return 0; |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
588 |
} |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
589 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
590 |
/* Check service intervals of vehicles, p1 is value of % or day based servicing */ |
1095 | 591 |
static int32 CheckInterval(int32 p1) |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
592 |
{ |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
593 |
bool warning; |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
594 |
if (p1) { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
595 |
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 5, 90+1) || _patches.servint_trains == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
596 |
(IS_INT_INSIDE(_patches.servint_roadveh, 5, 90+1) || _patches.servint_roadveh == 0) && |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
597 |
(IS_INT_INSIDE(_patches.servint_aircraft, 5, 90+1) || _patches.servint_aircraft == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
598 |
(IS_INT_INSIDE(_patches.servint_ships, 5, 90+1) || _patches.servint_ships == 0) ); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
599 |
} else { |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
600 |
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 30, 800+1) || _patches.servint_trains == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
601 |
(IS_INT_INSIDE(_patches.servint_roadveh, 30, 800+1) || _patches.servint_roadveh == 0) && |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
602 |
(IS_INT_INSIDE(_patches.servint_aircraft, 30, 800+1) || _patches.servint_aircraft == 0) && |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
603 |
(IS_INT_INSIDE(_patches.servint_ships, 30, 800+1) || _patches.servint_ships == 0) ); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
604 |
} |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
605 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
606 |
if (!warning) |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
607 |
ShowErrorMessage(-1, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
608 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
609 |
return InValidateDetailsWindow(0); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
610 |
} |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
155
diff
changeset
|
611 |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
612 |
typedef int32 PatchButtonClick(int32); |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
613 |
|
0 | 614 |
typedef struct PatchEntry { |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
615 |
byte type; // type of selector |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
616 |
byte flags; // selector flags |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
617 |
StringID str; // string with descriptive text |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
618 |
char console_name[40]; // the name this patch has in console |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
619 |
void *variable; // pointer to the variable |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
620 |
int32 min,max; // range for spinbox setting |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
621 |
uint32 step; // step for spinbox |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
622 |
PatchButtonClick *click_proc; // callback procedure |
0 | 623 |
} PatchEntry; |
624 |
||
625 |
enum { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
626 |
PE_BOOL = 0, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
627 |
PE_UINT8 = 1, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
628 |
PE_INT16 = 2, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
629 |
PE_UINT16 = 3, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
630 |
PE_INT32 = 4, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
631 |
PE_CURRENCY = 5, |
0 | 632 |
|
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
633 |
PF_0ISDIS = 1 << 0, |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
634 |
PF_NOCOMMA = 1 << 1, |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
635 |
PF_MULTISTRING = 1 << 2, |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
636 |
PF_PLAYERBASED = 1 << 3, // This has to match the entries that are in settings.c, patch_player_settings |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
637 |
PF_NETWORK_ONLY = 1 << 4, // this setting only applies to network games |
0 | 638 |
}; |
639 |
||
640 |
static const PatchEntry _patches_ui[] = { |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
641 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_VEHICLESPEED, "vehicle_speed", &_patches.vehicle_speed, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
642 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_LONGDATE, "long_date", &_patches.status_long_date, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
643 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_SHOWFINANCES, "show_finances", &_patches.show_finances, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
644 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_AUTOSCROLL, "autoscroll", &_patches.autoscroll, 0, 0, 0, NULL}, |
0 | 645 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
646 |
{PE_UINT8, PF_PLAYERBASED, STR_CONFIG_PATCHES_ERRMSG_DURATION, "errmsg_duration", &_patches.errmsg_duration, 0, 20, 1, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
647 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
648 |
{PE_UINT8, PF_MULTISTRING | PF_PLAYERBASED, STR_CONFIG_PATCHES_TOOLBAR_POS, "toolbar_pos", &_patches.toolbar_pos, 0, 2, 1, &v_PositionMainToolbar}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
649 |
{PE_UINT8, PF_0ISDIS | PF_PLAYERBASED, STR_CONFIG_PATCHES_SNAP_RADIUS, "window_snap_radius", &_patches.window_snap_radius, 1, 32, 1, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
650 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_INVISIBLE_TREES, "invisible_trees", &_patches.invisible_trees, 0, 1, 1, &InvisibleTreesActive}, |
835
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
833
diff
changeset
|
651 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_POPULATION_IN_LABEL, "population_in_label", &_patches.population_in_label, 0, 1, 1, &PopulationInLabelActive}, |
1218 | 652 |
|
653 |
{PE_INT32, 0, STR_CONFIG_PATCHES_MAP_X, "map_x", &_patches.map_x, 6, 11, 1, NULL}, |
|
654 |
{PE_INT32, 0, STR_CONFIG_PATCHES_MAP_Y, "map_y", &_patches.map_y, 6, 11, 1, NULL}, |
|
0 | 655 |
}; |
656 |
||
657 |
static const PatchEntry _patches_construction[] = { |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
658 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_BUILDONSLOPES, "build_on_slopes", &_patches.build_on_slopes, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
659 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_EXTRADYNAMITE, "extra_dynamite", &_patches.extra_dynamite, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
660 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_LONGBRIDGES, "long_bridges", &_patches.longbridges, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
661 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SIGNALSIDE, "signal_side", &_patches.signal_side, 0, 0, 0, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
662 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
663 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SMALL_AIRPORTS, "always_small_airport", &_patches.always_small_airport, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
664 |
{PE_UINT8, PF_PLAYERBASED, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY, "drag_signals_density", &_patches.drag_signals_density, 1, 20, 1, NULL}, |
0 | 665 |
|
666 |
}; |
|
667 |
||
668 |
static const PatchEntry _patches_vehicles[] = { |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
669 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_REALISTICACCEL, "realistic_acceleration", &_patches.realistic_acceleration, 0, 0, 0, NULL}, |
1247 | 670 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_FORBID_90_DEG, "forbid_90_deg", &_patches.forbid_90_deg, 0, 0, 0, NULL}, |
671 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_MAMMOTHTRAINS, "mammoth_trains", &_patches.mammoth_trains, 0, 0, 0, NULL}, |
|
672 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_GOTODEPOT, "goto_depot", &_patches.gotodepot, 0, 0, 0, NULL}, |
|
673 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_ROADVEH_QUEUE, "roadveh_queue", &_patches.roadveh_queue, 0, 0, 0, NULL}, |
|
674 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_DEPOT_FINDING,"depot_finding", &_patches.new_depot_finding, 0, 0, 0, NULL}, |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
675 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_TRAIN_PATHFIND,"new_pathfinding", &_patches.new_pathfinding, 0, 0, 0, NULL}, |
1247 | 676 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL, "new_pathfinding_all", &_patches.new_pathfinding_all, 0, 0, 0, NULL}, |
0 | 677 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
678 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_WARN_INCOME_LESS, "train_income_warn", &_patches.train_income_warn, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
679 |
{PE_UINT8, PF_MULTISTRING | PF_PLAYERBASED, STR_CONFIG_PATCHES_ORDER_REVIEW, "order_review_system", &_patches.order_review_system,0,2, 1, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
680 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES, "never_expire_vehicles", &_patches.never_expire_vehicles,0,0,0, NULL}, |
0 | 681 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
682 |
{PE_UINT16, PF_0ISDIS | PF_PLAYERBASED, STR_CONFIG_PATCHES_LOST_TRAIN_DAYS, "lost_train_days", &_patches.lost_train_days, 180,720, 60, NULL}, |
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
683 |
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE,"autorenew", &_patches.autorenew, 0, 0, 0, NULL}, |
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
684 |
{PE_INT16, PF_PLAYERBASED, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, "autorenew_months", &_patches.autorenew_months, -12, 12, 1, NULL}, |
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
685 |
{PE_CURRENCY, PF_PLAYERBASED, STR_CONFIG_PATCHES_AUTORENEW_MONEY,"autorenew_money", &_patches.autorenew_money, 0, 2000000, 100000, NULL}, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
686 |
|
1282
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1249
diff
changeset
|
687 |
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_TRAINS, "max_trains", &_patches.max_trains, 0,5000, 50, NULL}, |
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1249
diff
changeset
|
688 |
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, "max_roadveh", &_patches.max_roadveh, 0,5000, 50, NULL}, |
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1249
diff
changeset
|
689 |
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, "max_aircraft", &_patches.max_aircraft, 0,5000, 50, NULL}, |
ea2ae881814c
(svn r1786) -Fix: unitnumber is increased to 16bit, so now you can have up to 5000
truelight
parents:
1249
diff
changeset
|
690 |
{PE_UINT16, 0, STR_CONFIG_PATCHES_MAX_SHIPS, "max_ships", &_patches.max_ships, 0,5000, 50, NULL}, |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
691 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
692 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVINT_ISPERCENT,"servint_isperfect",&_patches.servint_ispercent, 0, 0, 0, &CheckInterval}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
693 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_TRAINS, "servint_trains", &_patches.servint_trains, 5,800, 5, &InValidateDetailsWindow}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
694 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_ROADVEH, "servint_roadveh", &_patches.servint_roadveh, 5,800, 5, &InValidateDetailsWindow}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
695 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, "servint_aircraft", &_patches.servint_aircraft, 5,800, 5, &InValidateDetailsWindow}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
696 |
{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_SHIPS, "servint_ships", &_patches.servint_ships, 5,800, 5, &InValidateDetailsWindow}, |
1037
4fbbb01cf87b
(svn r1538) -Feature: [988816] Disable servicing when breakdowns set to none (jaguar7)
darkvater
parents:
1031
diff
changeset
|
697 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NOSERVICE, "no_servicing_if_no_breakdowns", &_patches.no_servicing_if_no_breakdowns, 0, 0, 0, NULL}, |
0 | 698 |
}; |
699 |
||
700 |
static const PatchEntry _patches_stations[] = { |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
701 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_JOINSTATIONS, "join_stations", &_patches.join_stations, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
702 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_FULLLOADANY, "full_load_any", &_patches.full_load_any, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
703 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_IMPROVEDLOAD, "improved_load", &_patches.improved_load, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
704 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SELECTGOODS, "select_goods", &_patches.selectgoods, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
705 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NEW_NONSTOP, "new_nonstop", &_patches.new_nonstop, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
706 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_NONUNIFORM_STATIONS, "nonuniform_stations", &_patches.nonuniform_stations, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
707 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_STATION_SPREAD, "station_spread", &_patches.station_spread, 4, 64, 1, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
708 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SERVICEATHELIPAD, "service_at_helipad", &_patches.serviceathelipad, 0, 0, 0, NULL}, |
951
759ca1b993db
(svn r1441) Fixed a couple of warnings, and removed a pointless assert
celestar
parents:
930
diff
changeset
|
709 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_CATCHMENT, "modified_catchment", &_patches.modified_catchment, 0, 0, 0, NULL}, |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
546
diff
changeset
|
710 |
|
0 | 711 |
}; |
712 |
||
713 |
static const PatchEntry _patches_economy[] = { |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
714 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_INFLATION, "inflation", &_patches.inflation, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
715 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_BUILDXTRAIND, "build_rawmaterial", &_patches.build_rawmaterial_ind, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
716 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_MULTIPINDTOWN, "multiple_industry_per_town", &_patches.multiple_industry_per_town,0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
717 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SAMEINDCLOSE, "same_industry_close", &_patches.same_industry_close, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
718 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_BRIBE, "bribe", &_patches.bribe, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
719 |
{PE_UINT8, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, "snow_line_height", &_patches.snow_line_height, 2, 13, 1, NULL}, |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
720 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
721 |
{PE_INT32, PF_NOCOMMA, STR_CONFIG_PATCHES_COLORED_NEWS_DATE, "colored_new_data", &_patches.colored_news_date, 1900, 2200, 5, NULL}, |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
722 |
{PE_INT32, PF_NOCOMMA, STR_CONFIG_PATCHES_STARTING_DATE, "starting_date", &_patches.starting_date, MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, 1, NULL}, |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
723 |
{PE_INT32, PF_NOCOMMA | PF_NETWORK_ONLY, STR_CONFIG_PATCHES_ENDING_DATE, "ending_date", &_patches.ending_date, MAX_YEAR_BEGIN_REAL, MAX_YEAR_END_REAL, 1, NULL}, |
0 | 724 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
725 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, "smooth_economy", &_patches.smooth_economy, 0, 0, 0, NULL}, |
930
ab42e283749d
(svn r1418) -Feature: [1098254] (dis)Allow Shares. Add patch options to allow buying/selling of shares (Hackykid)
darkvater
parents:
915
diff
changeset
|
726 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_ALLOW_SHARES, "allow_shares", &_patches.allow_shares, 0, 0, 0, NULL}, |
0 | 727 |
}; |
728 |
||
21 | 729 |
static const PatchEntry _patches_ai[] = { |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
730 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AINEW_ACTIVE, "ainew_active", &_patches.ainew_active, 0, 1, 1, &AiNew_PatchActive_Warning}, |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
68
diff
changeset
|
731 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
732 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, "ai_disable_veh_train", &_patches.ai_disable_veh_train, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
733 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,"ai_disable_veh_roadveh",&_patches.ai_disable_veh_roadveh, 0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
734 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,"ai_disable_veh_aircraft",&_patches.ai_disable_veh_aircraft,0, 0, 0, NULL}, |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
735 |
{PE_BOOL, 0, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,"ai_disable_veh_ship",&_patches.ai_disable_veh_ship, 0, 0, 0, NULL}, |
21 | 736 |
}; |
737 |
||
0 | 738 |
typedef struct PatchPage { |
739 |
const PatchEntry *entries; |
|
740 |
uint num; |
|
741 |
} PatchPage; |
|
742 |
||
743 |
static const PatchPage _patches_page[] = { |
|
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
744 |
{_patches_ui, lengthof(_patches_ui) }, |
0 | 745 |
{_patches_construction, lengthof(_patches_construction) }, |
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
746 |
{_patches_vehicles, lengthof(_patches_vehicles) }, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
747 |
{_patches_stations, lengthof(_patches_stations) }, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
748 |
{_patches_economy, lengthof(_patches_economy) }, |
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
749 |
{_patches_ai, lengthof(_patches_ai) }, |
0 | 750 |
}; |
751 |
||
26 | 752 |
|
0 | 753 |
static int32 ReadPE(const PatchEntry*pe) |
754 |
{ |
|
755 |
switch(pe->type) { |
|
756 |
case PE_BOOL: return *(bool*)pe->variable; |
|
757 |
case PE_UINT8: return *(uint8*)pe->variable; |
|
758 |
case PE_INT16: return *(int16*)pe->variable; |
|
759 |
case PE_UINT16: return *(uint16*)pe->variable; |
|
760 |
case PE_INT32: return *(int32*)pe->variable; |
|
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
761 |
case PE_CURRENCY: return (*(int32*)pe->variable) * GetCurrentCurrencyRate(); |
0 | 762 |
default: |
763 |
NOT_REACHED(); |
|
764 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
765 |
|
0 | 766 |
/* useless, but avoids compiler warning this way */ |
767 |
return 0; |
|
768 |
} |
|
769 |
||
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
770 |
static void WritePE(const PatchEntry *pe, int32 val) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
771 |
{ |
48
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
772 |
|
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
773 |
if ((pe->flags & PF_0ISDIS) && val <= 0) { |
1031
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
774 |
// "clamp" 'disabled' value to smallest type |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
775 |
switch (pe->type) { |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
776 |
case PE_BOOL: case PE_UINT8: |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
777 |
*(bool*)pe->variable = 0; |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
778 |
break; |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
779 |
case PE_INT16: case PE_UINT16: |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
780 |
*(int16*)pe->variable = 0; |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
781 |
break; |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
782 |
case PE_CURRENCY: case PE_INT32: |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
783 |
*(int32*)pe->variable = 0; |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
784 |
break; |
f4d4ebab35d8
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
darkvater
parents:
1015
diff
changeset
|
785 |
} |
48
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
786 |
return; |
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
787 |
} |
20d80c99ef02
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
darkvater
parents:
47
diff
changeset
|
788 |
|
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
789 |
switch(pe->type) { |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
790 |
case PE_BOOL: *(bool*)pe->variable = (bool)val; break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
791 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
792 |
case PE_UINT8: if ((uint8)val > (uint8)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
793 |
*(uint8*)pe->variable = (uint8)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
794 |
else if ((uint8)val < (uint8)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
795 |
*(uint8*)pe->variable = (uint8)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
796 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
797 |
*(uint8*)pe->variable = (uint8)val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
798 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
799 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
800 |
case PE_INT16: if ((int16)val > (int16)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
801 |
*(int16*)pe->variable = (int16)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
802 |
else if ((int16)val < (int16)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
803 |
*(int16*)pe->variable = (int16)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
804 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
805 |
*(int16*)pe->variable = (int16)val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
806 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
807 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
808 |
case PE_UINT16: if ((uint16)val > (uint16)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
809 |
*(uint16*)pe->variable = (uint16)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
810 |
else if ((uint16)val < (uint16)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
811 |
*(uint16*)pe->variable = (uint16)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
812 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
813 |
*(uint16*)pe->variable = (uint16)val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
814 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
815 |
|
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
816 |
case PE_CURRENCY: |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
817 |
case PE_INT32: if ((int32)val > (int32)pe->max) |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
818 |
*(int32*)pe->variable = (int32)pe->max; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
819 |
else if ((int32)val < (int32)pe->min) |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
820 |
*(int32*)pe->variable = (int32)pe->min; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
821 |
else |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
822 |
*(int32*)pe->variable = val; |
20
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
823 |
break; |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
824 |
default: |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
825 |
NOT_REACHED(); |
13a47054d81e
(svn r21) Remove: PE_BYTE (bit-bools) in favour of PE_BOOL
truelight
parents:
17
diff
changeset
|
826 |
} |
0 | 827 |
} |
828 |
||
829 |
static void PatchesSelectionWndProc(Window *w, WindowEvent *e) |
|
830 |
{ |
|
831 |
uint i; |
|
832 |
switch(e->event) { |
|
833 |
case WE_PAINT: { |
|
834 |
int x,y; |
|
835 |
const PatchEntry *pe; |
|
836 |
const PatchPage *page; |
|
837 |
uint clk; |
|
838 |
int32 val; |
|
839 |
||
840 |
w->click_state = 1 << (WP(w,def_d).data_1 + 4); |
|
841 |
||
842 |
DrawWindowWidgets(w); |
|
843 |
||
844 |
x = 0; |
|
845 |
y = 46; |
|
846 |
clk = WP(w,def_d).data_2; |
|
847 |
page = &_patches_page[WP(w,def_d).data_1]; |
|
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
848 |
for (i = 0, pe = page->entries; i != page->num; i++, pe++) { |
11
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
849 |
bool disabled = false; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
850 |
bool editable = true; |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
851 |
|
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
852 |
if ((pe->flags & PF_NETWORK_ONLY) && !_networking) |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
853 |
editable = false; |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
854 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
855 |
// We do not allow changes of some items when we are a client in a networkgame |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
856 |
if (!(pe->flags & PF_PLAYERBASED) && _networking && !_network_server) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
857 |
editable = false; |
0 | 858 |
if (pe->type == PE_BOOL) { |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
859 |
if (editable) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
860 |
DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable)?6:4, (*(bool*)pe->variable)?0x20:0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
861 |
else |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
862 |
DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable)?7:9, (*(bool*)pe->variable)?0x20:0); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
863 |
SetDParam(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF); |
0 | 864 |
} else { |
865 |
DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, clk == i*2+1 ? 0x20 : 0); |
|
866 |
DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, clk == i*2+2 ? 0x20 : 0); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
867 |
if (!editable) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
868 |
int color = 0x8000 | _color_list[3].unk2; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
869 |
GfxFillRect(x+6, y+2, x+6+8, y+9, color); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
870 |
GfxFillRect(x+16, y+2, x+16+8, y+9, color); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
871 |
} |
0 | 872 |
DrawStringCentered(x+10, y+1, STR_6819, 0); |
873 |
DrawStringCentered(x+20, y+1, STR_681A, 0); |
|
874 |
||
875 |
val = ReadPE(pe); |
|
26 | 876 |
if (pe->type == PE_CURRENCY) |
877 |
val /= GetCurrentCurrencyRate(); |
|
11
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
878 |
disabled = ((val == 0) && (pe->flags & PF_0ISDIS)); |
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
879 |
if (disabled) { |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
880 |
SetDParam(0, STR_CONFIG_PATCHES_DISABLED); |
0 | 881 |
} else { |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
882 |
SetDParam(1, val); |
26 | 883 |
if (pe->type == PE_CURRENCY) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
884 |
SetDParam(0, STR_CONFIG_PATCHES_CURRENCY); |
53
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
885 |
else { |
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
886 |
if (pe->flags & PF_MULTISTRING) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
887 |
SetDParam(0, pe->str + val + 1); |
53
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
888 |
else |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
889 |
SetDParam(0, pe->flags & PF_NOCOMMA ? STR_CONFIG_PATCHES_INT32 : STR_7024); |
53
1e32a44e2e52
(svn r54) -Add: PF_MULTISTRING in Patch menu to select between things instead of numbers (Celestar)
truelight
parents:
48
diff
changeset
|
890 |
} |
0 | 891 |
} |
892 |
} |
|
11
836bc4b37b5b
(svn r12) Change: removed patch no_train_service. Instead you can set the default service interval for any vehicle type to 'disabled'.
dominik
parents:
0
diff
changeset
|
893 |
DrawString(30, y+1, (pe->str)+disabled, 0); |
0 | 894 |
y += 11; |
895 |
} |
|
896 |
break; |
|
897 |
} |
|
898 |
||
899 |
case WE_CLICK: |
|
900 |
switch(e->click.widget) { |
|
901 |
case 3: { |
|
902 |
int x,y; |
|
903 |
uint btn; |
|
904 |
const PatchPage *page; |
|
905 |
const PatchEntry *pe; |
|
906 |
||
907 |
y = e->click.pt.y - 46 - 1; |
|
908 |
if (y < 0) return; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
909 |
|
0 | 910 |
btn = y / 11; |
911 |
if (y % 11 > 9) return; |
|
912 |
||
913 |
page = &_patches_page[WP(w,def_d).data_1]; |
|
914 |
if (btn >= page->num) return; |
|
915 |
pe = &page->entries[btn]; |
|
916 |
||
917 |
x = e->click.pt.x - 5; |
|
918 |
if (x < 0) return; |
|
919 |
||
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
920 |
if (((pe->flags & PF_NETWORK_ONLY) && !_networking) || // return if action is only active in network |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
921 |
(!(pe->flags & PF_PLAYERBASED) && _networking && !_network_server)) // return if only server can change it |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
922 |
return; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
923 |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
924 |
if (x < 21) { // clicked on the icon on the left side. Either scroller or bool on/off |
0 | 925 |
int32 val = ReadPE(pe), oval = val; |
926 |
||
927 |
switch(pe->type) { |
|
928 |
case PE_BOOL: |
|
929 |
val ^= 1; |
|
930 |
break; |
|
931 |
case PE_UINT8: |
|
932 |
case PE_INT16: |
|
933 |
case PE_UINT16: |
|
934 |
case PE_INT32: |
|
26 | 935 |
case PE_CURRENCY: |
0 | 936 |
// don't allow too fast scrolling |
937 |
if ((w->flags4 & WF_TIMEOUT_MASK) > 2 << WF_TIMEOUT_SHL) { |
|
938 |
_left_button_clicked = false; |
|
939 |
return; |
|
940 |
} |
|
941 |
||
942 |
if (x >= 10) { |
|
943 |
//increase |
|
944 |
if (pe->flags & PF_0ISDIS && val == 0) |
|
945 |
val = pe->min; |
|
946 |
else |
|
947 |
val += pe->step; |
|
948 |
if (val > pe->max) val = pe->max; |
|
949 |
} else { |
|
47
8368e4d4ef07
(svn r48) Fix: Possible to disable some patches (e.g. default service interval) again by setting them to 0
dominik
parents:
46
diff
changeset
|
950 |
// decrease |
0 | 951 |
if (val <= pe->min && pe->flags & PF_0ISDIS) { |
952 |
val = 0; |
|
953 |
} else { |
|
954 |
val -= pe->step; |
|
955 |
if (val < pe->min) val = pe->min; |
|
956 |
} |
|
957 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
958 |
|
0 | 959 |
if (val != oval) { |
960 |
WP(w,def_d).data_2 = btn * 2 + 1 + ((x>=10) ? 1 : 0); |
|
961 |
w->flags4 |= 5 << WF_TIMEOUT_SHL; |
|
962 |
_left_button_clicked = false; |
|
963 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
964 |
break; |
0 | 965 |
} |
966 |
if (val != oval) { |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
967 |
// To make patch-changes network-safe |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
968 |
if (pe->type == PE_CURRENCY) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
969 |
val /= GetCurrentCurrencyRate(); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
970 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
971 |
// If an item is playerbased, we do not send it over the network (if any) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
972 |
if (pe->flags & PF_PLAYERBASED) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
973 |
WritePE(pe, val); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
974 |
} else { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
975 |
// Else we do |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
976 |
DoCommandP(0, (byte)WP(w,def_d).data_1 + ((byte)btn << 8), val, NULL, CMD_CHANGE_PATCH_SETTING); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
977 |
} |
0 | 978 |
SetWindowDirty(w); |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
979 |
|
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
980 |
if (pe->click_proc != NULL) // call callback function |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
981 |
pe->click_proc(val); |
0 | 982 |
} |
983 |
} else { |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
984 |
if (pe->type != PE_BOOL && !(pe->flags & PF_MULTISTRING)) { // do not open editbox |
0 | 985 |
WP(w,def_d).data_3 = btn; |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
523
diff
changeset
|
986 |
SetDParam(0, ReadPE(pe)); |
0 | 987 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, WC_GAME_OPTIONS, 0); |
988 |
} |
|
989 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
179
diff
changeset
|
990 |
|
0 | 991 |
break; |
992 |
} |
|
21 | 993 |
case 4: case 5: case 6: case 7: case 8: case 9: |
0 | 994 |
WP(w,def_d).data_1 = e->click.widget - 4; |
995 |
DeleteWindowById(WC_QUERY_STRING, 0); |
|
996 |
SetWindowDirty(w); |
|
997 |
break; |
|
998 |
} |
|
999 |
break; |
|
1000 |
||
1001 |
case WE_TIMEOUT: |
|
1002 |
WP(w,def_d).data_2 = 0; |
|
1003 |
SetWindowDirty(w); |
|
1004 |
break; |
|
1005 |
||
1006 |
case WE_ON_EDIT_TEXT: { |
|
1007 |
if (*e->edittext.str) { |
|
1008 |
const PatchPage *page = &_patches_page[WP(w,def_d).data_1]; |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
1009 |
const PatchEntry *pe = &page->entries[WP(w,def_d).data_3]; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1010 |
int32 val; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1011 |
val = atoi(e->edittext.str); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1012 |
if (pe->type == PE_CURRENCY) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1013 |
val /= GetCurrentCurrencyRate(); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1014 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1015 |
// If an item is playerbased, we do not send it over the network (if any) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1016 |
if (pe->flags & PF_PLAYERBASED) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1017 |
WritePE(pe, val); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1018 |
} else { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1019 |
// Else we do |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1020 |
DoCommandP(0, (byte)WP(w,def_d).data_1 + ((byte)WP(w,def_d).data_3 << 8), val, NULL, CMD_CHANGE_PATCH_SETTING); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1021 |
} |
0 | 1022 |
SetWindowDirty(w); |
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
1023 |
|
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
1024 |
if (pe->click_proc != NULL) // call callback function |
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
67
diff
changeset
|
1025 |
pe->click_proc(*(int32*)pe->variable); |
0 | 1026 |
} |
1027 |
break; |
|
1028 |
} |
|
1029 |
||
1030 |
case WE_DESTROY: |
|
1031 |
DeleteWindowById(WC_QUERY_STRING, 0); |
|
1032 |
break; |
|
1033 |
} |
|
1034 |
} |
|
1035 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1036 |
int32 CmdChangePatchSetting(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1037 |
{ |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1038 |
const PatchPage *page; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1039 |
const PatchEntry *pe; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1040 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1041 |
if (flags & DC_EXEC) { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1042 |
page = &_patches_page[(byte)p1]; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1043 |
if (page == NULL) return 0; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1044 |
pe = &page->entries[(byte)(p1 >> 8)]; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1045 |
if (pe == NULL) return 0; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1046 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1047 |
WritePE(pe, (int32)p2); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1048 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1049 |
InvalidateWindow(WC_GAME_OPTIONS, 0); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1050 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1051 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1052 |
return 0; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1053 |
} |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1054 |
|
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1055 |
/* Those 2 functions need to be here, else we have to make some stuff non-static |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1056 |
and besides, it is also better to keep stuff like this at the same place */ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1057 |
void ConsoleSetPatchSetting(char *name, char *value) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1058 |
{ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1059 |
const PatchPage *page; |
631
5b3eb9bec105
(svn r1062) -Fix: [Console] Compile warnigs in Get/SetPatchSettings
truelight
parents:
629
diff
changeset
|
1060 |
const PatchEntry *pe = NULL; |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1061 |
bool found = false; |
959
e6a3bbda610f
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
951
diff
changeset
|
1062 |
uint i; |
639
d73860ba9ae3
(svn r1072) Fixed a few warnings that made trouble in VS .NET 2003
dominik
parents:
631
diff
changeset
|
1063 |
unsigned int j; |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1064 |
int val; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1065 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1066 |
/* Search for the name in the patch-settings */ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1067 |
for (i = 0; i < lengthof(_patches_page); i++) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1068 |
page = &_patches_page[i]; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1069 |
for (j = 0; j < page->num; j++) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1070 |
pe = &page->entries[j]; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1071 |
if (strncmp(pe->console_name, name, sizeof(pe->console_name)) == 0) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1072 |
/* We found the name */ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1073 |
found = true; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1074 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1075 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1076 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1077 |
if (found) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1078 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1079 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1080 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1081 |
/* We did not found the patch setting */ |
631
5b3eb9bec105
(svn r1062) -Fix: [Console] Compile warnigs in Get/SetPatchSettings
truelight
parents:
629
diff
changeset
|
1082 |
if (!found || pe == NULL) { |
629
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
625
diff
changeset
|
1083 |
IConsolePrintF(_iconsole_color_warning, "'%s' is an unkown patch setting", name); |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1084 |
return; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1085 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1086 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1087 |
val = atoi(value); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1088 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1089 |
if (pe->type == PE_CURRENCY) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1090 |
val /= GetCurrentCurrencyRate(); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1091 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1092 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1093 |
// If an item is playerbased, we do not send it over the network (if any) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1094 |
if (pe->flags & PF_PLAYERBASED) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1095 |
WritePE(pe, val); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1096 |
} else { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1097 |
// Else we do |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1098 |
DoCommandP(0, i + (j << 8), val, NULL, CMD_CHANGE_PATCH_SETTING); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1099 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1100 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1101 |
switch(pe->type) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1102 |
case PE_BOOL: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1103 |
if (val == 1) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1104 |
snprintf(value, sizeof(value), "enabled"); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1105 |
else |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1106 |
snprintf(value, sizeof(value), "disabled"); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1107 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1108 |
default: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1109 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1110 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1111 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1112 |
IConsolePrintF(_iconsole_color_warning, "'%s' changed in:", name); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1113 |
IConsolePrintF(_iconsole_color_warning, " '%s'", value); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1114 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1115 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1116 |
void ConsoleGetPatchSetting(char *name) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1117 |
{ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1118 |
const PatchPage *page; |
631
5b3eb9bec105
(svn r1062) -Fix: [Console] Compile warnigs in Get/SetPatchSettings
truelight
parents:
629
diff
changeset
|
1119 |
const PatchEntry *pe = NULL; |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1120 |
char value[50]; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1121 |
bool found = false; |
959
e6a3bbda610f
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
951
diff
changeset
|
1122 |
uint i; |
639
d73860ba9ae3
(svn r1072) Fixed a few warnings that made trouble in VS .NET 2003
dominik
parents:
631
diff
changeset
|
1123 |
unsigned int j; |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1124 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1125 |
/* Search for the name in the patch-settings */ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1126 |
for (i = 0; i < lengthof(_patches_page); i++) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1127 |
page = &_patches_page[i]; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1128 |
for (j = 0; j < page->num; j++) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1129 |
pe = &page->entries[j]; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1130 |
if (strncmp(pe->console_name, name, sizeof(pe->console_name)) == 0) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1131 |
/* We found the name */ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1132 |
found = true; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1133 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1134 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1135 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1136 |
if (found) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1137 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1138 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1139 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1140 |
/* We did not found the patch setting */ |
631
5b3eb9bec105
(svn r1062) -Fix: [Console] Compile warnigs in Get/SetPatchSettings
truelight
parents:
629
diff
changeset
|
1141 |
if (!found || pe == NULL) { |
629
4bb1f0fb0109
(svn r1059) -Fix: [Console] Renamed 'set port' to 'set server_port'
truelight
parents:
625
diff
changeset
|
1142 |
IConsolePrintF(_iconsole_color_warning, "'%s' is an unkown patch setting", name); |
625
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1143 |
return; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1144 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1145 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1146 |
/* 'pe' is now the correct patch setting */ |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1147 |
switch(pe->type) { |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1148 |
case PE_BOOL: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1149 |
if (ReadPE(pe) == 1) |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1150 |
snprintf(value, sizeof(value), "enabled"); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1151 |
else |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1152 |
snprintf(value, sizeof(value), "disabled"); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1153 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1154 |
case PE_UINT8: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1155 |
case PE_INT16: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1156 |
case PE_UINT16: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1157 |
case PE_INT32: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1158 |
case PE_CURRENCY: |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1159 |
snprintf(value, sizeof(value), "%d", ReadPE(pe)); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1160 |
break; |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1161 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1162 |
|
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1163 |
IConsolePrintF(_iconsole_color_warning, "Current value for '%s' is:", name); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1164 |
IConsolePrintF(_iconsole_color_warning, " '%s'", value); |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1165 |
} |
40c83b088bb8
(svn r1055) -Add: [Console] Special for dedicated servers:
truelight
parents:
579
diff
changeset
|
1166 |
|
0 | 1167 |
static const Widget _patches_selection_widgets[] = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1168 |
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1169 |
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1170 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1171 |
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 320, 0x0, STR_NULL}, |
0 | 1172 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1173 |
{ WWT_CLOSEBOX, RESIZE_NONE, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1174 |
{ WWT_CLOSEBOX, RESIZE_NONE, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1175 |
{ WWT_CLOSEBOX, RESIZE_NONE, 3, 184, 270, 16, 27, STR_CONFIG_PATCHES_VEHICLES, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1176 |
{ WWT_CLOSEBOX, RESIZE_NONE, 3, 271, 357, 16, 27, STR_CONFIG_PATCHES_STATIONS, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1177 |
{ WWT_CLOSEBOX, RESIZE_NONE, 3, 10, 96, 28, 39, STR_CONFIG_PATCHES_ECONOMY, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1178 |
{ WWT_CLOSEBOX, 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
|
1179 |
{ WIDGETS_END}, |
0 | 1180 |
}; |
1181 |
||
1182 |
static const WindowDesc _patches_selection_desc = { |
|
1183 |
WDP_CENTER, WDP_CENTER, 370, 321, |
|
1184 |
WC_GAME_OPTIONS,0, |
|
1185 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1186 |
_patches_selection_widgets, |
|
1187 |
PatchesSelectionWndProc, |
|
1188 |
}; |
|
1189 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1190 |
void ShowPatchesSelection(void) |
0 | 1191 |
{ |
1192 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
|
1193 |
AllocateWindowDesc(&_patches_selection_desc); |
|
1194 |
} |
|
478
3a161108a15d
(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
|
1195 |
|
1477 | 1196 |
GRFFile *_sel_grffile; |
478
3a161108a15d
(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
|
1197 |
|
484 | 1198 |
enum { |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1199 |
NEWGRF_WND_PROC_OFFSET_TOP_WIDGET = 14, |
484 | 1200 |
NEWGRF_WND_PROC_ROWSIZE = 14 |
1201 |
}; |
|
478
3a161108a15d
(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
|
1202 |
|
3a161108a15d
(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
|
1203 |
static void NewgrfWndProc(Window *w, WindowEvent *e) |
3a161108a15d
(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
|
1204 |
{ |
484 | 1205 |
switch (e->event) { |
478
3a161108a15d
(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
|
1206 |
case WE_PAINT: { |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1207 |
int x, y = NEWGRF_WND_PROC_OFFSET_TOP_WIDGET; |
484 | 1208 |
uint16 i = 0; |
1477 | 1209 |
GRFFile *c = _first_grffile; |
478
3a161108a15d
(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
|
1210 |
|
3a161108a15d
(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
|
1211 |
DrawWindowWidgets(w); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1212 |
|
484 | 1213 |
if (_first_grffile == NULL) { // no grf sets installed |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1214 |
DrawStringMultiCenter(140, 210, STR_NEWGRF_NO_FILES_INSTALLED, 250); |
478
3a161108a15d
(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
|
1215 |
break; |
3a161108a15d
(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
|
1216 |
} |
3a161108a15d
(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
|
1217 |
|
3a161108a15d
(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
|
1218 |
// draw list of all grf files |
484 | 1219 |
while (c != NULL) { |
1220 |
if (i >= w->vscroll.pos) { // draw files according to scrollbar position |
|
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1221 |
bool h = (_sel_grffile==c); |
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1222 |
// show highlighted item with a different background and highlighted text |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1223 |
if(h) GfxFillRect(1, y + 1, 267, y + 12, 156); |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1224 |
// XXX - will be grf name later |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1225 |
DoDrawString(c->filename, 25, y + 2, h ? 0xC : 0x10); |
579
e977d17c89b1
(svn r999) New icons for the network interface, newgrf gui and the tiny euro
dominik
parents:
568
diff
changeset
|
1226 |
DrawSprite(SPRITE_PALETTE(SPR_SQUARE | 0x30b8000), 5, y + 2); |
484 | 1227 |
y += NEWGRF_WND_PROC_ROWSIZE; |
478
3a161108a15d
(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
|
1228 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1229 |
|
484 | 1230 |
c = c->next; |
1231 |
if (++i == w->vscroll.cap + w->vscroll.pos) break; // stop after displaying 12 items |
|
478
3a161108a15d
(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
|
1232 |
} |
3a161108a15d
(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
|
1233 |
|
3a161108a15d
(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
|
1234 |
// DoDrawString(_sel_grffile->setname, 120, 200, 0x01); // draw grf name |
3a161108a15d
(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
|
1235 |
|
484 | 1236 |
if (_sel_grffile == NULL) { // no grf file selected yet |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1237 |
DrawStringMultiCenter(140, 210, STR_NEWGRF_TIP, 250); |
478
3a161108a15d
(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
|
1238 |
} else { |
3a161108a15d
(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
|
1239 |
// draw filename |
484 | 1240 |
x = DrawString(5, 199, STR_NEWGRF_FILENAME, 0); |
1241 |
DoDrawString(_sel_grffile->filename, x + 2, 199, 0x01); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
1242 |
|
478
3a161108a15d
(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
|
1243 |
// draw grf id |
484 | 1244 |
x = DrawString(5, 209, STR_NEWGRF_GRF_ID, 0); |
486
e81a0c19c503
(svn r768) In the NewGRF manager, show GRF ids as 8-digit hex numbers (that's how they are supposed to look).
pasky
parents:
484
diff
changeset
|
1245 |
snprintf(_userstring, USERSTRING_LEN, "%08X", _sel_grffile->grfid); |
e81a0c19c503
(svn r768) In the NewGRF manager, show GRF ids as 8-digit hex numbers (that's how they are supposed to look).
pasky
parents:
484
diff
changeset
|
1246 |
DrawString(x + 2, 209, STR_SPEC_USERSTRING, 0x01); |
478
3a161108a15d
(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
|
1247 |
} |
484 | 1248 |
} break; |
478
3a161108a15d
(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
|
1249 |
|
3a161108a15d
(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
|
1250 |
case WE_CLICK: |
3a161108a15d
(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
|
1251 |
switch(e->click.widget) { |
982
d3ce4d6a65f8
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
970
diff
changeset
|
1252 |
case 3: { // select a grf file |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1253 |
int y = (e->click.pt.y - NEWGRF_WND_PROC_OFFSET_TOP_WIDGET) / NEWGRF_WND_PROC_ROWSIZE; |
478
3a161108a15d
(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
|
1254 |
|
484 | 1255 |
if (y >= w->vscroll.cap) { return;} // click out of bounds |
478
3a161108a15d
(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
|
1256 |
|
484 | 1257 |
y += w->vscroll.pos; |
1258 |
||
478
3a161108a15d
(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
|
1259 |
if (y >= _grffile_count) return; |
3a161108a15d
(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
|
1260 |
|
3a161108a15d
(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
|
1261 |
_sel_grffile = _first_grffile; |
484 | 1262 |
// get selected grf-file |
1263 |
while (y-- != 0) _sel_grffile = _sel_grffile->next; |
|
1264 |
||
478
3a161108a15d
(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
|
1265 |
SetWindowDirty(w); |
484 | 1266 |
} break; |
1267 |
case 9: /* Cancel button */ |
|
478
3a161108a15d
(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
|
1268 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
3a161108a15d
(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
|
1269 |
break; |
3a161108a15d
(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
|
1270 |
} break; |
3a161108a15d
(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
|
1271 |
|
3a161108a15d
(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
|
1272 |
/* Parameter edit box not used yet |
3a161108a15d
(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
|
1273 |
case WE_TIMEOUT: |
3a161108a15d
(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
|
1274 |
WP(w,def_d).data_2 = 0; |
3a161108a15d
(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
|
1275 |
SetWindowDirty(w); |
3a161108a15d
(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
|
1276 |
break; |
3a161108a15d
(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
|
1277 |
|
3a161108a15d
(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
|
1278 |
case WE_ON_EDIT_TEXT: { |
3a161108a15d
(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
|
1279 |
if (*e->edittext.str) { |
3a161108a15d
(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
|
1280 |
SetWindowDirty(w); |
3a161108a15d
(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
|
1281 |
} |
3a161108a15d
(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
|
1282 |
break; |
3a161108a15d
(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
|
1283 |
} |
3a161108a15d
(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
|
1284 |
*/ |
3a161108a15d
(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
|
1285 |
case WE_DESTROY: |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1286 |
_sel_grffile = NULL; |
478
3a161108a15d
(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
|
1287 |
DeleteWindowById(WC_QUERY_STRING, 0); |
3a161108a15d
(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
|
1288 |
break; |
3a161108a15d
(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
|
1289 |
} |
3a161108a15d
(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
|
1290 |
} |
3a161108a15d
(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
|
1291 |
|
3a161108a15d
(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
|
1292 |
static const Widget _newgrf_widgets[] = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1293 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1294 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 279, 0, 13, STR_NEWGRF_SETTINGS_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1295 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 279, 183, 276, 0x0, STR_NULL}, |
478
3a161108a15d
(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
|
1296 |
|
982
d3ce4d6a65f8
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
970
diff
changeset
|
1297 |
{ WWT_MATRIX, RESIZE_NONE, 14, 0, 267, 14, 182, 0xC01,/*small rows*/ STR_NEWGRF_TIP}, |
893
f4698309dec7
(svn r1379) -Fix: various GUI glitches. Added default sizes to various widgets. Sticky/Resize- and Scrollbar must be 11 pixels wide, Horizontal scrollbar 11 pixels high, caption must be 13 pixels. I hope I didn't forget any widgets, the game will assert for that so report them to me!
darkvater
parents:
871
diff
changeset
|
1298 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 268, 279, 14, 182, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
478
3a161108a15d
(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
|
1299 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1300 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 147, 158, 244, 255, STR_0188, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1301 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 159, 170, 244, 255, STR_0189, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1302 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 175, 274, 244, 255, STR_NEWGRF_SET_PARAMETERS, STR_NULL}, |
484 | 1303 |
|
1015
3629f5e8c092
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
998
diff
changeset
|
1304 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 5, 138, 261, 272, STR_NEWGRF_APPLY_CHANGES, STR_NULL}, |
3629f5e8c092
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
998
diff
changeset
|
1305 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 142, 274, 261, 272, STR_012E_CANCEL, STR_NULL}, |
478
3a161108a15d
(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
|
1306 |
{ WIDGETS_END}, |
3a161108a15d
(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
|
1307 |
}; |
3a161108a15d
(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
|
1308 |
|
3a161108a15d
(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
|
1309 |
static const WindowDesc _newgrf_desc = { |
502
defb8fd8fc98
(svn r801) - re-enabled background highlighting in Newgrf GUI
dominik
parents:
486
diff
changeset
|
1310 |
WDP_CENTER, WDP_CENTER, 280, 277, |
478
3a161108a15d
(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
|
1311 |
WC_GAME_OPTIONS,0, |
1015
3629f5e8c092
(svn r1515) -Removed the 'close ALL windows' from the toolbar since shift+del does this.
darkvater
parents:
998
diff
changeset
|
1312 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
478
3a161108a15d
(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
|
1313 |
_newgrf_widgets, |
3a161108a15d
(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
|
1314 |
NewgrfWndProc, |
3a161108a15d
(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
|
1315 |
}; |
3a161108a15d
(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
|
1316 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1317 |
void ShowNewgrf(void) |
478
3a161108a15d
(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
|
1318 |
{ |
3a161108a15d
(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
|
1319 |
Window *w; |
3a161108a15d
(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
|
1320 |
DeleteWindowById(WC_GAME_OPTIONS, 0); |
3a161108a15d
(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
|
1321 |
w = AllocateWindowDesc(&_newgrf_desc); |
3a161108a15d
(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
|
1322 |
|
3a161108a15d
(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
|
1323 |
{ // little helper function to calculate _grffile_count |
3a161108a15d
(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
|
1324 |
// should be REMOVED once _grffile_count is calculated at loading |
1477 | 1325 |
GRFFile *c = _first_grffile; |
1326 |
||
484 | 1327 |
_grffile_count = 0; |
1328 |
while (c != NULL) { |
|
478
3a161108a15d
(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
|
1329 |
_grffile_count++; |
484 | 1330 |
c = c->next; |
478
3a161108a15d
(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
|
1331 |
} |
3a161108a15d
(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
|
1332 |
} |
3a161108a15d
(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
|
1333 |
|
3a161108a15d
(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
|
1334 |
w->vscroll.cap = 12; |
3a161108a15d
(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
|
1335 |
w->vscroll.count = _grffile_count; |
3a161108a15d
(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
|
1336 |
w->vscroll.pos = 0; |
3a161108a15d
(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
|
1337 |
w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7); |
3a161108a15d
(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
|
1338 |
} |
3a161108a15d
(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
|
1339 |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1340 |
/* state: 0 = none clicked, 0x01 = first clicked, 0x02 = second clicked */ |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1341 |
void DrawArrowButtons(int x, int y, int state) |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1342 |
{ |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1343 |
DrawFrameRect(x, y+1, x+9, y+9, 3, (state&0x01) ? 0x20 : 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1344 |
DrawFrameRect(x+10, y+1, x+19, y+9, 3, (state&0x02) ? 0x20 : 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1345 |
DrawStringCentered(x+5, y+1, STR_6819, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1346 |
DrawStringCentered(x+15, y+1, STR_681A, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1347 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1348 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1349 |
char str_separator[2]; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1350 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1351 |
static void CustCurrencyWndProc(Window *w, WindowEvent *e) |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1352 |
{ |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1353 |
switch (e->event) { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1354 |
case WE_PAINT: { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1355 |
int x=35, y=20, i=0; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1356 |
int clk = WP(w,def_d).data_1; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1357 |
DrawWindowWidgets(w); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1358 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1359 |
// exchange rate |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1360 |
DrawArrowButtons(10, y, (clk >> (i*2)) & 0x03); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1361 |
SetDParam(0, 1); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1362 |
SetDParam(1, 1); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1363 |
DrawString(x, y + 1, STR_CURRENCY_EXCHANGE_RATE, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1364 |
x = 35; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1365 |
y+=12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1366 |
i++; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1367 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1368 |
// separator |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1369 |
DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03)?0x20:0x00); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1370 |
x = DrawString(x, y + 1, STR_CURRENCY_SEPARATOR, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1371 |
DoDrawString(str_separator, x + 4, y + 1, 6); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1372 |
x = 35; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1373 |
y+=12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1374 |
i++; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1375 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1376 |
// prefix |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1377 |
DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03)?0x20:0x00); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1378 |
x = DrawString(x, y + 1, STR_CURRENCY_PREFIX, 0); |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1379 |
DoDrawString(_currency_specs[23].prefix, x + 4, y + 1, 6); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1380 |
x = 35; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1381 |
y+=12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1382 |
i++; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1383 |
|
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1384 |
// suffix |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1385 |
DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03)?0x20:0x00); |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1386 |
x = DrawString(x, y + 1, STR_CURRENCY_SUFFIX, 0); |
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1387 |
DoDrawString(_currency_specs[23].suffix, x + 4, y + 1, 6); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1388 |
x = 35; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1389 |
y+=12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1390 |
i++; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1391 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1392 |
// switch to euro |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1393 |
DrawArrowButtons(10, y, (clk >> (i*2)) & 0x03); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1394 |
SetDParam(0, _currency_specs[23].to_euro); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1395 |
DrawString(x, y + 1, (_currency_specs[23].to_euro)?STR_CURRENCY_SWITCH_TO_EURO:STR_CURRENCY_SWITCH_TO_EURO_NEVER, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1396 |
x = 35; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1397 |
y+=12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1398 |
i++; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1399 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1400 |
// Preview |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1401 |
y+=12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1402 |
SetDParam(0, 10000); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1403 |
DrawString(x, y + 1, STR_CURRENCY_PREVIEW, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1404 |
} break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1405 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1406 |
case WE_CLICK: { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1407 |
bool edittext = false; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1408 |
int line = (e->click.pt.y - 20)/12; |
776
5b14f0b1e6d3
(svn r1242) -Fix: fix some morhpos warnings (tokai)
darkvater
parents:
759
diff
changeset
|
1409 |
int len = 0; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1410 |
int x = e->click.pt.x; |
776
5b14f0b1e6d3
(svn r1242) -Fix: fix some morhpos warnings (tokai)
darkvater
parents:
759
diff
changeset
|
1411 |
StringID str = 0; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1412 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1413 |
switch ( line ) { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1414 |
case 0: // rate |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1415 |
if ( IS_INT_INSIDE(x, 10, 30) ) { // clicked buttons |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1416 |
if (x < 20) { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1417 |
_currency_specs[23].rate = max(1, _currency_specs[23].rate-1); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1418 |
WP(w,def_d).data_1 = (1 << (line * 2 + 0)); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1419 |
} else { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1420 |
_currency_specs[23].rate = min(5000, _currency_specs[23].rate+1); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1421 |
WP(w,def_d).data_1 = (1 << (line * 2 + 1)); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1422 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1423 |
} else { // enter text |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1424 |
SetDParam(0, _currency_specs[23].rate); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1425 |
str = STR_CONFIG_PATCHES_INT32; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1426 |
len = 4; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1427 |
edittext = true; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1428 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1429 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1430 |
case 1: // separator |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1431 |
if ( IS_INT_INSIDE(x, 10, 30) ) // clicked button |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1432 |
WP(w,def_d).data_1 = (1 << (line * 2 + 1)); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1433 |
str = AllocateName(str_separator, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1434 |
len = 1; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1435 |
edittext = true; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1436 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1437 |
case 2: // prefix |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1438 |
if ( IS_INT_INSIDE(x, 10, 30) ) // clicked button |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1439 |
WP(w,def_d).data_1 = (1 << (line * 2 + 1)); |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1440 |
str = AllocateName(_currency_specs[23].prefix, 0); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1441 |
len = 12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1442 |
edittext = true; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1443 |
break; |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1444 |
case 3: // suffix |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1445 |
if ( IS_INT_INSIDE(x, 10, 30) ) // clicked button |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1446 |
WP(w,def_d).data_1 = (1 << (line * 2 + 1)); |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1447 |
str = AllocateName(_currency_specs[23].suffix, 0); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1448 |
len = 12; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1449 |
edittext = true; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1450 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1451 |
case 4: // to euro |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1452 |
if ( IS_INT_INSIDE(x, 10, 30) ) { // clicked buttons |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1453 |
if (x < 20) { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1454 |
if(_currency_specs[23].to_euro <= 2000) _currency_specs[23].to_euro = 0; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1455 |
else _currency_specs[23].to_euro--; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1456 |
WP(w,def_d).data_1 = (1 << (line * 2 + 0)); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1457 |
} else { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1458 |
if(_currency_specs[23].to_euro == 0) _currency_specs[23].to_euro = 2000; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1459 |
else _currency_specs[23].to_euro++; |
970
24abd02b1092
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
959
diff
changeset
|
1460 |
_currency_specs[23].to_euro = min(MAX_YEAR_END_REAL, _currency_specs[23].to_euro); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1461 |
WP(w,def_d).data_1 = (1 << (line * 2 + 1)); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1462 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1463 |
} else { // enter text |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1464 |
SetDParam(0, _currency_specs[23].to_euro); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1465 |
str = STR_CONFIG_PATCHES_INT32; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1466 |
len = 4; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1467 |
edittext = true; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1468 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1469 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1470 |
} |
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
1471 |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1472 |
if(edittext) { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1473 |
WP(w,def_d).data_2 = line; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1474 |
ShowQueryString( |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1475 |
str, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1476 |
STR_CURRENCY_CHANGE_PARAMETER, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1477 |
len, // maximum number of characters OR |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1478 |
250, // characters up to this width pixels, whichever is satisfied first |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1479 |
w->window_class, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1480 |
w->window_number); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1481 |
if (str != STR_CONFIG_PATCHES_INT32) DeleteName(str); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1482 |
} |
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
1483 |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1484 |
w->flags4 |= 5 << WF_TIMEOUT_SHL; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1485 |
SetWindowDirty(w); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1486 |
} break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1487 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1488 |
case WE_ON_EDIT_TEXT: { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1489 |
int val; |
1323
bac2e38e8b60
(svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents:
1317
diff
changeset
|
1490 |
const char *b = e->edittext.str; |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1491 |
switch (WP(w,def_d).data_2) { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1492 |
case 0: |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1493 |
val = atoi(b); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1494 |
val = clamp(val, 1, 5000); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1495 |
_currency_specs[23].rate = val; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1496 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1497 |
case 1: |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1498 |
_currency_specs[23].separator = b[0]; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1499 |
ttd_strlcpy(str_separator, b, 16); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1500 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1501 |
case 2: |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1502 |
ttd_strlcpy(_currency_specs[23].prefix, b, 16); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1503 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1504 |
case 3: |
788
951b52443d48
(svn r1255) Renamed "postfix" to "suffix", for strings and variable names
dominik
parents:
776
diff
changeset
|
1505 |
ttd_strlcpy(_currency_specs[23].suffix, b, 16); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1506 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1507 |
case 4: |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1508 |
val = atoi(b); |
970
24abd02b1092
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
darkvater
parents:
959
diff
changeset
|
1509 |
val = clamp(val, 1999, MAX_YEAR_END_REAL); |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1510 |
if (val == 1999) val = 0; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1511 |
_currency_specs[23].to_euro = val; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1512 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1513 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1514 |
MarkWholeScreenDirty(); |
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
1515 |
|
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
788
diff
changeset
|
1516 |
|
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1517 |
} break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1518 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1519 |
case WE_TIMEOUT: |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1520 |
WP(w,def_d).data_1 = 0; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1521 |
SetWindowDirty(w); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1522 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1523 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1524 |
case WE_DESTROY: |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1525 |
DeleteWindowById(WC_QUERY_STRING, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1526 |
MarkWholeScreenDirty(); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1527 |
break; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1528 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1529 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1530 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1531 |
static const Widget _cust_currency_widgets[] = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1532 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1533 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 229, 0, 13, STR_CURRENCY_WINDOW, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
1534 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 229, 14, 119, 0x0, STR_NULL}, |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1535 |
{ WIDGETS_END}, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1536 |
}; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1537 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1538 |
static const WindowDesc _cust_currency_desc = { |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1539 |
WDP_CENTER, WDP_CENTER, 230, 120, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1540 |
WC_CUSTOM_CURRENCY, 0, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1541 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1542 |
_cust_currency_widgets, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1543 |
CustCurrencyWndProc, |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1544 |
}; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1545 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1037
diff
changeset
|
1546 |
void ShowCustCurrency(void) |
759
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1547 |
{ |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1548 |
Window *w; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1549 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1550 |
str_separator[0] = _currency_specs[23].separator; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1551 |
str_separator[1] = '\0'; |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1552 |
|
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1553 |
DeleteWindowById(WC_CUSTOM_CURRENCY, 0); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1554 |
w = AllocateWindowDesc(&_cust_currency_desc); |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1555 |
} |
a445474d7c21
(svn r1215) Feature: You can now make a custom currency by chosing "Custom..."
dominik
parents:
654
diff
changeset
|
1556 |