author | truelight |
Fri, 04 Feb 2005 13:23:29 +0000 | |
changeset 1279 | bc761aad52b3 |
parent 1227 | 1d940a5e02d2 |
child 1363 | 775a7ee52369 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
449
diff
changeset
|
3 |
#include "table/strings.h" |
679
04ca2cd69420
(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" |
1209
2e00193652b2
(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
tron
parents:
1123
diff
changeset
|
5 |
#include "tile.h" |
0 | 6 |
#include "window.h" |
7 |
#include "gui.h" |
|
8 |
#include "viewport.h" |
|
9 |
#include "gfx.h" |
|
337
cbe0c766c947
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
288
diff
changeset
|
10 |
#include "sound.h" |
0 | 11 |
#include "command.h" |
12 |
#include "vehicle.h" |
|
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
13 |
#include "station.h" |
0 | 14 |
|
15 |
static uint _cur_railtype; |
|
16 |
static bool _remove_button_clicked; |
|
17 |
static byte _build_depot_direction; |
|
411
dc46e54bd2ed
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
18 |
static byte _waypoint_count=1; |
395
788a9bba0889
(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
|
19 |
static byte _cur_waypoint_type; |
0 | 20 |
|
21 |
struct { |
|
22 |
byte orientation; |
|
23 |
byte numtracks; |
|
24 |
byte platlength; |
|
25 |
bool dragdrop; |
|
26 |
} _railstation; |
|
27 |
||
28 |
||
29 |
static void HandleStationPlacement(uint start, uint end); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
30 |
static void ShowBuildTrainDepotPicker(void); |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
31 |
static void ShowBuildWaypointPicker(void); |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
32 |
static void ShowStationBuilder(void); |
0 | 33 |
|
34 |
typedef void OnButtonClick(Window *w); |
|
35 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
36 |
void CcPlaySound1E(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 37 |
{ |
541 | 38 |
if (success) SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 39 |
} |
40 |
||
41 |
static void GenericPlaceRail(uint tile, int cmd) |
|
42 |
{ |
|
43 |
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
|
44 |
_remove_button_clicked ? |
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
45 |
CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) | CMD_AUTO | CMD_NO_WATER : |
0 | 46 |
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_AUTO | CMD_NO_WATER |
47 |
); |
|
48 |
} |
|
49 |
||
50 |
static void PlaceRail_N(uint tile) |
|
51 |
{ |
|
52 |
int cmd = _tile_fract_coords.x > _tile_fract_coords.y ? 4 : 5; |
|
53 |
GenericPlaceRail(tile, cmd); |
|
54 |
} |
|
55 |
||
56 |
static void PlaceRail_NE(uint tile) |
|
57 |
{ |
|
58 |
VpStartPlaceSizing(tile, VPM_FIX_Y); |
|
59 |
} |
|
60 |
||
61 |
static void PlaceRail_E(uint tile) |
|
62 |
{ |
|
63 |
int cmd = _tile_fract_coords.x + _tile_fract_coords.y <= 15 ? 2 : 3; |
|
64 |
GenericPlaceRail(tile, cmd); |
|
65 |
} |
|
66 |
||
67 |
static void PlaceRail_NW(uint tile) |
|
68 |
{ |
|
69 |
VpStartPlaceSizing(tile, VPM_FIX_X); |
|
70 |
} |
|
71 |
||
72 |
static void PlaceRail_AutoRail(uint tile) |
|
73 |
{ |
|
74 |
VpStartPlaceSizing(tile, VPM_RAILDIRS); |
|
75 |
} |
|
76 |
||
77 |
static void PlaceExtraDepotRail(uint tile, uint16 extra) |
|
78 |
{ |
|
79 |
byte b = _map5[tile]; |
|
80 |
||
81 |
if (b & 0xC0 || !(b & (extra >> 8))) |
|
82 |
return; |
|
83 |
||
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
84 |
DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_AUTO | CMD_NO_WATER); |
0 | 85 |
} |
86 |
||
87 |
static const uint16 _place_depot_extra[12] = { |
|
88 |
0x604, 0x2102, 0x1202, 0x505, |
|
89 |
0x2400, 0x2801, 0x1800, 0x1401, |
|
90 |
0x2203, 0x904, 0x0A05, 0x1103, |
|
91 |
}; |
|
92 |
||
93 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
94 |
void CcRailDepot(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 95 |
{ |
96 |
if (success) { |
|
97 |
int dir = p2; |
|
98 |
||
541 | 99 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 100 |
ResetObjectToPlace(); |
101 |
||
900 | 102 |
tile += TileOffsByDir(dir); |
0 | 103 |
|
1035
812f837ee03f
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
980
diff
changeset
|
104 |
if (IsTileType(tile, MP_RAILWAY)) { |
0 | 105 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir]); |
106 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 4]); |
|
107 |
PlaceExtraDepotRail(tile, _place_depot_extra[dir + 8]); |
|
108 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
109 |
} |
0 | 110 |
} |
111 |
||
112 |
static void PlaceRail_Depot(uint tile) |
|
113 |
{ |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
114 |
DoCommandP(tile, _cur_railtype, _build_depot_direction, CcRailDepot, |
0 | 115 |
CMD_BUILD_TRAIN_DEPOT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_100E_CAN_T_BUILD_TRAIN_DEPOT)); |
116 |
} |
|
117 |
||
395
788a9bba0889
(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
|
118 |
static void PlaceRail_Waypoint(uint tile) |
0 | 119 |
{ |
120 |
if (!_remove_button_clicked) { |
|
395
788a9bba0889
(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
|
121 |
DoCommandP(tile, _waypoint_count > 0 ? (0x100 + _cur_waypoint_type) : 0, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT)); |
0 | 122 |
} else { |
395
788a9bba0889
(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
|
123 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT)); |
0 | 124 |
} |
125 |
} |
|
126 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
127 |
void CcStation(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 128 |
{ |
129 |
if (success) { |
|
541 | 130 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 131 |
ResetObjectToPlace(); |
132 |
} |
|
133 |
} |
|
134 |
||
135 |
static void PlaceRail_Station(uint tile) |
|
136 |
{ |
|
137 |
if(_remove_button_clicked) |
|
138 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION)); |
|
139 |
else if (_railstation.dragdrop) { |
|
140 |
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED); |
|
141 |
VpSetPlaceSizingLimit(_patches.station_spread); |
|
142 |
} else { |
|
449
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
143 |
// TODO: Custom station selector GUI. Now we just try using first custom station |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
144 |
// (and fall back to normal stations if it isn't available). |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
145 |
DoCommandP(tile, _railstation.orientation | (_railstation.numtracks<<8) | (_railstation.platlength<<16),_cur_railtype|1<<4, CcStation, |
0 | 146 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
147 |
} |
|
148 |
} |
|
149 |
||
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
|
150 |
static void GenericPlaceSignals(uint tile) |
0 | 151 |
{ |
152 |
uint trackstat; |
|
153 |
int i; |
|
154 |
||
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
59
diff
changeset
|
155 |
trackstat = (byte)GetTileTrackStatus(tile, TRANSPORT_RAIL); |
0 | 156 |
|
1123
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
157 |
if ((trackstat & 0x30)) // N-S direction |
0 | 158 |
trackstat = (_tile_fract_coords.x <= _tile_fract_coords.y) ? 0x20 : 0x10; |
159 |
||
1123
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
160 |
if ((trackstat & 0x0C)) // E-W direction |
0 | 161 |
trackstat = (_tile_fract_coords.x + _tile_fract_coords.y <= 15) ? 4 : 8; |
162 |
||
163 |
// Lookup the bit index |
|
164 |
i = 0; |
|
165 |
if (trackstat != 0) { while (!(trackstat & 1)) { i++; trackstat >>= 1; }} |
|
166 |
||
167 |
if (!_remove_button_clicked) { |
|
168 |
DoCommandP(tile, i + (_ctrl_pressed ? 8 : 0), 0, CcPlaySound1E, |
|
169 |
CMD_BUILD_SIGNALS | CMD_AUTO | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE)); |
|
170 |
} else { |
|
171 |
DoCommandP(tile, i, 0, CcPlaySound1E, |
|
172 |
CMD_REMOVE_SIGNALS | CMD_AUTO | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM)); |
|
173 |
} |
|
174 |
} |
|
175 |
||
176 |
static void PlaceRail_Bridge(uint tile) |
|
177 |
{ |
|
178 |
VpStartPlaceSizing(tile, VPM_X_OR_Y); |
|
179 |
} |
|
180 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
181 |
void CcBuildRailTunnel(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 182 |
{ |
183 |
if (success) { |
|
541 | 184 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 185 |
ResetObjectToPlace(); |
186 |
} else { |
|
187 |
SetRedErrorSquare(_build_tunnel_endtile); |
|
188 |
} |
|
189 |
} |
|
190 |
||
191 |
static void PlaceRail_Tunnel(uint tile) |
|
192 |
{ |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
193 |
DoCommandP(tile, _cur_railtype, 0, CcBuildRailTunnel, |
0 | 194 |
CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE)); |
195 |
} |
|
196 |
||
197 |
void PlaceProc_BuyLand(uint tile) |
|
198 |
{ |
|
199 |
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_PURCHASE_LAND_AREA | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_5806_CAN_T_PURCHASE_THIS_LAND)); |
|
200 |
} |
|
201 |
||
202 |
static void PlaceRail_ConvertRail(uint tile) |
|
203 |
{ |
|
204 |
VpStartPlaceSizing(tile, VPM_X_AND_Y | (1<<4)); |
|
205 |
} |
|
206 |
||
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
|
207 |
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
|
208 |
{ |
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 |
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
|
210 |
} |
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 |
|
0 | 212 |
static void BuildRailClick_N(Window *w) |
213 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
214 |
HandlePlacePushButton(w, 4, _cur_railtype*4 + 0x4EF, 1, PlaceRail_N); |
0 | 215 |
} |
216 |
||
217 |
static void BuildRailClick_NE(Window *w) |
|
218 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
219 |
HandlePlacePushButton(w, 5, _cur_railtype*4 + 0x4F0, 1, PlaceRail_NE); |
0 | 220 |
} |
221 |
||
222 |
static void BuildRailClick_E(Window *w) |
|
223 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
224 |
HandlePlacePushButton(w, 6, _cur_railtype*4 + 0x4F1, 1, PlaceRail_E); |
0 | 225 |
} |
226 |
||
227 |
static void BuildRailClick_NW(Window *w) |
|
228 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
229 |
HandlePlacePushButton(w, 7, _cur_railtype*4 + 0x4F2, 1, PlaceRail_NW); |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
230 |
} |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
231 |
|
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
232 |
static void BuildRailClick_AutoRail(Window *w) |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
233 |
{ |
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
234 |
HandlePlacePushButton(w, 8, _cur_railtype + SPR_CURSOR_AUTORAIL, VHM_RAIL, PlaceRail_AutoRail); |
0 | 235 |
} |
236 |
||
237 |
static void BuildRailClick_Demolish(Window *w) |
|
238 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
239 |
HandlePlacePushButton(w, 9, ANIMCURSOR_DEMOLISH, 1, PlaceProc_DemolishArea); |
0 | 240 |
} |
241 |
||
242 |
static const SpriteID _depot_cursors[] = { |
|
243 |
0x510, |
|
244 |
SPR_OPENTTD_BASE + 14, |
|
245 |
SPR_OPENTTD_BASE + 15, |
|
246 |
}; |
|
247 |
||
248 |
static void BuildRailClick_Depot(Window *w) |
|
249 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
250 |
if (HandlePlacePushButton(w, 10, _depot_cursors[_cur_railtype], 1, PlaceRail_Depot)) ShowBuildTrainDepotPicker(); |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
251 |
} |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
252 |
|
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
253 |
static void BuildRailClick_Waypoint(Window *w) |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
254 |
{ |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
255 |
_waypoint_count = GetCustomStationsCount(STAT_CLASS_WAYP); |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
256 |
if (HandlePlacePushButton(w, 11, SPR_OPENTTD_BASE + 7, 1, PlaceRail_Waypoint) |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
257 |
&& _waypoint_count > 1) |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
258 |
ShowBuildWaypointPicker(); |
0 | 259 |
} |
260 |
||
261 |
static void BuildRailClick_Station(Window *w) |
|
262 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
263 |
if (HandlePlacePushButton(w, 12, 0x514, 1, PlaceRail_Station)) ShowStationBuilder(); |
0 | 264 |
} |
265 |
||
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
|
266 |
static void BuildRailClick_AutoSignals(Window *w) |
0 | 267 |
{ |
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
268 |
HandlePlacePushButton(w, 13, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); |
0 | 269 |
} |
270 |
||
271 |
static void BuildRailClick_Bridge(Window *w) |
|
272 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
273 |
HandlePlacePushButton(w, 14, 0xA21, 1, PlaceRail_Bridge); |
0 | 274 |
} |
275 |
||
276 |
static void BuildRailClick_Tunnel(Window *w) |
|
277 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
278 |
HandlePlacePushButton(w, 15, 0x982 + _cur_railtype, 3, PlaceRail_Tunnel); |
0 | 279 |
} |
280 |
||
281 |
static void BuildRailClick_Remove(Window *w) |
|
282 |
{ |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
283 |
if (w->disabled_state & (1<<16)) |
0 | 284 |
return; |
285 |
SetWindowDirty(w); |
|
541 | 286 |
SndPlayFx(SND_15_BEEP); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
287 |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
288 |
_thd.make_square_red = !!((w->click_state ^= (1 << 16)) & (1<<16)); |
514
2de07a146b19
(svn r829) Fix small glitch: Immediately redraw the tile selection square when using the hotkey to toggle removal
tron
parents:
507
diff
changeset
|
289 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
290 |
_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
|
291 |
|
0 | 292 |
// handle station builder |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
293 |
if( w->click_state & (1 << 16) ) |
0 | 294 |
{ |
295 |
if(_remove_button_clicked) |
|
296 |
SetTileSelectSize(1, 1); |
|
297 |
else |
|
298 |
BringWindowToFrontById(WC_BUILD_STATION, 0); |
|
299 |
} |
|
300 |
} |
|
301 |
||
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
302 |
static void BuildRailClick_Convert(Window *w) |
0 | 303 |
{ |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
304 |
HandlePlacePushButton(w, 17, (SPR_OPENTTD_BASE + 26) + _cur_railtype * 2, 1, PlaceRail_ConvertRail); |
0 | 305 |
} |
306 |
||
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
307 |
static void BuildRailClick_Landscaping(Window *w) |
0 | 308 |
{ |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
309 |
ShowTerraformToolbar(); |
0 | 310 |
} |
311 |
||
312 |
static void DoRailroadTrack(int mode) |
|
313 |
{ |
|
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
314 |
DoCommandP(TILE_FROM_XY(_thd.selstart.x, _thd.selstart.y), TILE_FROM_XY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), NULL, |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
315 |
_remove_button_clicked ? |
0 | 316 |
CMD_REMOVE_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) : |
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
317 |
CMD_BUILD_RAILROAD_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) |
0 | 318 |
); |
319 |
} |
|
320 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
321 |
static void HandleAutodirPlacement(void) |
0 | 322 |
{ |
323 |
TileHighlightData *thd = &_thd; |
|
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
324 |
int trackstat = thd->drawstyle & 0xF; // 0..5 |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
325 |
|
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
326 |
if (thd->drawstyle & HT_RAIL) { // one tile case |
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
327 |
GenericPlaceRail(TILE_FROM_XY(thd->selend.x, thd->selend.y), trackstat); |
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
328 |
return; |
0 | 329 |
} |
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
330 |
|
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
331 |
DoRailroadTrack(trackstat); |
0 | 332 |
} |
333 |
||
1070
bd31ed783fd3
(svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
1035
diff
changeset
|
334 |
static void HandleAutoSignalPlacement(void) |
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
|
335 |
{ |
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
|
336 |
TileHighlightData *thd = &_thd; |
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
337 |
byte trackstat = thd->drawstyle & 0xF; // 0..5 |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
338 |
|
1123
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
339 |
if (thd->drawstyle == HT_RECT) { // one tile case |
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
|
340 |
GenericPlaceSignals(TILE_FROM_XY(thd->selend.x, thd->selend.y)); |
1123
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
341 |
return; |
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
342 |
} |
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
|
343 |
|
1123
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
344 |
// _patches.drag_signals_density is given as a parameter such that each user in a network |
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
345 |
// game can specify his/her own signal density |
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
346 |
DoCommandP(TILE_FROM_XY(thd->selstart.x, thd->selstart.y), TILE_FROM_XY(thd->selend.x, thd->selend.y), |
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
347 |
(_ctrl_pressed ? 1 << 3 : 0) | (trackstat << 4) | (_patches.drag_signals_density << 24), |
1123
9c8b944a2737
(svn r1624) -Fix: [1106930] BugFix: placing signals with 2x1 drags is treated as placing a single signal thus providing an easy fix for a nasty problem.
darkvater
parents:
1116
diff
changeset
|
348 |
CcPlaySound1E, |
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
349 |
(_remove_button_clicked ? CMD_REMOVE_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) : |
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
350 |
CMD_BUILD_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) ) ); |
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
|
351 |
} |
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
|
352 |
|
0 | 353 |
static OnButtonClick * const _build_railroad_button_proc[] = { |
354 |
BuildRailClick_N, |
|
355 |
BuildRailClick_NE, |
|
356 |
BuildRailClick_E, |
|
357 |
BuildRailClick_NW, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
358 |
BuildRailClick_AutoRail, |
0 | 359 |
BuildRailClick_Demolish, |
360 |
BuildRailClick_Depot, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
361 |
BuildRailClick_Waypoint, |
0 | 362 |
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
|
363 |
BuildRailClick_AutoSignals, |
0 | 364 |
BuildRailClick_Bridge, |
365 |
BuildRailClick_Tunnel, |
|
366 |
BuildRailClick_Remove, |
|
367 |
BuildRailClick_Convert, |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
368 |
BuildRailClick_Landscaping, |
0 | 369 |
}; |
370 |
||
371 |
static const uint16 _rail_keycodes[] = { |
|
372 |
'1', |
|
373 |
'2', |
|
374 |
'3', |
|
375 |
'4', |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
376 |
'5', |
0 | 377 |
'6', |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
378 |
'7', // depot |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
379 |
'8', // waypoint |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
380 |
'9', // station |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
381 |
'S', // signals |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
382 |
'B', // bridge |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
383 |
'T', // tunnel |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
384 |
'R', // remove |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
385 |
'C', // convert rail |
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
386 |
'L', // landscaping |
0 | 387 |
}; |
388 |
||
389 |
||
390 |
||
391 |
||
392 |
static void BuildRailToolbWndProc(Window *w, WindowEvent *e) |
|
393 |
{ |
|
394 |
switch(e->event) { |
|
395 |
case WE_PAINT: |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
396 |
w->disabled_state &= ~(1 << 16); |
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
397 |
if (!(w->click_state & ((1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<11)|(1<<12)|(1<<13)))) { |
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
398 |
w->disabled_state |= (1 << 16); |
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
399 |
w->click_state &= ~(1<<16); |
0 | 400 |
} |
401 |
DrawWindowWidgets(w); |
|
402 |
break; |
|
403 |
||
404 |
case WE_CLICK: |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
405 |
if (e->click.widget >= 4) { |
0 | 406 |
_remove_button_clicked = false; |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
407 |
_build_railroad_button_proc[e->click.widget - 4](w); |
0 | 408 |
} |
409 |
break; |
|
410 |
||
411 |
case WE_KEYPRESS: { |
|
412 |
int i; |
|
616
63b0ac55529e
(svn r1040) Fix: All character hotkeys are disabled now when a window for typing is open
dominik
parents:
606
diff
changeset
|
413 |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
414 |
for(i=0; i!=lengthof(_rail_keycodes); i++) { |
0 | 415 |
if (e->keypress.keycode == _rail_keycodes[i]) { |
416 |
e->keypress.cont = false; |
|
417 |
_remove_button_clicked = false; |
|
418 |
_build_railroad_button_proc[i](w); |
|
419 |
break; |
|
420 |
} |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
421 |
} |
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
422 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 423 |
break; |
424 |
} |
|
425 |
||
426 |
case WE_PLACE_OBJ: |
|
427 |
_place_proc(e->place.tile); |
|
428 |
return; |
|
429 |
||
430 |
case WE_PLACE_DRAG: { |
|
431 |
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata & 0xF); |
|
432 |
return; |
|
433 |
} |
|
434 |
||
435 |
case WE_PLACE_MOUSEUP: |
|
436 |
if (e->click.pt.x != -1) { |
|
437 |
uint start_tile = e->place.starttile; |
|
438 |
uint end_tile = e->place.tile; |
|
439 |
||
440 |
if (e->place.userdata == VPM_X_OR_Y) { |
|
441 |
ResetObjectToPlace(); |
|
442 |
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype); |
|
443 |
} else if (e->place.userdata == VPM_RAILDIRS) { |
|
444 |
bool old = _remove_button_clicked; |
|
445 |
if (_ctrl_pressed) _remove_button_clicked = true; |
|
446 |
HandleAutodirPlacement(); |
|
447 |
_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
|
448 |
} 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
|
449 |
HandleAutoSignalPlacement(); |
0 | 450 |
} else if (e->place.userdata == VPM_X_AND_Y) { |
451 |
DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
|
452 |
} else if (e->place.userdata == (VPM_X_AND_Y | (1<<4))) { |
|
453 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_CONVERT_RAIL | CMD_MSG(STR_CANT_CONVERT_RAIL)); |
|
454 |
} else if (e->place.userdata == (VPM_X_AND_Y | (2<<4))) { |
|
455 |
DoCommandP(end_tile, start_tile, _cur_railtype, CcPlaySound10, CMD_LEVEL_LAND | CMD_AUTO); |
|
456 |
} else if (e->place.userdata == VPM_X_AND_Y_LIMITED) { |
|
457 |
HandleStationPlacement(start_tile, end_tile); |
|
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
458 |
} else |
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1209
diff
changeset
|
459 |
DoRailroadTrack(e->place.userdata & 1); |
0 | 460 |
} |
461 |
break; |
|
462 |
||
463 |
case WE_ABORT_PLACE_OBJ: |
|
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
464 |
UnclickWindowButtons(w); |
0 | 465 |
SetWindowDirty(w); |
466 |
||
467 |
w = FindWindowById(WC_BUILD_STATION, 0); |
|
468 |
if (w != NULL) WP(w,def_d).close=true; |
|
469 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
|
470 |
if (w != NULL) WP(w,def_d).close=true; |
|
471 |
break; |
|
472 |
||
473 |
case WE_PLACE_PRESIZE: { |
|
474 |
uint tile = e->place.tile; |
|
475 |
DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
|
476 |
VpSetPresizeRange(tile, _build_tunnel_endtile==0?tile:_build_tunnel_endtile); |
|
477 |
} break; |
|
478 |
} |
|
479 |
} |
|
480 |
||
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
481 |
|
0 | 482 |
static const Widget _build_railroad_widgets[] = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
483 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
484 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100A_RAILROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
485 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 486 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
487 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
0 | 488 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
489 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, 0x4E3, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
490 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, 0x4E4, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
491 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, 0x4E5, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
492 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, 0x4E6, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
493 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_OPENTTD_BASE + 0, STR_BUILD_AUTORAIL_TIP}, |
0 | 494 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
495 |
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
496 |
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, 0x50E, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
497 |
{ WWT_PANEL, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_OPENTTD_BASE + 3, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
498 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
499 |
{ WWT_PANEL, RESIZE_NONE, 7, 180, 221, 14, 35, 0x512, STR_101A_BUILD_RAILROAD_STATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
500 |
{ WWT_PANEL, RESIZE_NONE, 7, 222, 243, 14, 35, 0x50B, STR_101B_BUILD_RAILROAD_SIGNALS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
501 |
{ WWT_PANEL, RESIZE_NONE, 7, 244, 285, 14, 35, 0xA22, STR_101C_BUILD_RAILROAD_BRIDGE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
502 |
{ WWT_PANEL, RESIZE_NONE, 7, 286, 305, 14, 35, 0x97E, STR_101D_BUILD_RAILROAD_TUNNEL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
503 |
{ WWT_PANEL, RESIZE_NONE, 7, 306, 327, 14, 35, 0x2CA, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
504 |
{ WWT_PANEL, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_OPENTTD_BASE + 25, STR_CONVERT_RAIL_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
505 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
506 |
{ WWT_PANEL, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
0 | 507 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
508 |
{ WIDGETS_END}, |
0 | 509 |
}; |
510 |
||
511 |
static const WindowDesc _build_railroad_desc = { |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
512 |
640-372, 22, 372, 36, |
0 | 513 |
WC_BUILD_TOOLBAR,0, |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
514 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 515 |
_build_railroad_widgets, |
516 |
BuildRailToolbWndProc |
|
517 |
}; |
|
518 |
||
519 |
static const Widget _build_monorail_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
520 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
521 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100B_MONORAIL_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
522 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 523 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
524 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
0 | 525 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
526 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, 0x4E7, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
527 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, 0x4E8, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
528 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, 0x4E9, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
529 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, 0x4EA, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
530 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_OPENTTD_BASE + 1, STR_BUILD_AUTORAIL_TIP}, |
0 | 531 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
532 |
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
533 |
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_OPENTTD_BASE + 12, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
534 |
{ WWT_PANEL, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_OPENTTD_BASE + 3, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
535 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
536 |
{ WWT_PANEL, RESIZE_NONE, 7, 180, 221, 14, 35, 0x512, STR_101A_BUILD_RAILROAD_STATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
537 |
{ WWT_PANEL, RESIZE_NONE, 7, 222, 243, 14, 35, 0x50B, STR_101B_BUILD_RAILROAD_SIGNALS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
538 |
{ WWT_PANEL, RESIZE_NONE, 7, 244, 285, 14, 35, 0xA22, STR_101C_BUILD_RAILROAD_BRIDGE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
539 |
{ WWT_PANEL, RESIZE_NONE, 7, 286, 305, 14, 35, 0x97F, STR_101D_BUILD_RAILROAD_TUNNEL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
540 |
{ WWT_PANEL, RESIZE_NONE, 7, 306, 327, 14, 35, 0x2CA, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
541 |
{ WWT_PANEL, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_OPENTTD_BASE + 27, STR_CONVERT_RAIL_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
542 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
543 |
{ WWT_PANEL, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
544 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
545 |
{ WIDGETS_END}, |
0 | 546 |
}; |
547 |
||
548 |
static const WindowDesc _build_monorail_desc = { |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
549 |
640-372, 22, 372, 36, |
0 | 550 |
WC_BUILD_TOOLBAR,0, |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
551 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 552 |
_build_monorail_widgets, |
553 |
BuildRailToolbWndProc |
|
554 |
}; |
|
555 |
||
556 |
static const Widget _build_maglev_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
557 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
558 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 359, 0, 13, STR_100C_MAGLEV_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
559 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 360, 371, 0, 13, 0x0, STR_STICKY_BUTTON}, |
0 | 560 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
561 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 113, 14, 35, 0x0, STR_NULL}, |
0 | 562 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
563 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, 0x4EB, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
564 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, 0x4EC, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
565 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, 0x4EE, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
566 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, 0x4ED, STR_1018_BUILD_RAILROAD_TRACK}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
567 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_OPENTTD_BASE + 2, STR_BUILD_AUTORAIL_TIP}, |
0 | 568 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
569 |
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
570 |
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_OPENTTD_BASE + 13, STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
571 |
{ WWT_PANEL, RESIZE_NONE, 7, 158, 179, 14, 35, SPR_OPENTTD_BASE + 3, STR_CONVERT_RAIL_TO_WAYPOINT_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
572 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
573 |
{ WWT_PANEL, RESIZE_NONE, 7, 180, 221, 14, 35, 0x512, STR_101A_BUILD_RAILROAD_STATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
574 |
{ WWT_PANEL, RESIZE_NONE, 7, 222, 243, 14, 35, 0x50B, STR_101B_BUILD_RAILROAD_SIGNALS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
575 |
{ WWT_PANEL, RESIZE_NONE, 7, 244, 285, 14, 35, 0xA22, STR_101C_BUILD_RAILROAD_BRIDGE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
576 |
{ WWT_PANEL, RESIZE_NONE, 7, 286, 305, 14, 35, 0x980, STR_101D_BUILD_RAILROAD_TUNNEL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
577 |
{ WWT_PANEL, RESIZE_NONE, 7, 306, 327, 14, 35, 0x2CA, STR_101E_TOGGLE_BUILD_REMOVE_FOR}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
578 |
{ WWT_PANEL, RESIZE_NONE, 7, 328, 349, 14, 35, SPR_OPENTTD_BASE + 29, STR_CONVERT_RAIL_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
579 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
580 |
{ WWT_PANEL, RESIZE_NONE, 7, 350, 371, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
581 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
159
diff
changeset
|
582 |
{ WIDGETS_END}, |
0 | 583 |
}; |
584 |
||
585 |
static const WindowDesc _build_maglev_desc = { |
|
606
da90c837064c
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
586 |
640-372, 22, 372, 36, |
0 | 587 |
WC_BUILD_TOOLBAR,0, |
756
b76998029c12
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
588 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 589 |
_build_maglev_widgets, |
590 |
BuildRailToolbWndProc |
|
591 |
}; |
|
592 |
||
593 |
||
594 |
static const WindowDesc * const _build_rr_desc[] = { |
|
595 |
&_build_railroad_desc, |
|
596 |
&_build_monorail_desc, |
|
597 |
&_build_maglev_desc, |
|
598 |
}; |
|
599 |
||
600 |
void ShowBuildRailToolbar(int index, int button) |
|
601 |
{ |
|
602 |
Window *w; |
|
603 |
||
946
2468063f35a4
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
926
diff
changeset
|
604 |
if (_current_player == OWNER_SPECTATOR) return; |
2468063f35a4
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
926
diff
changeset
|
605 |
|
0 | 606 |
// don't recreate the window if we're clicking on a button and the window exists. |
607 |
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
|
608 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
0 | 609 |
_cur_railtype = (byte)index; |
610 |
w = AllocateWindowDesc(_build_rr_desc[index]); |
|
611 |
} |
|
612 |
||
288
72ca19a694dd
(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
darkvater
parents:
201
diff
changeset
|
613 |
_remove_button_clicked = false; |
0 | 614 |
if (w != NULL && button >= 0) _build_railroad_button_proc[button](w); |
615 |
} |
|
616 |
||
449
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
617 |
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks! |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
618 |
* --pasky */ |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
619 |
|
0 | 620 |
static void HandleStationPlacement(uint start, uint end) |
621 |
{ |
|
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
622 |
uint sx = TileX(start); |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
623 |
uint sy = TileY(start); |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
624 |
uint ex = TileX(end); |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
625 |
uint ey = TileY(end); |
0 | 626 |
uint w,h; |
627 |
||
628 |
if (sx > ex) intswap(sx,ex); |
|
629 |
if (sy > ey) intswap(sy,ey); |
|
630 |
w = ex - sx + 1; |
|
631 |
h = ey - sy + 1; |
|
632 |
if (!_railstation.orientation) intswap(w,h); |
|
633 |
||
449
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
634 |
// TODO: Custom station selector GUI. Now we just try using first custom station |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
635 |
// (and fall back to normal stations if it isn't available). |
2856e9ce0754
(svn r659) Support for cutomized TTDPatch-style new stations (no selector GUI yet) (pasky)
tron
parents:
438
diff
changeset
|
636 |
DoCommandP(TILE_XY(sx,sy), _railstation.orientation | (w<<8) | (h<<16),_cur_railtype|1<<4, CcStation, |
0 | 637 |
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION)); |
638 |
} |
|
639 |
||
640 |
static void StationBuildWndProc(Window *w, WindowEvent *e) { |
|
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
641 |
int rad; |
0 | 642 |
switch(e->event) { |
643 |
case WE_PAINT: { |
|
644 |
uint bits; |
|
645 |
||
646 |
if (WP(w,def_d).close) |
|
647 |
return; |
|
648 |
||
649 |
bits = (1<<3) << ( _railstation.orientation); |
|
650 |
if (_railstation.dragdrop) { |
|
651 |
bits |= (1<<19); |
|
652 |
} else { |
|
653 |
bits |= (1<<(5-1)) << (_railstation.numtracks); |
|
654 |
bits |= (1<<(12-1)) << (_railstation.platlength); |
|
655 |
} |
|
656 |
bits |= (1<<20) << (_station_show_coverage); |
|
657 |
w->click_state = bits; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
658 |
|
0 | 659 |
if (_railstation.dragdrop) { |
660 |
SetTileSelectSize(1, 1); |
|
661 |
} else { |
|
662 |
int x = _railstation.numtracks; |
|
663 |
int y = _railstation.platlength; |
|
664 |
if (_railstation.orientation == 0) intswap(x,y); |
|
665 |
if(!_remove_button_clicked) |
|
666 |
SetTileSelectSize(x, y); |
|
667 |
} |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
668 |
|
980
6b3163c417ab
(svn r1476) -Fix: [1099209] Catchment area with drag&drop stations (Celestar)
darkvater
parents:
946
diff
changeset
|
669 |
rad = (_patches.modified_catchment) ? CA_TRAIN : 4; |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
670 |
|
0 | 671 |
if (_station_show_coverage) |
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
672 |
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
0 | 673 |
|
674 |
DrawWindowWidgets(w); |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
675 |
|
0 | 676 |
StationPickerDrawSprite(39, 42, _cur_railtype, 2); |
677 |
StationPickerDrawSprite(107, 42, _cur_railtype, 3); |
|
678 |
||
679 |
DrawStringCentered(74, 15, STR_3002_ORIENTATION, 0); |
|
680 |
DrawStringCentered(74, 76, STR_3003_NUMBER_OF_TRACKS, 0); |
|
681 |
DrawStringCentered(74, 101, STR_3004_PLATFORM_LENGTH, 0); |
|
682 |
DrawStringCentered(74, 141, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0); |
|
683 |
||
568
b0d0df062880
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
684 |
DrawStationCoverageAreaText(2, 166, (uint)-1, rad); |
0 | 685 |
} break; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
686 |
|
0 | 687 |
case WE_CLICK: { |
688 |
switch(e->click.widget) { |
|
689 |
case 3: |
|
690 |
case 4: |
|
691 |
_railstation.orientation = e->click.widget - 3; |
|
541 | 692 |
SndPlayFx(SND_15_BEEP); |
0 | 693 |
SetWindowDirty(w); |
694 |
break; |
|
695 |
||
696 |
case 5: |
|
697 |
case 6: |
|
698 |
case 7: |
|
699 |
case 8: |
|
700 |
case 9: |
|
701 |
case 10: |
|
702 |
case 11: |
|
703 |
_railstation.numtracks = (e->click.widget - 5) + 1; |
|
704 |
_railstation.dragdrop = false; |
|
541 | 705 |
SndPlayFx(SND_15_BEEP); |
0 | 706 |
SetWindowDirty(w); |
707 |
break; |
|
708 |
||
709 |
case 12: |
|
710 |
case 13: |
|
711 |
case 14: |
|
712 |
case 15: |
|
713 |
case 16: |
|
714 |
case 17: |
|
715 |
case 18: |
|
716 |
_railstation.platlength = (e->click.widget - 12) + 1; |
|
717 |
_railstation.dragdrop = false; |
|
541 | 718 |
SndPlayFx(SND_15_BEEP); |
0 | 719 |
SetWindowDirty(w); |
720 |
break; |
|
721 |
||
722 |
case 19: |
|
723 |
_railstation.dragdrop ^= true; |
|
541 | 724 |
SndPlayFx(SND_15_BEEP); |
0 | 725 |
SetWindowDirty(w); |
726 |
break; |
|
727 |
||
728 |
case 20: |
|
729 |
case 21: |
|
730 |
_station_show_coverage = e->click.widget - 20; |
|
541 | 731 |
SndPlayFx(SND_15_BEEP); |
0 | 732 |
SetWindowDirty(w); |
733 |
break; |
|
734 |
} |
|
735 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
736 |
|
0 | 737 |
case WE_MOUSELOOP: { |
738 |
if (WP(w,def_d).close) { |
|
739 |
DeleteWindow(w); |
|
740 |
return; |
|
741 |
} |
|
742 |
CheckRedrawStationCoverage(w); |
|
743 |
} break; |
|
1074
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
744 |
|
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
745 |
case WE_DESTROY: |
1116
242ddc1401b5
(svn r1617) -Fix: Ugly hack to only call ResetObjectToPlaceon childwindows of build-toolbar if the window is closed manually (with 'X'); if not checked ResetObjectToPlace is called twice resulting in undesired actions (eg. clicked button is unclicked immediately).
darkvater
parents:
1093
diff
changeset
|
746 |
if (!WP(w,def_d).close) |
242ddc1401b5
(svn r1617) -Fix: Ugly hack to only call ResetObjectToPlaceon childwindows of build-toolbar if the window is closed manually (with 'X'); if not checked ResetObjectToPlace is called twice resulting in undesired actions (eg. clicked button is unclicked immediately).
darkvater
parents:
1093
diff
changeset
|
747 |
ResetObjectToPlace(); |
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
748 |
break; |
0 | 749 |
} |
750 |
} |
|
751 |
||
752 |
static const Widget _station_builder_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
753 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
754 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3000_RAIL_STATION_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
755 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 199, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
756 |
{ WWT_PANEL, RESIZE_NONE, 14, 7, 72, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
757 |
{ WWT_PANEL, RESIZE_NONE, 14, 75, 140, 26, 73, 0x0, STR_304E_SELECT_RAILROAD_STATION}, |
0 | 758 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
759 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 22, 36, 87, 98, STR_00CB_1, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
760 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 37, 51, 87, 98, STR_00CC_2, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
761 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 52, 66, 87, 98, STR_00CD_3, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
762 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 67, 81, 87, 98, STR_00CE_4, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
763 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 82, 96, 87, 98, STR_00CF_5, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
764 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 97, 111, 87, 98, STR_0335_6, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
765 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 112, 126, 87, 98, STR_0336_7, STR_304F_SELECT_NUMBER_OF_PLATFORMS}, |
0 | 766 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
767 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 22, 36, 112, 123, STR_00CB_1, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
768 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 37, 51, 112, 123, STR_00CC_2, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
769 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 52, 66, 112, 123, STR_00CD_3, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
770 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 67, 81, 112, 123, STR_00CE_4, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
771 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 82, 96, 112, 123, STR_00CF_5, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
772 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 97, 111, 112, 123, STR_0335_6, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
773 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 112, 126, 112, 123, STR_0336_7, STR_3050_SELECT_LENGTH_OF_RAILROAD}, |
0 | 774 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
775 |
//{ WWT_CLOSEBOX, RESIZE_NONE, 14, 14, 73, 137, 148, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
776 |
//{ WWT_CLOSEBOX, RESIZE_NONE, 14, 74, 133, 137, 148, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
777 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 37, 111, 126, 137, STR_DRAG_DROP, STR_STATION_DRAG_DROP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
778 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 14, 73, 152, 163, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
779 |
{ 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
|
780 |
{ WIDGETS_END}, |
0 | 781 |
}; |
782 |
||
783 |
static const WindowDesc _station_builder_desc = { |
|
784 |
-1, -1, 148, 200, |
|
785 |
WC_BUILD_STATION,WC_BUILD_TOOLBAR, |
|
786 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
787 |
_station_builder_widgets, |
|
788 |
StationBuildWndProc |
|
789 |
}; |
|
790 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
791 |
static void ShowStationBuilder(void) |
0 | 792 |
{ |
793 |
AllocateWindowDesc(&_station_builder_desc); |
|
794 |
} |
|
795 |
||
796 |
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e) |
|
797 |
{ |
|
798 |
switch(e->event) { |
|
799 |
case WE_PAINT: { |
|
800 |
int r; |
|
801 |
||
802 |
w->click_state = (1 << 3) << _build_depot_direction; |
|
803 |
DrawWindowWidgets(w); |
|
804 |
||
805 |
r = _cur_railtype; |
|
806 |
DrawTrainDepotSprite(70, 17, 0, r); |
|
807 |
DrawTrainDepotSprite(70, 69, 1, r); |
|
808 |
DrawTrainDepotSprite(2, 69, 2, r); |
|
809 |
DrawTrainDepotSprite(2, 17, 3, r); |
|
810 |
break; |
|
811 |
} |
|
812 |
case WE_CLICK: { |
|
813 |
switch(e->click.widget) { |
|
1116
242ddc1401b5
(svn r1617) -Fix: Ugly hack to only call ResetObjectToPlaceon childwindows of build-toolbar if the window is closed manually (with 'X'); if not checked ResetObjectToPlace is called twice resulting in undesired actions (eg. clicked button is unclicked immediately).
darkvater
parents:
1093
diff
changeset
|
814 |
case 3: case 4: case 5: case 6: |
0 | 815 |
_build_depot_direction = e->click.widget - 3; |
541 | 816 |
SndPlayFx(SND_15_BEEP); |
0 | 817 |
SetWindowDirty(w); |
818 |
break; |
|
819 |
} |
|
820 |
} break; |
|
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
821 |
|
0 | 822 |
case WE_MOUSELOOP: |
823 |
if (WP(w,def_d).close) |
|
824 |
DeleteWindow(w); |
|
825 |
return; |
|
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
826 |
|
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
827 |
case WE_DESTROY: |
1116
242ddc1401b5
(svn r1617) -Fix: Ugly hack to only call ResetObjectToPlaceon childwindows of build-toolbar if the window is closed manually (with 'X'); if not checked ResetObjectToPlace is called twice resulting in undesired actions (eg. clicked button is unclicked immediately).
darkvater
parents:
1093
diff
changeset
|
828 |
if (!WP(w,def_d).close) |
242ddc1401b5
(svn r1617) -Fix: Ugly hack to only call ResetObjectToPlaceon childwindows of build-toolbar if the window is closed manually (with 'X'); if not checked ResetObjectToPlace is called twice resulting in undesired actions (eg. clicked button is unclicked immediately).
darkvater
parents:
1093
diff
changeset
|
829 |
ResetObjectToPlace(); |
1072
74cd9150d473
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1071
diff
changeset
|
830 |
break; |
0 | 831 |
} |
832 |
} |
|
833 |
||
834 |
static const Widget _build_depot_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
835 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
836 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
837 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
838 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
839 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
840 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
841 |
{ 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
|
842 |
{ WIDGETS_END}, |
0 | 843 |
}; |
844 |
||
845 |
static const WindowDesc _build_depot_desc = { |
|
846 |
-1,-1, 140, 122, |
|
847 |
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR, |
|
848 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
849 |
_build_depot_widgets, |
|
850 |
BuildTrainDepotWndProc |
|
851 |
}; |
|
852 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
853 |
static void ShowBuildTrainDepotPicker(void) |
0 | 854 |
{ |
855 |
AllocateWindowDesc(&_build_depot_desc); |
|
856 |
} |
|
857 |
||
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
858 |
|
395
788a9bba0889
(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
|
859 |
static void BuildWaypointWndProc(Window *w, WindowEvent *e) |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
860 |
{ |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
861 |
switch(e->event) { |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
862 |
case WE_PAINT: { |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
863 |
int r; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
864 |
|
395
788a9bba0889
(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
|
865 |
w->click_state = (1 << 3) << _cur_waypoint_type; |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
866 |
DrawWindowWidgets(w); |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
867 |
|
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
868 |
r = 4*w->hscroll.pos; |
415
20f981988266
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
869 |
if(r+0<=_waypoint_count) DrawWaypointSprite(2, 25, r + 0, _cur_railtype); |
20f981988266
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
870 |
if(r+1<=_waypoint_count) DrawWaypointSprite(70, 25, r + 1, _cur_railtype); |
20f981988266
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
871 |
if(r+2<=_waypoint_count) DrawWaypointSprite(138, 25, r + 2, _cur_railtype); |
20f981988266
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
872 |
if(r+3<=_waypoint_count) DrawWaypointSprite(206, 25, r + 3, _cur_railtype); |
20f981988266
(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents:
411
diff
changeset
|
873 |
if(r+4<=_waypoint_count) DrawWaypointSprite(274, 25, r + 4, _cur_railtype); |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
874 |
break; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
875 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
876 |
case WE_CLICK: { |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
877 |
switch(e->click.widget) { |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
878 |
case 0: |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
879 |
ResetObjectToPlace(); |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
880 |
break; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
881 |
case 3: |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
882 |
case 4: |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
883 |
case 5: |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
884 |
case 6: |
411
dc46e54bd2ed
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
885 |
case 7: |
395
788a9bba0889
(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
|
886 |
_cur_waypoint_type = e->click.widget - 3; |
541 | 887 |
SndPlayFx(SND_15_BEEP); |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
888 |
SetWindowDirty(w); |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
889 |
break; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
890 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
891 |
break; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
892 |
} |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
893 |
|
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
894 |
case WE_MOUSELOOP: |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
895 |
if (WP(w,def_d).close) |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
896 |
DeleteWindow(w); |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
897 |
return; |
1074
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
898 |
|
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
899 |
case WE_DESTROY: |
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
900 |
ResetObjectToPlace(); |
02884489f8ba
(svn r1575) -Fix: Forgot to exit the construction phase for the waypoint window (if
Celestar
parents:
1072
diff
changeset
|
901 |
break; |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
902 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
903 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
904 |
|
395
788a9bba0889
(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
|
905 |
static const Widget _build_waypoint_widgets[] = { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
906 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
907 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 343, 0, 13, STR_WAYPOINT,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
908 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 343, 14, 91, 0x0, 0}, |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
909 |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
910 |
{ WWT_PANEL, RESIZE_NONE, 7, 3, 68, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
911 |
{ WWT_PANEL, RESIZE_NONE, 7, 71, 136, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
912 |
{ WWT_PANEL, RESIZE_NONE, 7, 139, 204, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
913 |
{ WWT_PANEL, RESIZE_NONE, 7, 207, 272, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
855
diff
changeset
|
914 |
{ WWT_PANEL, RESIZE_NONE, 7, 275, 340, 17, 76, 0x0, STR_WAYPOINT_GRAPHICS_TIP}, |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
915 |
|
894
8b59c639837d
(svn r1380) -Fix: missed widget fixes; thanks Jango and TestMan57
darkvater
parents:
867
diff
changeset
|
916 |
{ WWT_HSCROLLBAR, RESIZE_NONE, 7, 1, 343, 80, 91, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
417 | 917 |
{ WIDGETS_END}, |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
918 |
}; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
919 |
|
395
788a9bba0889
(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
|
920 |
static const WindowDesc _build_waypoint_desc = { |
411
dc46e54bd2ed
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
921 |
-1,-1, 344, 92, |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
922 |
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR, |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
923 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
395
788a9bba0889
(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
|
924 |
_build_waypoint_widgets, |
788a9bba0889
(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
|
925 |
BuildWaypointWndProc |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
926 |
}; |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
927 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
928 |
static void ShowBuildWaypointPicker(void) |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
929 |
{ |
395
788a9bba0889
(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
|
930 |
Window *w = AllocateWindowDesc(&_build_waypoint_desc); |
411
dc46e54bd2ed
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
931 |
w->hscroll.cap = 5; |
dc46e54bd2ed
(svn r608) [newgrf] enabled possibility to build default waypoint when custom waypoints are enabled
dominik
parents:
410
diff
changeset
|
932 |
w->hscroll.count = (uint) (_waypoint_count+4) / 5; |
393
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
933 |
} |
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
934 |
|
e1128b94f3fb
(svn r585) -newgrf: GUI for selecting custom waypoint graphics to use. Patch by dominik81 and pasky.
darkvater
parents:
389
diff
changeset
|
935 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1074
diff
changeset
|
936 |
void InitializeRailGui(void) |
0 | 937 |
{ |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
938 |
_build_depot_direction = 3; |
0 | 939 |
_railstation.numtracks = 1; |
940 |
_railstation.platlength = 1; |
|
941 |
_railstation.dragdrop = true; |
|
942 |
} |