author | tron |
Wed, 05 Jan 2005 13:32:03 +0000 | |
changeset 900 | feed1801fd35 |
parent 896 | 09091d701195 |
child 909 | 81bc9ef93f50 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
449
diff
changeset
|
3 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
651
diff
changeset
|
4 |
#include "map.h" |
0 | 5 |
#include "window.h" |
6 |
#include "gui.h" |
|
7 |
#include "viewport.h" |
|
8 |
#include "gfx.h" |
|
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
288
diff
changeset
|
9 |
#include "sound.h" |
0 | 10 |
#include "command.h" |
11 |
#include "vehicle.h" |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
12 |
#include "station.h" |
0 | 13 |
|
14 |
static uint _cur_railtype; |
|
15 |
static bool _remove_button_clicked; |
|
16 |
static byte _build_depot_direction; |
|
411
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
17 |
static byte _waypoint_count=1; |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
18 |
static byte _cur_waypoint_type; |
0 | 19 |
|
20 |
struct { |
|
21 |
byte orientation; |
|
22 |
byte numtracks; |
|
23 |
byte platlength; |
|
24 |
bool dragdrop; |
|
25 |
} _railstation; |
|
26 |
||
27 |
||
28 |
static void HandleStationPlacement(uint start, uint end); |
|
29 |
static void ShowBuildTrainDepotPicker(); |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
30 |
static void ShowBuildWaypointPicker(); |
0 | 31 |
static void ShowStationBuilder(); |
32 |
||
33 |
typedef void OnButtonClick(Window *w); |
|
34 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
35 |
void CcPlaySound1E(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 36 |
{ |
541 | 37 |
if (success) SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 38 |
} |
39 |
||
40 |
static void GenericPlaceRail(uint tile, int cmd) |
|
41 |
{ |
|
42 |
DoCommandP(tile, _cur_railtype, cmd, CcPlaySound1E, |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
43 |
_remove_button_clicked ? |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
44 |
CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) | CMD_AUTO | CMD_NO_WATER : |
0 | 45 |
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_AUTO | CMD_NO_WATER |
46 |
); |
|
47 |
} |
|
48 |
||
49 |
static void PlaceRail_N(uint tile) |
|
50 |
{ |
|
51 |
int cmd = _tile_fract_coords.x > _tile_fract_coords.y ? 4 : 5; |
|
52 |
GenericPlaceRail(tile, cmd); |
|
53 |
} |
|
54 |
||
55 |
static void PlaceRail_NE(uint tile) |
|
56 |
{ |
|
57 |
VpStartPlaceSizing(tile, VPM_FIX_Y); |
|
58 |
} |
|
59 |
||
60 |
static void PlaceRail_E(uint tile) |
|
61 |
{ |
|
62 |
int cmd = _tile_fract_coords.x + _tile_fract_coords.y <= 15 ? 2 : 3; |
|
63 |
GenericPlaceRail(tile, cmd); |
|
64 |
} |
|
65 |
||
66 |
static void PlaceRail_NW(uint tile) |
|
67 |
{ |
|
68 |
VpStartPlaceSizing(tile, VPM_FIX_X); |
|
69 |
} |
|
70 |
||
71 |
static void PlaceRail_AutoRail(uint tile) |
|
72 |
{ |
|
73 |
VpStartPlaceSizing(tile, VPM_RAILDIRS); |
|
74 |
} |
|
75 |
||
76 |
static void PlaceExtraDepotRail(uint tile, uint16 extra) |
|
77 |
{ |
|
78 |
byte b = _map5[tile]; |
|
79 |
||
80 |
if (b & 0xC0 || !(b & (extra >> 8))) |
|
81 |
return; |
|
82 |
||
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
83 |
DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_AUTO | CMD_NO_WATER); |
0 | 84 |
} |
85 |
||
86 |
static const uint16 _place_depot_extra[12] = { |
|
87 |
0x604, 0x2102, 0x1202, 0x505, |
|
88 |
0x2400, 0x2801, 0x1800, 0x1401, |
|
89 |
0x2203, 0x904, 0x0A05, 0x1103, |
|
90 |
}; |
|
91 |
||
92 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
93 |
void CcRailDepot(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 94 |
{ |
95 |
if (success) { |
|
96 |
int dir = p2; |
|
97 |
||
541 | 98 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 99 |
ResetObjectToPlace(); |
100 |
||
900 | 101 |
tile += TileOffsByDir(dir); |
0 | 102 |
|
103 |
if (IS_TILETYPE(tile, MP_RAILWAY)) { |
|
104 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir]); |
|
105 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]); |
|
106 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]); |
|
107 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
108 |
} |
0 | 109 |
} |
110 |
||
111 |
static void PlaceRail_Depot(uint tile) |
|
112 |
{ |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
113 |
DoCommandP(tile, _cur_railtype, _build_depot_direction, CcRailDepot, |
0 | 114 |
CMD_BUILD_TRAIN_DEPOT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_100E_CAN_T_BUILD_TRAIN_DEPOT)); |
115 |
} |
|
116 |
||
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
117 |
static void PlaceRail_Waypoint(uint tile) |
0 | 118 |
{ |
119 |
if (!_remove_button_clicked) { |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
120 |
DoCommandP(tile, _waypoint_count > 0 ? (0x100 + _cur_waypoint_type) : 0, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT)); |
0 | 121 |
} else { |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
122 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT)); |
0 | 123 |
} |
124 |
} |
|
125 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
126 |
void CcStation(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 127 |
{ |
128 |
if (success) { |
|
541 | 129 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 130 |
ResetObjectToPlace(); |
131 |
} |
|
132 |
} |
|
133 |
||
134 |
static void PlaceRail_Station(uint tile) |
|
135 |
{ |
|
136 |
if(_remove_button_clicked) |
|
137 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); |
|
138 |
else if (_railstation.dragdrop) { |
|
139 |
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED); |
|
140 |
VpSetPlaceSizingLimit(_patches.station_spread); |
|
141 |
} else { |
|
449
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
142 |
// TODO: Custom station selector GUI. Now we just try using first custom station |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
143 |
// (and fall back to normal stations if it isn't available). |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
144 |
DoCommandP(tile, _railstation.orientation | (_railstation.numtracks<<8) | (_railstation.platlength<<16),_cur_railtype|1<<4, CcStation, |
0 | 145 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
146 |
} |
|
147 |
} |
|
148 |
||
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
149 |
static void GenericPlaceSignals(uint tile) |
0 | 150 |
{ |
151 |
uint trackstat; |
|
152 |
int i; |
|
153 |
||
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
59
diff
changeset
|
154 |
trackstat = (byte)GetTileTrackStatus(tile, TRANSPORT_RAIL); |
0 | 155 |
|
156 |
if ((trackstat & 0x30) == 0x30) { |
|
157 |
trackstat = (_tile_fract_coords.x <= _tile_fract_coords.y) ? 0x20 : 0x10; |
|
158 |
} |
|
159 |
||
160 |
if ((trackstat & 0x0C) == 0x0C) { |
|
161 |
trackstat = (_tile_fract_coords.x + _tile_fract_coords.y <= 15) ? 4 : 8; |
|
162 |
} |
|
163 |
||
164 |
// Lookup the bit index |
|
165 |
i = 0; |
|
166 |
if (trackstat != 0) { while (!(trackstat & 1)) { i++; trackstat >>= 1; }} |
|
167 |
||
168 |
if (!_remove_button_clicked) { |
|
169 |
DoCommandP(tile, i + (_ctrl_pressed ? 8 : 0), 0, CcPlaySound1E, |
|
170 |
CMD_BUILD_SIGNALS | CMD_AUTO | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE)); |
|
171 |
} else { |
|
172 |
DoCommandP(tile, i, 0, CcPlaySound1E, |
|
173 |
CMD_REMOVE_SIGNALS | CMD_AUTO | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM)); |
|
174 |
} |
|
175 |
} |
|
176 |
||
177 |
static void PlaceRail_Bridge(uint tile) |
|
178 |
{ |
|
179 |
VpStartPlaceSizing(tile, VPM_X_OR_Y); |
|
180 |
} |
|
181 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
182 |
void CcBuildRailTunnel(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 183 |
{ |
184 |
if (success) { |
|
541 | 185 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 186 |
ResetObjectToPlace(); |
187 |
} else { |
|
188 |
SetRedErrorSquare(_build_tunnel_endtile); |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
static void PlaceRail_Tunnel(uint tile) |
|
193 |
{ |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
194 |
DoCommandP(tile, _cur_railtype, 0, CcBuildRailTunnel, |
0 | 195 |
CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE)); |
196 |
} |
|
197 |
||
198 |
void PlaceProc_BuyLand(uint tile) |
|
199 |
{ |
|
200 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND)); |
|
201 |
} |
|
202 |
||
203 |
static void PlaceRail_ConvertRail(uint tile) |
|
204 |
{ |
|
205 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | (1<<4)); |
|
206 |
} |
|
207 |
||
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
208 |
static void PlaceRail_AutoSignals(uint tile) |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
209 |
{ |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
210 |
VpStartPlaceSizing(tile, VPM_SIGNALDIRS); |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
211 |
} |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
212 |
|
0 | 213 |
static void BuildRailClick_N(Window *w) |
214 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
215 |
HandlePlacePushButton(w, 4, _cur_railtype*4 + 0x4EF, 1, PlaceRail_N); |
0 | 216 |
} |
217 |
||
218 |
static void BuildRailClick_NE(Window *w) |
|
219 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
220 |
HandlePlacePushButton(w, 5, _cur_railtype*4 + 0x4F0, 1, PlaceRail_NE); |
0 | 221 |
} |
222 |
||
223 |
static void BuildRailClick_E(Window *w) |
|
224 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
225 |
HandlePlacePushButton(w, 6, _cur_railtype*4 + 0x4F1, 1, PlaceRail_E); |
0 | 226 |
} |
227 |
||
228 |
static void BuildRailClick_NW(Window *w) |
|
229 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
230 |
HandlePlacePushButton(w, 7, _cur_railtype*4 + 0x4F2, 1, PlaceRail_NW); |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
231 |
} |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
232 |
|
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
233 |
static void BuildRailClick_AutoRail(Window *w) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
234 |
{ |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
235 |
HandlePlacePushButton(w, 8, _cur_railtype + SPR_OPENTTD_BASE + 4, 1, PlaceRail_AutoRail); |
0 | 236 |
} |
237 |
||
238 |
static void BuildRailClick_Demolish(Window *w) |
|
239 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
240 |
HandlePlacePushButton(w, 9, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea); |
0 | 241 |
} |
242 |
||
243 |
static const SpriteID _depot_cursors[] = { |
|
244 |
0x510, |
|
245 |
SPR_OPENTTD_BASE + 14, |
|
246 |
SPR_OPENTTD_BASE + 15, |
|
247 |
}; |
|
248 |
||
249 |
static void BuildRailClick_Depot(Window *w) |
|
250 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
251 |
if (HandlePlacePushButton(w, 10, _depot_cursors[_cur_railtype], 1, PlaceRail_Depot)) ShowBuildTrainDepotPicker(); |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
252 |
} |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
253 |
|
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
254 |
static void BuildRailClick_Waypoint(Window *w) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
255 |
{ |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
256 |
_waypoint_count = GetCustomStationsCount(STAT_CLASS_WAYP); |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
257 |
if (HandlePlacePushButton(w, 11, SPR_OPENTTD_BASE + 7, 1, PlaceRail_Waypoint) |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
258 |
&& _waypoint_count > 1) |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
259 |
ShowBuildWaypointPicker(); |
0 | 260 |
} |
261 |
||
262 |
static void BuildRailClick_Station(Window *w) |
|
263 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
264 |
if (HandlePlacePushButton(w, 12, 0x514, 1, PlaceRail_Station)) ShowStationBuilder(); |
0 | 265 |
} |
266 |
||
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
267 |
static void BuildRailClick_AutoSignals(Window *w) |
0 | 268 |
{ |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
269 |
HandlePlacePushButton(w, 13, ANIMCURSOR_BUILDSIGNALS , 1, PlaceRail_AutoSignals); |
0 | 270 |
} |
271 |
||
272 |
static void BuildRailClick_Bridge(Window *w) |
|
273 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
274 |
HandlePlacePushButton(w, 14, 0xA21, 1, PlaceRail_Bridge); |
0 | 275 |
} |
276 |
||
277 |
static void BuildRailClick_Tunnel(Window *w) |
|
278 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
279 |
HandlePlacePushButton(w, 15, 0x982 + _cur_railtype, 3, PlaceRail_Tunnel); |
0 | 280 |
} |
281 |
||
282 |
static void BuildRailClick_Remove(Window *w) |
|
283 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
284 |
if (w->disabled_state & (1<<16)) |
0 | 285 |
return; |
286 |
SetWindowDirty(w); |
|
541 | 287 |
SndPlayFx(SND_15_BEEP); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
288 |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
289 |
_thd.make_square_red = !!((w->click_state ^= (1 << 16)) & (1<<16)); |
514
7fb7b681f42d
(svn r829) Fix small glitch: Immediately redraw the tile selection square when using the hotkey to toggle removal
tron
parents:
507
diff
changeset
|
290 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
291 |
_remove_button_clicked = (w->click_state & (1 << 16)) != 0; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
292 |
|
0 | 293 |
// handle station builder |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
294 |
if( w->click_state & (1 << 16) ) |
0 | 295 |
{ |
296 |
if(_remove_button_clicked) |
|
297 |
SetTileSelectSize(1, 1); |
|
298 |
else |
|
299 |
BringWindowToFrontById(WC_BUILD_STATION, 0); |
|
300 |
} |
|
301 |
} |
|
302 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
303 |
static void BuildRailClick_Convert(Window *w) |
0 | 304 |
{ |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
305 |
HandlePlacePushButton(w, 17, (SPR_OPENTTD_BASE + 26) + _cur_railtype * 2, 1, PlaceRail_ConvertRail); |
0 | 306 |
} |
307 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
308 |
static void BuildRailClick_Landscaping(Window *w) |
0 | 309 |
{ |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
310 |
ShowTerraformToolbar(); |
0 | 311 |
} |
312 |
||
313 |
||
314 |
static void DoRailroadTrack(int mode) |
|
315 |
{ |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
316 |
DoCommandP(TILE_FROM_XY(_thd.selstart.x, _thd.selstart.y), PACK_POINT(_thd.selend.x, _thd.selend.y), (mode << 4) | _cur_railtype, NULL, |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
317 |
_remove_button_clicked ? |
0 | 318 |
CMD_REMOVE_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) : |
319 |
CMD_BUILD_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) |
|
320 |
); |
|
321 |
} |
|
322 |
||
323 |
typedef struct { |
|
324 |
byte bit, a,b, mouse; |
|
325 |
} BestFitStruct; |
|
326 |
||
327 |
#define M(d,m) (d << 6) | (m) |
|
328 |
static const BestFitStruct _bestfit[] = { |
|
329 |
// both edges have rail |
|
330 |
{2, M(0, 1+8), M(3, 2+8), 0}, // upper track |
|
331 |
{3, M(2, 1+4), M(1, 2+4), 0}, // lower track |
|
332 |
||
333 |
{4, M(2, 1+32), M(3, 2+32), 1<<2}, // left track |
|
334 |
{5, M(0, 1+16), M(1, 2+16), 1<<3}, // right track |
|
335 |
||
336 |
{0, M(0,1+8+16), M(2,1+4+32), 0}, // diag1 track |
|
337 |
{1, M(3,2+8+32), M(1,2+4+16), 0}, // diag2 track |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
338 |
|
0 | 339 |
// one edge with rail |
340 |
{0, M(0,1), 0, 0}, // diag1 track |
|
341 |
{0, M(2,1), 0, 0}, // diag1 track |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
342 |
|
0 | 343 |
{1, M(1,2), 0, 0}, // diag2 track |
344 |
{1, M(3,2), 0, 0}, // diag2 track |
|
345 |
||
346 |
{2, M(0,8), 0, 1<<0}, // upper track |
|
347 |
{2, M(3,8), 0, 1<<0}, // upper track |
|
348 |
||
349 |
{3, M(1,4), 0, 1<<1}, // lower track |
|
350 |
{3, M(2,4), 0, 1<<1}, // lower track |
|
351 |
||
352 |
{4, M(2,32), 0, 1<<2}, // left track |
|
353 |
{4, M(3,32), 0, 1<<2}, // left track |
|
354 |
||
355 |
{5, M(0,16), 0, 1<<3}, // right track |
|
356 |
{5, M(1,16), 0, 1<<3}, // right track |
|
357 |
||
179
003096efeb9d
(svn r180) -Fix: some more warning fixes for C99 (Tron)
darkvater
parents:
176
diff
changeset
|
358 |
{0xff, 0, 0, 0}, |
0 | 359 |
}; |
360 |
#undef M |
|
361 |
||
362 |
static int GetBestArea(int x, int y) |
|
363 |
{ |
|
364 |
int r = 0; |
|
365 |
if (x + y > 0x10) r += 2; |
|
366 |
else if (x + y == 0x10) return -1; |
|
367 |
if (y - x > 0) r += 1; |
|
368 |
else if (y - x == 0) return -1; |
|
369 |
return r; |
|
370 |
} |
|
371 |
||
410 | 372 |
static int GetBestFit1x1(int x, int y) |
0 | 373 |
{ |
374 |
byte m[5]; |
|
375 |
const BestFitStruct *bfs; |
|
376 |
byte mouse; |
|
377 |
uint tile; |
|
378 |
int best; |
|
379 |
int i; |
|
380 |
||
381 |
// determine the mouse regions |
|
382 |
mouse = ((x & 0xF) + (y & 0xF) < 0x10 ? 1 << 0 : 1 << 1) + |
|
383 |
((x & 0xF) > (y & 0xF) ? 1 << 2 : 1 << 3); |
|
384 |
||
385 |
// get the rail in each direction |
|
386 |
tile = TILE_FROM_XY(x,y); |
|
387 |
for(i=0; i!=5; i++) { |
|
388 |
static TileIndexDiff _tile_inc[5] = { |
|
389 |
TILE_XY(-1, 0), |
|
390 |
TILE_XY(0, 1) - TILE_XY(-1, 0), |
|
391 |
TILE_XY(1, 0) - TILE_XY(0, 1), |
|
392 |
TILE_XY(0, -1) - TILE_XY(1, 0), |
|
393 |
TILE_XY(0, 0) - TILE_XY(0, -1), |
|
394 |
}; |
|
395 |
tile += _tile_inc[i]; |
|
396 |
m[i] = 0; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
397 |
if (IS_TILETYPE(tile, MP_RAILWAY) && _map5[tile] < 0x80) |
0 | 398 |
m[i] = _map5[tile]&0x3F; |
399 |
||
400 |
// handle tracks under bridge |
|
401 |
if(IS_TILETYPE(tile, MP_TUNNELBRIDGE) && (_map5[tile]&0xF8)==0xE0) |
|
402 |
m[i] = (byte) !(_map5[tile]&0x01) + 1; |
|
403 |
||
404 |
if (_remove_button_clicked) m[i] ^= 0x3F; |
|
405 |
} |
|
406 |
||
407 |
// check "mouse gesture"? |
|
408 |
{ |
|
409 |
int a1,a2; |
|
410 |
if ((a1 = GetBestArea(x & 0xF, y & 0xF)) != -1 && (a2 = GetBestArea(_tile_fract_coords.x, _tile_fract_coords.y)) != -1 && a1 != a2) { |
|
411 |
static const byte _get_dir_by_areas[4][4] = { |
|
412 |
{0,2,4,1}, |
|
413 |
{2,0,0,5}, |
|
414 |
{4,0,0,3}, |
|
415 |
{1,5,3,0}, |
|
416 |
}; |
|
417 |
i = _get_dir_by_areas[a2][a1]; |
|
418 |
if (!HASBIT(m[4], i)) |
|
419 |
return i; |
|
420 |
} |
|
421 |
} |
|
422 |
// check each bestfit struct |
|
423 |
for(bfs = _bestfit, best=-1; bfs->bit != 0xFF; bfs++) { |
|
424 |
if ((bfs->a & m[bfs->a >> 6]) && (!bfs->b || bfs->b & m[bfs->b >> 6]) && !HASBIT(m[4], bfs->bit)) { |
|
425 |
if ( (byte)(~mouse & bfs->mouse) == 0) |
|
426 |
return bfs->bit; |
|
427 |
if (best != -1) |
|
428 |
return best; |
|
429 |
best = bfs->bit; |
|
430 |
} |
|
431 |
} |
|
432 |
||
433 |
return best; |
|
434 |
} |
|
435 |
||
436 |
static void SwapSelection() |
|
437 |
{ |
|
438 |
TileHighlightData *thd = &_thd; |
|
439 |
Point pt = thd->selstart; |
|
440 |
thd->selstart.x = thd->selend.x & ~0xF; |
|
441 |
thd->selstart.y = thd->selend.y & ~0xF; |
|
442 |
thd->selend = pt; |
|
443 |
} |
|
444 |
||
445 |
static bool Check2x1AutoRail(int mode) |
|
446 |
{ |
|
447 |
TileHighlightData *thd = &_thd; |
|
448 |
int fxpy = _tile_fract_coords.x + _tile_fract_coords.y; |
|
449 |
int sxpy = (thd->selend.x & 0xF) + (thd->selend.y & 0xF); |
|
450 |
int fxmy = _tile_fract_coords.x - _tile_fract_coords.y; |
|
451 |
int sxmy = (thd->selend.x & 0xF) - (thd->selend.y & 0xF); |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
452 |
|
0 | 453 |
switch(mode) { |
454 |
case 0: |
|
455 |
if (fxpy >= 20 && sxpy <= 12) { SwapSelection(); DoRailroadTrack(0); return true; } |
|
456 |
if (fxmy < -3 && sxmy > 3) { DoRailroadTrack(0); return true; } |
|
457 |
break; |
|
458 |
||
459 |
case 1: |
|
460 |
if (fxmy > 3 && sxmy < -3) { SwapSelection(); DoRailroadTrack(0); return true; } |
|
461 |
if (fxpy <= 12 && sxpy >= 20) { DoRailroadTrack(0); return true; } |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
462 |
break; |
0 | 463 |
|
464 |
case 2: |
|
465 |
if (fxmy > 3 && sxmy < -3) { DoRailroadTrack(3); return true; } |
|
466 |
if (fxpy >= 20 && sxpy <= 12) { SwapSelection(); DoRailroadTrack(0); return true; } |
|
467 |
break; |
|
468 |
||
469 |
case 3: |
|
470 |
if (fxmy < -3 && sxmy > 3) { SwapSelection(); DoRailroadTrack(3); return true; } |
|
471 |
if (fxpy <= 12 && sxpy >= 20) { DoRailroadTrack(0); return true; } |
|
472 |
break; |
|
473 |
} |
|
474 |
||
475 |
return false; |
|
476 |
} |
|
477 |
||
478 |
||
479 |
static void HandleAutodirPlacement() |
|
480 |
{ |
|
481 |
TileHighlightData *thd = &_thd; |
|
482 |
int bit; |
|
483 |
||
484 |
if (thd->drawstyle == HT_RECT) { |
|
485 |
int dx = thd->selstart.x - (thd->selend.x&~0xF); |
|
486 |
int dy = thd->selstart.y - (thd->selend.y&~0xF); |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
487 |
|
0 | 488 |
if (dx == 0 && dy == 0 ) { |
489 |
// 1x1 tile |
|
490 |
bit = GetBestFit1x1(thd->selend.x, thd->selend.y); |
|
491 |
if (bit == -1) return; |
|
492 |
GenericPlaceRail(TILE_FROM_XY(thd->selend.x, thd->selend.y), bit); |
|
493 |
} else if (dx == 0) { |
|
494 |
if (dy == -16) { |
|
495 |
if (Check2x1AutoRail(0)) return; |
|
496 |
} else if (dy == 16) { |
|
497 |
if (Check2x1AutoRail(1)) return; |
|
498 |
} |
|
499 |
// same x coordinate |
|
500 |
DoRailroadTrack(VPM_FIX_X); |
|
501 |
} else { |
|
502 |
// same y coordinate |
|
503 |
// check it's it -16 or 16, then we must check if it should be normal tiles or special tiles. |
|
504 |
if (dx == -16) { |
|
505 |
if (Check2x1AutoRail(2)) return; |
|
506 |
} else if (dx == 16) { |
|
507 |
if (Check2x1AutoRail(3)) return; |
|
508 |
} |
|
509 |
DoRailroadTrack(VPM_FIX_Y); |
|
510 |
} |
|
511 |
} else { |
|
512 |
DoRailroadTrack(thd->drawstyle & 1 ? 0 : 3); |
|
513 |
} |
|
514 |
} |
|
515 |
||
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
516 |
static void HandleAutoSignalPlacement() |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
517 |
{ |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
518 |
TileHighlightData *thd = &_thd; |
59
fb1a20aefeae
(svn r60) -Fix: signal_density is given as a parameter to autosignal. This means all players can define it for themselves.
darkvater
parents:
58
diff
changeset
|
519 |
int mode = 0; |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
520 |
uint trackstat = 0; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
521 |
|
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
522 |
int dx = thd->selstart.x - (thd->selend.x&~0xF); |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
523 |
int dy = thd->selstart.y - (thd->selend.y&~0xF); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
524 |
|
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
525 |
if (dx == 0 && dy == 0 ) // 1x1 tile signals |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
526 |
GenericPlaceSignals(TILE_FROM_XY(thd->selend.x, thd->selend.y)); |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
527 |
else { // signals have been dragged |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
528 |
if (thd->drawstyle == HT_RECT) { // X,Y direction |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
529 |
if (dx == 0) |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
530 |
mode = VPM_FIX_X; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
531 |
else if (dy == 0) |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
532 |
mode = VPM_FIX_Y; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
533 |
|
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
534 |
trackstat = 0xC0; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
535 |
} else { // W-E or N-S direction |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
536 |
mode = thd->drawstyle & 1 ? 0 : 3; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
537 |
|
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
538 |
if (dx == dy || abs(dx - dy) == 16) // North<->South track | |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
539 |
trackstat = (thd->drawstyle & 1) ? 0x20 : 0x10; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
540 |
else if (dx == -dy || abs(dx + dy) == 16) // East<->West track -- |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
541 |
trackstat = (thd->drawstyle & 1) ? 4 : 8; |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
542 |
} |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
543 |
|
59
fb1a20aefeae
(svn r60) -Fix: signal_density is given as a parameter to autosignal. This means all players can define it for themselves.
darkvater
parents:
58
diff
changeset
|
544 |
/* _patches.drag_signals_density is given as a parameter such that each user in a network |
fb1a20aefeae
(svn r60) -Fix: signal_density is given as a parameter to autosignal. This means all players can define it for themselves.
darkvater
parents:
58
diff
changeset
|
545 |
* game can specify his/her own signal density */ |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
546 |
DoCommandP(TILE_FROM_XY(thd->selstart.x, thd->selstart.y), TILE_FROM_XY(thd->selend.x, thd->selend.y), |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
547 |
(mode << 4) | (_remove_button_clicked + (_ctrl_pressed ? 8 : 0)) | (trackstat << 8) | (_patches.drag_signals_density << 24), |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
548 |
CcPlaySound1E, |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
549 |
(_remove_button_clicked ? CMD_BUILD_MANY_SIGNALS | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) : |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
550 |
CMD_BUILD_MANY_SIGNALS | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) ) ); |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
551 |
} |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
552 |
} |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
553 |
|
0 | 554 |
static OnButtonClick * const _build_railroad_button_proc[] = { |
555 |
BuildRailClick_N, |
|
556 |
BuildRailClick_NE, |
|
557 |
BuildRailClick_E, |
|
558 |
BuildRailClick_NW, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
559 |
BuildRailClick_AutoRail, |
0 | 560 |
BuildRailClick_Demolish, |
561 |
BuildRailClick_Depot, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
562 |
BuildRailClick_Waypoint, |
0 | 563 |
BuildRailClick_Station, |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
564 |
BuildRailClick_AutoSignals, |
0 | 565 |
BuildRailClick_Bridge, |
566 |
BuildRailClick_Tunnel, |
|
567 |
BuildRailClick_Remove, |
|
568 |
BuildRailClick_Convert, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
569 |
BuildRailClick_Landscaping, |
0 | 570 |
}; |
571 |
||
572 |
static const uint16 _rail_keycodes[] = { |
|
573 |
'1', |
|
574 |
'2', |
|
575 |
'3', |
|
576 |
'4', |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
577 |
'5', |
0 | 578 |
'6', |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
579 |
'7', // depot |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
580 |
'8', // waypoint |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
581 |
'9', // station |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
582 |
'S', // signals |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
583 |
'B', // bridge |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
584 |
'T', // tunnel |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
585 |
'R', // remove |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
586 |
'C', // convert rail |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
587 |
'L', // landscaping |
0 | 588 |
}; |
589 |
||
590 |
||
591 |
||
592 |
||
593 |
static void BuildRailToolbWndProc(Window *w, WindowEvent *e) |
|
594 |
{ |
|
595 |
switch(e->event) { |
|
596 |
case WE_PAINT: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
597 |
w->disabled_state &= ~(1 << 16); |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
598 |
if (!(w->click_state & ((1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<11)|(1<<12)|(1<<13)))) { |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
599 |
w->disabled_state |= (1 << 16); |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
600 |
w->click_state &= ~(1<<16); |
0 | 601 |
} |
602 |
DrawWindowWidgets(w); |
|
603 |
break; |
|
604 |
||
605 |
case WE_CLICK: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
606 |
if (e->click.widget >= 4) { |
0 | 607 |
_remove_button_clicked = false; |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
608 |
_build_railroad_button_proc[e->click.widget - 4](w); |
0 | 609 |
} |
610 |
break; |
|
611 |
||
612 |
case WE_KEYPRESS: { |
|
613 |
int i; |
|
616
3ab1124303e0
(svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik
parents:
606
diff
changeset
|
614 |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
615 |
for(i=0; i!=lengthof(_rail_keycodes); i++) { |
0 | 616 |
if (e->keypress.keycode == _rail_keycodes[i]) { |
617 |
e->keypress.cont = false; |
|
618 |
_remove_button_clicked = false; |
|
619 |
_build_railroad_button_proc[i](w); |
|
620 |
break; |
|
621 |
} |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
622 |
} |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
623 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 624 |
break; |
625 |
} |
|
626 |
||
627 |
case WE_PLACE_OBJ: |
|
628 |
_place_proc(e->place.tile); |
|
629 |
return; |
|
630 |
||
631 |
case WE_PLACE_DRAG: { |
|
632 |
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata & 0xF); |
|
633 |
return; |
|
634 |
} |
|
635 |
||
636 |
case WE_PLACE_MOUSEUP: |
|
637 |
if (e->click.pt.x != -1) { |
|
638 |
uint start_tile = e->place.starttile; |
|
639 |
uint end_tile = e->place.tile; |
|
640 |
||
641 |
if (e->place.userdata == VPM_X_OR_Y) { |
|
642 |
ResetObjectToPlace(); |
|
643 |
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype); |
|
644 |
} else if (e->place.userdata == VPM_RAILDIRS) { |
|
645 |
bool old = _remove_button_clicked; |
|
646 |
if (_ctrl_pressed) _remove_button_clicked = true; |
|
647 |
HandleAutodirPlacement(); |
|
648 |
_remove_button_clicked = old; |
|
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
649 |
} else if (e->place.userdata == VPM_SIGNALDIRS) { |
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
650 |
HandleAutoSignalPlacement(); |
0 | 651 |
} else if (e->place.userdata == VPM_X_AND_Y) { |
652 |
DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
|
653 |
} else if (e->place.userdata == (VPM_X_AND_Y | (1<<4))) { |
|
654 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); |
|
655 |
} else if (e->place.userdata == (VPM_X_AND_Y | (2<<4))) { |
|
656 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_LEVEL_LAND | CMD_AUTO); |
|
657 |
} else if (e->place.userdata == VPM_X_AND_Y_LIMITED) { |
|
658 |
HandleStationPlacement(start_tile, end_tile); |
|
659 |
} else { |
|
660 |
DoRailroadTrack(e->place.userdata); |
|
661 |
} |
|
662 |
} |
|
663 |
break; |
|
664 |
||
665 |
case WE_ABORT_PLACE_OBJ: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
666 |
UnclickWindowButtons(w); |
0 | 667 |
SetWindowDirty(w); |
668 |
||
669 |
w = FindWindowById(WC_BUILD_STATION, 0); |
|
670 |
if (w != NULL) WP(w,def_d).close=true; |
|
671 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
|
672 |
if (w != NULL) WP(w,def_d).close=true; |
|
673 |
break; |
|
674 |
||
675 |
case WE_PLACE_PRESIZE: { |
|
676 |
uint tile = e->place.tile; |
|
677 |
DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
|
678 |
VpSetPresizeRange(tile, _build_tunnel_endtile==0?tile:_build_tunnel_endtile); |
|
679 |
} break; |
|
680 |
} |
|
681 |
} |
|
682 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
683 |
|
0 | 684 |
static const Widget _build_railroad_widgets[] = { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
685 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
686 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
687 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 688 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
689 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
0 | 690 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
691 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, 0x4E3, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
692 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, 0x4E4, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
693 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, 0x4E5, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
694 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, 0x4E6, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
695 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_OPENTTD_BASE + 0, STR_BUILD_AUTORAIL_TIP}, |
0 | 696 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
697 |
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
698 |
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, 0x50E, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
699 |
{ WWT_PANEL, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_OPENTTD_BASE + 3, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
700 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
701 |
{ WWT_PANEL, RESIZE_NONE, 7, 180, 221, 14, 35, 0x512, STR_101A_BUILD_RAILROAD_STATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
702 |
{ WWT_PANEL, RESIZE_NONE, 7, 222, 243, 14, 35, 0x50B, STR_101B_BUILD_RAILROAD_SIGNALS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
703 |
{ WWT_PANEL, RESIZE_NONE, 7, 244, 285, 14, 35, 0xA22, STR_101C_BUILD_RAILROAD_BRIDGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
704 |
{ WWT_PANEL, RESIZE_NONE, 7, 286, 305, 14, 35, 0x97E, STR_101D_BUILD_RAILROAD_TUNNEL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
705 |
{ WWT_PANEL, RESIZE_NONE, 7, 306, 327, 14, 35, 0x2CA, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
706 |
{ WWT_PANEL, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_OPENTTD_BASE + 25, STR_CONVERT_RAIL_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
707 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
708 |
{ WWT_PANEL, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
0 | 709 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
710 |
{ WIDGETS_END}, |
0 | 711 |
}; |
712 |
||
713 |
static const WindowDesc _build_railroad_desc = { |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
714 |
640-372, 22, 372, 36, |
0 | 715 |
WC_BUILD_TOOLBAR,0, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
716 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 717 |
_build_railroad_widgets, |
718 |
BuildRailToolbWndProc |
|
719 |
}; |
|
720 |
||
721 |
static const Widget _build_monorail_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
722 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
723 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100B_MONORAIL_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
724 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 725 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
726 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
0 | 727 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
728 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, 0x4E7, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
729 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, 0x4E8, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
730 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, 0x4E9, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
731 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, 0x4EA, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
732 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_OPENTTD_BASE + 1, STR_BUILD_AUTORAIL_TIP}, |
0 | 733 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
734 |
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
735 |
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_OPENTTD_BASE + 12, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
736 |
{ WWT_PANEL, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_OPENTTD_BASE + 3, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
737 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
738 |
{ WWT_PANEL, RESIZE_NONE, 7, 180, 221, 14, 35, 0x512, STR_101A_BUILD_RAILROAD_STATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
739 |
{ WWT_PANEL, RESIZE_NONE, 7, 222, 243, 14, 35, 0x50B, STR_101B_BUILD_RAILROAD_SIGNALS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
740 |
{ WWT_PANEL, RESIZE_NONE, 7, 244, 285, 14, 35, 0xA22, STR_101C_BUILD_RAILROAD_BRIDGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
741 |
{ WWT_PANEL, RESIZE_NONE, 7, 286, 305, 14, 35, 0x97F, STR_101D_BUILD_RAILROAD_TUNNEL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
742 |
{ WWT_PANEL, RESIZE_NONE, 7, 306, 327, 14, 35, 0x2CA, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
743 |
{ WWT_PANEL, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_OPENTTD_BASE + 27, STR_CONVERT_RAIL_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
744 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
745 |
{ WWT_PANEL, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
746 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
747 |
{ WIDGETS_END}, |
0 | 748 |
}; |
749 |
||
750 |
static const WindowDesc _build_monorail_desc = { |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
751 |
640-372, 22, 372, 36, |
0 | 752 |
WC_BUILD_TOOLBAR,0, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
753 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 754 |
_build_monorail_widgets, |
755 |
BuildRailToolbWndProc |
|
756 |
}; |
|
757 |
||
758 |
static const Widget _build_maglev_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
759 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
760 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100C_MAGLEV_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
761 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 762 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
763 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
0 | 764 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
765 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, 0x4EB, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
766 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, 0x4EC, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
767 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, 0x4EE, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
768 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, 0x4ED, STR_1018_BUILD_RAILROAD_TRACK}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
769 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_OPENTTD_BASE + 2, STR_BUILD_AUTORAIL_TIP}, |
0 | 770 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
771 |
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
772 |
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_OPENTTD_BASE + 13, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
773 |
{ WWT_PANEL, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_OPENTTD_BASE + 3, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
774 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
775 |
{ WWT_PANEL, RESIZE_NONE, 7, 180, 221, 14, 35, 0x512, STR_101A_BUILD_RAILROAD_STATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
776 |
{ WWT_PANEL, RESIZE_NONE, 7, 222, 243, 14, 35, 0x50B, STR_101B_BUILD_RAILROAD_SIGNALS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
777 |
{ WWT_PANEL, RESIZE_NONE, 7, 244, 285, 14, 35, 0xA22, STR_101C_BUILD_RAILROAD_BRIDGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
778 |
{ WWT_PANEL, RESIZE_NONE, 7, 286, 305, 14, 35, 0x980, STR_101D_BUILD_RAILROAD_TUNNEL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
779 |
{ WWT_PANEL, RESIZE_NONE, 7, 306, 327, 14, 35, 0x2CA, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
780 |
{ WWT_PANEL, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_OPENTTD_BASE + 29, STR_CONVERT_RAIL_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
781 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
782 |
{ WWT_PANEL, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
783 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
784 |
{ WIDGETS_END}, |
0 | 785 |
}; |
786 |
||
787 |
static const WindowDesc _build_maglev_desc = { |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
788 |
640-372, 22, 372, 36, |
0 | 789 |
WC_BUILD_TOOLBAR,0, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
790 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 791 |
_build_maglev_widgets, |
792 |
BuildRailToolbWndProc |
|
793 |
}; |
|
794 |
||
795 |
||
796 |
static const WindowDesc * const _build_rr_desc[] = { |
|
797 |
&_build_railroad_desc, |
|
798 |
&_build_monorail_desc, |
|
799 |
&_build_maglev_desc, |
|
800 |
}; |
|
801 |
||
802 |
void ShowBuildRailToolbar(int index, int button) |
|
803 |
{ |
|
804 |
Window *w; |
|
805 |
||
806 |
// don't recreate the window if we're clicking on a button and the window exists. |
|
807 |
if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, 0)) || w->wndproc != BuildRailToolbWndProc) { |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
808 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
0 | 809 |
_cur_railtype = (byte)index; |
810 |
w = AllocateWindowDesc(_build_rr_desc[index]); |
|
811 |
} |
|
812 |
||
288
6bd97cdf1652
(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
darkvater
parents:
201
diff
changeset
|
813 |
_remove_button_clicked = false; |
0 | 814 |
if (w != NULL && button >= 0) _build_railroad_button_proc[button](w); |
815 |
} |
|
816 |
||
449
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
817 |
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks! |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
818 |
* --pasky */ |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
819 |
|
0 | 820 |
static void HandleStationPlacement(uint start, uint end) |
821 |
{ |
|
822 |
uint sx = GET_TILE_X(start); |
|
823 |
uint sy = GET_TILE_Y(start); |
|
824 |
uint ex = GET_TILE_X(end); |
|
825 |
uint ey = GET_TILE_Y(end); |
|
826 |
uint w,h; |
|
827 |
||
828 |
if (sx > ex) intswap(sx,ex); |
|
829 |
if (sy > ey) intswap(sy,ey); |
|
830 |
w = ex - sx + 1; |
|
831 |
h = ey - sy + 1; |
|
832 |
if (!_railstation.orientation) intswap(w,h); |
|
833 |
||
449
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
834 |
// TODO: Custom station selector GUI. Now we just try using first custom station |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
835 |
// (and fall back to normal stations if it isn't available). |
d9325d9f24bb
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
836 |
DoCommandP(TILE_XY(sx,sy), _railstation.orientation | (w<<8) | (h<<16),_cur_railtype|1<<4, CcStation, |
0 | 837 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
838 |
} |
|
839 |
||
840 |
static void StationBuildWndProc(Window *w, WindowEvent *e) { |
|
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
841 |
int rad; |
0 | 842 |
switch(e->event) { |
843 |
case WE_PAINT: { |
|
844 |
uint bits; |
|
845 |
||
846 |
if (WP(w,def_d).close) |
|
847 |
return; |
|
848 |
||
849 |
bits = (1<<3) << ( _railstation.orientation); |
|
850 |
if (_railstation.dragdrop) { |
|
851 |
bits |= (1<<19); |
|
852 |
} else { |
|
853 |
bits |= (1<<(5-1)) << (_railstation.numtracks); |
|
854 |
bits |= (1<<(12-1)) << (_railstation.platlength); |
|
855 |
} |
|
856 |
bits |= (1<<20) << (_station_show_coverage); |
|
857 |
w->click_state = bits; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
858 |
|
0 | 859 |
if (_railstation.dragdrop) { |
860 |
SetTileSelectSize(1, 1); |
|
861 |
} else { |
|
862 |
int x = _railstation.numtracks; |
|
863 |
int y = _railstation.platlength; |
|
864 |
if (_railstation.orientation == 0) intswap(x,y); |
|
865 |
if(!_remove_button_clicked) |
|
866 |
SetTileSelectSize(x, y); |
|
867 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
868 |
|
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
869 |
if (_patches.modified_catchment) { |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
870 |
rad = CA_TRAIN; |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
871 |
} else { |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
872 |
rad = 4; |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
873 |
} |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
874 |
|
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
875 |
|
0 | 876 |
if (_station_show_coverage) |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
877 |
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
0 | 878 |
|
879 |
DrawWindowWidgets(w); |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
880 |
|
0 | 881 |
StationPickerDrawSprite(39, 42, _cur_railtype, 2); |
882 |
StationPickerDrawSprite(107, 42, _cur_railtype, 3); |
|
883 |
||
884 |
DrawStringCentered(74, 15, STR_3002_ORIENTATION, 0); |
|
885 |
DrawStringCentered(74, 76, STR_3003_NUMBER_OF_TRACKS, 0); |
|
886 |
DrawStringCentered(74, 101, STR_3004_PLATFORM_LENGTH, 0); |
|
887 |
DrawStringCentered(74, 141, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0); |
|
888 |
||
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
889 |
DrawStationCoverageAreaText(2, 166, (uint)-1, rad); |
0 | 890 |
} break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
891 |
|
0 | 892 |
case WE_CLICK: { |
893 |
switch(e->click.widget) { |
|
894 |
case 0: |
|
895 |
ResetObjectToPlace(); |
|
896 |
break; |
|
897 |
case 3: |
|
898 |
case 4: |
|
899 |
_railstation.orientation = e->click.widget - 3; |
|
541 | 900 |
SndPlayFx(SND_15_BEEP); |
0 | 901 |
SetWindowDirty(w); |
902 |
break; |
|
903 |
||
904 |
case 5: |
|
905 |
case 6: |
|
906 |
case 7: |
|
907 |
case 8: |
|
908 |
case 9: |
|
909 |
case 10: |
|
910 |
case 11: |
|
911 |
_railstation.numtracks = (e->click.widget - 5) + 1; |
|
912 |
_railstation.dragdrop = false; |
|
541 | 913 |
SndPlayFx(SND_15_BEEP); |
0 | 914 |
SetWindowDirty(w); |
915 |
break; |
|
916 |
||
917 |
case 12: |
|
918 |
case 13: |
|
919 |
case 14: |
|
920 |
case 15: |
|
921 |
case 16: |
|
922 |
case 17: |
|
923 |
case 18: |
|
924 |
_railstation.platlength = (e->click.widget - 12) + 1; |
|
925 |
_railstation.dragdrop = false; |
|
541 | 926 |
SndPlayFx(SND_15_BEEP); |
0 | 927 |
SetWindowDirty(w); |
928 |
break; |
|
929 |
||
930 |
case 19: |
|
931 |
_railstation.dragdrop ^= true; |
|
541 | 932 |
SndPlayFx(SND_15_BEEP); |
0 | 933 |
SetWindowDirty(w); |
934 |
break; |
|
935 |
||
936 |
case 20: |
|
937 |
case 21: |
|
938 |
_station_show_coverage = e->click.widget - 20; |
|
541 | 939 |
SndPlayFx(SND_15_BEEP); |
0 | 940 |
SetWindowDirty(w); |
941 |
break; |
|
942 |
} |
|
943 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
944 |
|
0 | 945 |
case WE_MOUSELOOP: { |
946 |
if (WP(w,def_d).close) { |
|
947 |
DeleteWindow(w); |
|
948 |
return; |
|
949 |
} |
|
950 |
CheckRedrawStationCoverage(w); |
|
951 |
} break; |
|
952 |
} |
|
953 |
} |
|
954 |
||
955 |
static const Widget _station_builder_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
956 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
957 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
958 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 199, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
959 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
960 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
0 | 961 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
962 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 22, 36, 87, 98, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
963 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 37, 51, 87, 98, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
964 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 52, 66, 87, 98, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
965 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 67, 81, 87, 98, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
966 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 82, 96, 87, 98, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
967 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 97, 111, 87, 98, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
968 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 112, 126, 87, 98, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
0 | 969 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
970 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 22, 36, 112, 123, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
971 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 37, 51, 112, 123, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
972 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 52, 66, 112, 123, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
973 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 67, 81, 112, 123, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
974 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 82, 96, 112, 123, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
975 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 97, 111, 112, 123, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
976 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 112, 126, 112, 123, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
0 | 977 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
978 |
//{ WWT_CLOSEBOX, RESIZE_NONE, 14, 14, 73, 137, 148, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
979 |
//{ WWT_CLOSEBOX, RESIZE_NONE, 14, 74, 133, 137, 148, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
980 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 37, 111, 126, 137, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
981 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 14, 73, 152, 163, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
982 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 74, 133, 152, 163, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
983 |
{ WIDGETS_END}, |
0 | 984 |
}; |
985 |
||
986 |
static const WindowDesc _station_builder_desc = { |
|
987 |
-1, -1, 148, 200, |
|
988 |
WC_BUILD_STATION,WC_BUILD_TOOLBAR, |
|
989 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
990 |
_station_builder_widgets, |
|
991 |
StationBuildWndProc |
|
992 |
}; |
|
993 |
||
994 |
static void ShowStationBuilder() |
|
995 |
{ |
|
996 |
AllocateWindowDesc(&_station_builder_desc); |
|
997 |
} |
|
998 |
||
999 |
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) |
|
1000 |
{ |
|
1001 |
switch(e->event) { |
|
1002 |
case WE_PAINT: { |
|
1003 |
int r; |
|
1004 |
||
1005 |
w->click_state = (1 << 3) << _build_depot_direction; |
|
1006 |
DrawWindowWidgets(w); |
|
1007 |
||
1008 |
r = _cur_railtype; |
|
1009 |
DrawTrainDepotSprite(70, 17, 0, r); |
|
1010 |
DrawTrainDepotSprite(70, 69, 1, r); |
|
1011 |
DrawTrainDepotSprite(2, 69, 2, r); |
|
1012 |
DrawTrainDepotSprite(2, 17, 3, r); |
|
1013 |
break; |
|
1014 |
} |
|
1015 |
case WE_CLICK: { |
|
1016 |
switch(e->click.widget) { |
|
1017 |
case 0: |
|
1018 |
ResetObjectToPlace(); |
|
1019 |
break; |
|
1020 |
case 3: |
|
1021 |
case 4: |
|
1022 |
case 5: |
|
1023 |
case 6: |
|
1024 |
_build_depot_direction = e->click.widget - 3; |
|
541 | 1025 |
SndPlayFx(SND_15_BEEP); |
0 | 1026 |
SetWindowDirty(w); |
1027 |
break; |
|
1028 |
} |
|
1029 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
1030 |
|
0 | 1031 |
case WE_MOUSELOOP: |
1032 |
if (WP(w,def_d).close) |
|
1033 |
DeleteWindow(w); |
|
1034 |
return; |
|
1035 |
} |
|
1036 |
} |
|
1037 |
||
1038 |
static const Widget _build_depot_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1039 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1040 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1041 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1042 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1043 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1044 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1045 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
1046 |
{ WIDGETS_END}, |
0 | 1047 |
}; |
1048 |
||
1049 |
static const WindowDesc _build_depot_desc = { |
|
1050 |
-1,-1, 140, 122, |
|
1051 |
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR, |
|
1052 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
1053 |
_build_depot_widgets, |
|
1054 |
BuildTrainDepotWndProc |
|
1055 |
}; |
|
1056 |
||
1057 |
static void ShowBuildTrainDepotPicker() |
|
1058 |
{ |
|
1059 |
AllocateWindowDesc(&_build_depot_desc); |
|
1060 |
} |
|
1061 |
||
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1062 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1063 |
static void BuildWaypointWndProc(Window *w, WindowEvent *e) |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1064 |
{ |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1065 |
switch(e->event) { |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1066 |
case WE_PAINT: { |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1067 |
int r; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1068 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1069 |
w->click_state = (1 << 3) << _cur_waypoint_type; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1070 |
DrawWindowWidgets(w); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1071 |
|
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1072 |
r = 4*w->hscroll.pos; |
415
423de36034b8
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
1073 |
if(r+0<=_waypoint_count) DrawWaypointSprite(2, 25, r + 0, _cur_railtype); |
423de36034b8
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
1074 |
if(r+1<=_waypoint_count) DrawWaypointSprite(70, 25, r + 1, _cur_railtype); |
423de36034b8
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
1075 |
if(r+2<=_waypoint_count) DrawWaypointSprite(138, 25, r + 2, _cur_railtype); |
423de36034b8
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
1076 |
if(r+3<=_waypoint_count) DrawWaypointSprite(206, 25, r + 3, _cur_railtype); |
423de36034b8
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
1077 |
if(r+4<=_waypoint_count) DrawWaypointSprite(274, 25, r + 4, _cur_railtype); |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1078 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1079 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1080 |
case WE_CLICK: { |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1081 |
switch(e->click.widget) { |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1082 |
case 0: |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1083 |
ResetObjectToPlace(); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1084 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1085 |
case 3: |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1086 |
case 4: |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1087 |
case 5: |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1088 |
case 6: |
411
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1089 |
case 7: |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1090 |
_cur_waypoint_type = e->click.widget - 3; |
541 | 1091 |
SndPlayFx(SND_15_BEEP); |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1092 |
SetWindowDirty(w); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1093 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1094 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1095 |
break; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1096 |
} |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1097 |
|
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1098 |
case WE_MOUSELOOP: |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1099 |
if (WP(w,def_d).close) |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1100 |
DeleteWindow(w); |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1101 |
return; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1102 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1103 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1104 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1105 |
static const Widget _build_waypoint_widgets[] = { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1106 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1107 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 343, 0, 13, STR_WAYPOINT,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1108 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 343, 14, 91, 0x0, 0}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1109 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1110 |
{ WWT_PANEL, RESIZE_NONE, 7, 3, 68, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1111 |
{ WWT_PANEL, RESIZE_NONE, 7, 71, 136, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1112 |
{ WWT_PANEL, RESIZE_NONE, 7, 139, 204, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1113 |
{ WWT_PANEL, RESIZE_NONE, 7, 207, 272, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
1114 |
{ WWT_PANEL, RESIZE_NONE, 7, 275, 340, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1115 |
|
894
ab8a5f7ea3db
(svn r1380) -Fix: missed widget fixes; thanks Jango and TestMan57
darkvater
parents:
867
diff
changeset
|
1116 |
{ WWT_HSCROLLBAR, RESIZE_NONE, 7, 1, 343, 80, 91, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
417 | 1117 |
{ WIDGETS_END}, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1118 |
}; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1119 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1120 |
static const WindowDesc _build_waypoint_desc = { |
411
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1121 |
-1,-1, 344, 92, |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1122 |
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR, |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1123 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1124 |
_build_waypoint_widgets, |
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1125 |
BuildWaypointWndProc |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1126 |
}; |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1127 |
|
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1128 |
static void ShowBuildWaypointPicker() |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1129 |
{ |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
393
diff
changeset
|
1130 |
Window *w = AllocateWindowDesc(&_build_waypoint_desc); |
411
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1131 |
w->hscroll.cap = 5; |
18495773b26e
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
1132 |
w->hscroll.count = (uint) (_waypoint_count+4) / 5; |
393
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1133 |
} |
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1134 |
|
82c2bf635cd9
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
1135 |
|
0 | 1136 |
void InitializeRailGui() |
1137 |
{ |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
1138 |
_build_depot_direction = 3; |
0 | 1139 |
_railstation.numtracks = 1; |
1140 |
_railstation.platlength = 1; |
|
1141 |
_railstation.dragdrop = true; |
|
1142 |
} |