author | miham |
Wed, 17 Aug 2005 12:30:07 +0000 | |
changeset 2349 | df02d0ffb588 |
parent 2186 | 461a2aff3486 |
child 2619 | c2f488e400b1 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1363
diff
changeset
|
4 |
#include "openttd.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1217
diff
changeset
|
5 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
337
diff
changeset
|
6 |
#include "table/strings.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
7 |
#include "functions.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
661
diff
changeset
|
8 |
#include "map.h" |
1209
a1ac96655b79
(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:
1116
diff
changeset
|
9 |
#include "tile.h" |
0 | 10 |
#include "window.h" |
11 |
#include "gui.h" |
|
12 |
#include "viewport.h" |
|
13 |
#include "gfx.h" |
|
337
66647f97e7c0
(svn r513) Merge revisions 402, 416, 417, 478, 479, 511, 512 from map to trunk
tron
parents:
193
diff
changeset
|
14 |
#include "sound.h" |
0 | 15 |
#include "command.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2049
diff
changeset
|
16 |
#include "variables.h" |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
17 |
//needed for catchments |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
18 |
#include "station.h" |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
19 |
|
0 | 20 |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
21 |
static void ShowBusStationPicker(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
22 |
static void ShowTruckStationPicker(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
23 |
static void ShowRoadDepotPicker(void); |
0 | 24 |
|
25 |
static bool _remove_button_clicked; |
|
26 |
static bool _build_road_flag; |
|
27 |
||
28 |
static byte _place_road_flag; |
|
29 |
||
30 |
static byte _road_depot_orientation; |
|
31 |
static byte _road_station_picker_orientation; |
|
32 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
33 |
void CcPlaySound1D(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 34 |
{ |
541 | 35 |
if (success) SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 36 |
} |
37 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
38 |
static void PlaceRoad_NE(TileIndex tile) |
0 | 39 |
{ |
40 |
_place_road_flag = (_tile_fract_coords.y >= 8) + 4; |
|
41 |
VpStartPlaceSizing(tile, VPM_FIX_X); |
|
42 |
} |
|
43 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
44 |
static void PlaceRoad_NW(TileIndex tile) |
0 | 45 |
{ |
46 |
_place_road_flag = (_tile_fract_coords.x >= 8) + 0; |
|
47 |
VpStartPlaceSizing(tile, VPM_FIX_Y); |
|
48 |
} |
|
49 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
50 |
static void PlaceRoad_Bridge(TileIndex tile) |
0 | 51 |
{ |
52 |
VpStartPlaceSizing(tile, VPM_X_OR_Y); |
|
53 |
} |
|
54 |
||
55 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
56 |
void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 57 |
{ |
58 |
if (success) { |
|
541 | 59 |
SndPlayTileFx(SND_20_SPLAT_2, tile); |
0 | 60 |
ResetObjectToPlace(); |
61 |
} else { |
|
62 |
SetRedErrorSquare(_build_tunnel_endtile); |
|
63 |
} |
|
64 |
} |
|
65 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
66 |
static void PlaceRoad_Tunnel(TileIndex tile) |
0 | 67 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
68 |
DoCommandP(tile, 0x200, 0, CcBuildRoadTunnel, CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE)); |
0 | 69 |
} |
70 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
71 |
static void BuildRoadOutsideStation(TileIndex tile, int direction) |
0 | 72 |
{ |
73 |
static const byte _roadbits_by_dir[4] = {2,1,8,4}; |
|
900 | 74 |
tile += TileOffsByDir(direction); |
5
539c9743d999
(svn r6) -Fix [1006530] BuildRoadOutsideStation fix. Fix bug [994720] road depot - bus/lorry station (Truelight+Darkvater :P )
darkvater
parents:
0
diff
changeset
|
75 |
// if there is a roadpiece just outside of the station entrance, build a connecting route |
2049
ad0d49c916d4
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1990
diff
changeset
|
76 |
if (IsTileType(tile, MP_STREET) && !(_m[tile].m5 & 0x20)) { |
0 | 77 |
DoCommandP(tile, _roadbits_by_dir[direction], 0, NULL, CMD_BUILD_ROAD); |
78 |
} |
|
79 |
} |
|
80 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
81 |
void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 82 |
{ |
83 |
if (success) { |
|
541 | 84 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 85 |
ResetObjectToPlace(); |
86 |
BuildRoadOutsideStation(tile, (int)p1); |
|
87 |
} |
|
88 |
} |
|
89 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
90 |
static void PlaceRoad_Depot(TileIndex tile) |
0 | 91 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
92 |
DoCommandP(tile, _road_depot_orientation, 0, CcRoadDepot, CMD_BUILD_ROAD_DEPOT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1807_CAN_T_BUILD_ROAD_VEHICLE)); |
0 | 93 |
} |
94 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
95 |
static void PlaceRoad_BusStation(TileIndex tile) |
0 | 96 |
{ |
1217
ab9f02a224ab
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1209
diff
changeset
|
97 |
DoCommandP(tile, _road_station_picker_orientation, RS_BUS, CcRoadDepot, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1808_CAN_T_BUILD_BUS_STATION)); |
0 | 98 |
} |
99 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
100 |
static void PlaceRoad_TruckStation(TileIndex tile) |
0 | 101 |
{ |
1217
ab9f02a224ab
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1209
diff
changeset
|
102 |
DoCommandP(tile, _road_station_picker_orientation, RS_TRUCK, CcRoadDepot, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1809_CAN_T_BUILD_TRUCK_STATION)); |
0 | 103 |
} |
104 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
105 |
static void PlaceRoad_DemolishArea(TileIndex tile) |
0 | 106 |
{ |
107 |
VpStartPlaceSizing(tile, 4); |
|
108 |
} |
|
109 |
||
110 |
typedef void OnButtonClick(Window *w); |
|
111 |
||
112 |
static void BuildRoadClick_NE(Window *w) |
|
113 |
{ |
|
114 |
_build_road_flag = 0; |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
115 |
HandlePlacePushButton(w, 3, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE); |
0 | 116 |
} |
117 |
||
118 |
static void BuildRoadClick_NW(Window *w) |
|
119 |
{ |
|
120 |
_build_road_flag = 0; |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
121 |
HandlePlacePushButton(w, 4, SPR_CURSOR_ROAD_NWSE, 1, PlaceRoad_NW); |
0 | 122 |
} |
123 |
||
124 |
||
125 |
static void BuildRoadClick_Demolish(Window *w) |
|
126 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
127 |
HandlePlacePushButton(w, 5, ANIMCURSOR_DEMOLISH, 1, PlaceRoad_DemolishArea); |
0 | 128 |
} |
129 |
||
130 |
static void BuildRoadClick_Depot(Window *w) |
|
131 |
{ |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
132 |
if (_game_mode == GM_EDITOR) return; |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
133 |
if (HandlePlacePushButton(w, 6, SPR_CURSOR_ROAD_DEPOT, 1, PlaceRoad_Depot)) ShowRoadDepotPicker(); |
0 | 134 |
} |
135 |
||
136 |
static void BuildRoadClick_BusStation(Window *w) |
|
137 |
{ |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
138 |
if (_game_mode == GM_EDITOR) return; |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
139 |
if (HandlePlacePushButton(w, 7, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowBusStationPicker(); |
0 | 140 |
} |
141 |
||
142 |
static void BuildRoadClick_TruckStation(Window *w) |
|
143 |
{ |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
144 |
if (_game_mode == GM_EDITOR) return; |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
145 |
if (HandlePlacePushButton(w, 8, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker(); |
0 | 146 |
} |
147 |
||
148 |
static void BuildRoadClick_Bridge(Window *w) |
|
149 |
{ |
|
150 |
_build_road_flag = 0; |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
151 |
HandlePlacePushButton(w, 9, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge); |
0 | 152 |
} |
153 |
||
154 |
static void BuildRoadClick_Tunnel(Window *w) |
|
155 |
{ |
|
156 |
_build_road_flag = 0; |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
157 |
HandlePlacePushButton(w, 10, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel); |
0 | 158 |
} |
159 |
||
160 |
static void BuildRoadClick_Remove(Window *w) |
|
161 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
162 |
if (w->disabled_state & (1<<11)) |
0 | 163 |
return; |
164 |
SetWindowDirty(w); |
|
541 | 165 |
SndPlayFx(SND_15_BEEP); |
1990
90eb49e87b90
(svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents:
1977
diff
changeset
|
166 |
w->click_state ^= (1 << 11); |
90eb49e87b90
(svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents:
1977
diff
changeset
|
167 |
SetSelectionRed((w->click_state & (1 << 11)) != 0); |
0 | 168 |
} |
169 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
170 |
static void BuildRoadClick_Landscaping(Window *w) |
0 | 171 |
{ |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
172 |
ShowTerraformToolbar(); |
0 | 173 |
} |
174 |
||
175 |
static OnButtonClick * const _build_road_button_proc[] = { |
|
176 |
BuildRoadClick_NE, |
|
177 |
BuildRoadClick_NW, |
|
178 |
BuildRoadClick_Demolish, |
|
179 |
BuildRoadClick_Depot, |
|
180 |
BuildRoadClick_BusStation, |
|
181 |
BuildRoadClick_TruckStation, |
|
182 |
BuildRoadClick_Bridge, |
|
183 |
BuildRoadClick_Tunnel, |
|
184 |
BuildRoadClick_Remove, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
185 |
BuildRoadClick_Landscaping, |
0 | 186 |
}; |
187 |
||
188 |
static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) { |
|
189 |
switch(e->event) { |
|
190 |
case WE_PAINT: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
191 |
w->disabled_state &= ~(1 << 11); |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
192 |
if (!(w->click_state & ((1<<3)|(1<<4)))) { |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
193 |
w->disabled_state |= (1 << 11); |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
194 |
w->click_state &= ~(1<<11); |
0 | 195 |
} |
196 |
DrawWindowWidgets(w); |
|
197 |
break; |
|
198 |
||
199 |
case WE_CLICK: { |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
200 |
if (e->click.widget >= 3) |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
201 |
_build_road_button_proc[e->click.widget - 3](w); |
0 | 202 |
} break; |
203 |
||
204 |
case WE_KEYPRESS: |
|
205 |
switch(e->keypress.keycode) { |
|
206 |
case '1': BuildRoadClick_NE(w); break; |
|
207 |
case '2': BuildRoadClick_NW(w); break; |
|
208 |
case '3': BuildRoadClick_Demolish(w); break; |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
209 |
case '4': BuildRoadClick_Depot(w); break; |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
210 |
case '5': BuildRoadClick_BusStation(w); break; |
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
211 |
case '6': BuildRoadClick_TruckStation(w); break; |
0 | 212 |
case 'B': BuildRoadClick_Bridge(w); break; |
213 |
case 'T': BuildRoadClick_Tunnel(w); break; |
|
214 |
case 'R': BuildRoadClick_Remove(w); break; |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
215 |
case 'L': BuildRoadClick_Landscaping(w); break; |
0 | 216 |
default: |
217 |
return; |
|
218 |
} |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
219 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 220 |
e->keypress.cont = false; |
221 |
break; |
|
222 |
||
223 |
case WE_PLACE_OBJ: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
224 |
_remove_button_clicked = (w->click_state & (1 << 11)) != 0; |
0 | 225 |
_place_proc(e->place.tile); |
226 |
break; |
|
227 |
||
228 |
case WE_ABORT_PLACE_OBJ: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
229 |
UnclickWindowButtons(w); |
0 | 230 |
SetWindowDirty(w); |
231 |
||
232 |
w = FindWindowById(WC_BUS_STATION, 0); |
|
233 |
if (w != NULL) WP(w,def_d).close=true; |
|
234 |
w = FindWindowById(WC_TRUCK_STATION, 0); |
|
235 |
if (w != NULL) WP(w,def_d).close=true; |
|
236 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
|
237 |
if (w != NULL) WP(w,def_d).close=true; |
|
238 |
break; |
|
239 |
||
240 |
case WE_PLACE_DRAG: { |
|
241 |
int sel_method; |
|
242 |
if (e->place.userdata == 1) { |
|
243 |
sel_method = VPM_FIX_X; |
|
244 |
_place_road_flag = (_place_road_flag&~2) | ((e->place.pt.y&8)>>2); |
|
245 |
} else if (e->place.userdata == 2) { |
|
246 |
sel_method = VPM_FIX_Y; |
|
247 |
_place_road_flag = (_place_road_flag&~2) | ((e->place.pt.x&8)>>2); |
|
248 |
} else if (e->place.userdata == 4) { |
|
249 |
sel_method = VPM_X_AND_Y; |
|
250 |
} else { |
|
251 |
sel_method = VPM_X_OR_Y; |
|
252 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
253 |
|
0 | 254 |
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, sel_method); |
255 |
return; |
|
256 |
} |
|
257 |
||
258 |
case WE_PLACE_MOUSEUP: |
|
259 |
if (e->place.pt.x != -1) { |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
260 |
TileIndex start_tile = e->place.starttile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
261 |
TileIndex end_tile = e->place.tile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
262 |
|
0 | 263 |
if (e->place.userdata == 0) { |
264 |
ResetObjectToPlace(); |
|
265 |
ShowBuildBridgeWindow(start_tile, end_tile, 0x80); |
|
266 |
} else if (e->place.userdata != 4) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
267 |
DoCommandP(end_tile, start_tile, _place_road_flag, CcPlaySound1D, |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
268 |
_remove_button_clicked ? |
0 | 269 |
CMD_REMOVE_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1805_CAN_T_REMOVE_ROAD_FROM) : |
270 |
CMD_BUILD_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1804_CAN_T_BUILD_ROAD_HERE)); |
|
271 |
} else { |
|
272 |
DoCommandP(end_tile, start_tile, _place_road_flag, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
|
273 |
} |
|
274 |
} |
|
275 |
break; |
|
276 |
||
277 |
case WE_PLACE_PRESIZE: { |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
278 |
TileIndex tile = e->place.tile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
279 |
|
0 | 280 |
DoCommandByTile(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
281 |
VpSetPresizeRange(tile, _build_tunnel_endtile==0?tile:_build_tunnel_endtile); |
|
282 |
break; |
|
283 |
} |
|
284 |
} |
|
285 |
} |
|
286 |
||
287 |
static const Widget _build_road_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
288 |
{ 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:
787
diff
changeset
|
289 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 227, 0, 13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
290 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 228, 239, 0, 13, 0x0, STR_STICKY_BUTTON}, |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
291 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
292 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_ROAD_NW, STR_180B_BUILD_ROAD_SECTION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
293 |
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_ROAD_NE, STR_180B_BUILD_ROAD_SECTION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
294 |
{ WWT_PANEL, RESIZE_NONE, 7, 44, 65, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
295 |
{ WWT_PANEL, RESIZE_NONE, 7, 66, 87, 14, 35, SPR_IMG_ROAD_DEPOT, STR_180C_BUILD_ROAD_VEHICLE_DEPOT}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
296 |
{ WWT_PANEL, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_BUS_STATION, STR_180D_BUILD_BUS_STATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
297 |
{ WWT_PANEL, RESIZE_NONE, 7, 110, 131, 14, 35, SPR_IMG_TRUCK_BAY, STR_180E_BUILD_TRUCK_LOADING_BAY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
298 |
{ WWT_PANEL, RESIZE_NONE, 7, 132, 173, 14, 35, SPR_IMG_BRIDGE, STR_180F_BUILD_ROAD_BRIDGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
299 |
{ WWT_PANEL, RESIZE_NONE, 7, 174, 195, 14, 35, SPR_IMG_ROAD_TUNNEL, STR_1810_BUILD_ROAD_TUNNEL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
300 |
{ WWT_PANEL, RESIZE_NONE, 7, 196, 217, 14, 35, SPR_IMG_REMOVE, STR_1811_TOGGLE_BUILD_REMOVE_FOR}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
301 |
{ WWT_PANEL, RESIZE_NONE, 7, 218, 239, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
5
diff
changeset
|
302 |
{ WIDGETS_END}, |
0 | 303 |
}; |
304 |
||
305 |
static const WindowDesc _build_road_desc = { |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
306 |
640-240, 22, 240, 36, |
0 | 307 |
WC_BUILD_TOOLBAR,0, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
308 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 309 |
_build_road_widgets, |
310 |
BuildRoadToolbWndProc |
|
311 |
}; |
|
312 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
313 |
void ShowBuildRoadToolbar(void) |
0 | 314 |
{ |
946
81cf624bbdc5
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
900
diff
changeset
|
315 |
if (_current_player == OWNER_SPECTATOR) return; |
0 | 316 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
317 |
AllocateWindowDesc(&_build_road_desc); |
|
318 |
} |
|
319 |
||
320 |
static const Widget _build_road_scen_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
321 |
{ WWT_TEXTBTN, 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:
787
diff
changeset
|
322 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 161, 0, 13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
323 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 162, 173, 0, 13, 0x0, STR_STICKY_BUTTON}, |
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
324 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
325 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, 0x51D, STR_180B_BUILD_ROAD_SECTION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
326 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, 0x51E, STR_180B_BUILD_ROAD_SECTION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
327 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 44, 65, 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:
787
diff
changeset
|
328 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
329 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
330 |
{ WWT_EMPTY, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
331 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 66, 107, 14, 35, 0xA22, STR_180F_BUILD_ROAD_BRIDGE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
332 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 108, 129, 14, 35, 0x97D, STR_1810_BUILD_ROAD_TUNNEL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
333 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 130, 151, 14, 35, 0x2CA, STR_1811_TOGGLE_BUILD_REMOVE_FOR}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
334 |
{ WWT_PANEL, RESIZE_NONE, 7, 152, 173, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
5
diff
changeset
|
335 |
{ WIDGETS_END}, |
0 | 336 |
}; |
337 |
||
338 |
static const WindowDesc _build_road_scen_desc = { |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
339 |
-1, -1, 174, 36, |
0 | 340 |
WC_SCEN_BUILD_ROAD,0, |
777
3d7798da0f10
(svn r1243) -Fix: Scenario road-building toolbar also stickified. Thx for the notice teeone
darkvater
parents:
756
diff
changeset
|
341 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 342 |
_build_road_scen_widgets, |
343 |
BuildRoadToolbWndProc |
|
344 |
}; |
|
345 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
346 |
void ShowBuildRoadScenToolbar(void) |
0 | 347 |
{ |
348 |
AllocateWindowDescFront(&_build_road_scen_desc, 0); |
|
349 |
} |
|
350 |
||
351 |
static void BuildRoadDepotWndProc(Window *w, WindowEvent *e) { |
|
352 |
switch(e->event) { |
|
353 |
case WE_PAINT: |
|
354 |
w->click_state = (1<<3) << _road_depot_orientation; |
|
355 |
DrawWindowWidgets(w); |
|
356 |
||
357 |
DrawRoadDepotSprite(70, 17, 0); |
|
358 |
DrawRoadDepotSprite(70, 69, 1); |
|
359 |
DrawRoadDepotSprite(2, 69, 2); |
|
360 |
DrawRoadDepotSprite(2, 17, 3); |
|
361 |
break; |
|
362 |
||
363 |
case WE_CLICK: { |
|
1116
a38aed715c95
(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:
1109
diff
changeset
|
364 |
switch (e->click.widget) { |
a38aed715c95
(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:
1109
diff
changeset
|
365 |
case 3: case 4: case 5: case 6: |
0 | 366 |
_road_depot_orientation = e->click.widget - 3; |
541 | 367 |
SndPlayFx(SND_15_BEEP); |
0 | 368 |
SetWindowDirty(w); |
369 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
370 |
} |
0 | 371 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
372 |
|
0 | 373 |
case WE_MOUSELOOP: |
374 |
if (WP(w,def_d).close) |
|
375 |
DeleteWindow(w); |
|
376 |
break; |
|
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
377 |
|
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
378 |
case WE_DESTROY: |
1116
a38aed715c95
(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:
1109
diff
changeset
|
379 |
if (!WP(w,def_d).close) |
a38aed715c95
(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:
1109
diff
changeset
|
380 |
ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
381 |
break; |
0 | 382 |
} |
383 |
} |
|
384 |
||
385 |
static const Widget _build_road_depot_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
386 |
{ 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:
787
diff
changeset
|
387 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_1806_ROAD_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:
787
diff
changeset
|
388 |
{ 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:
787
diff
changeset
|
389 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
390 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
391 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
392 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
5
diff
changeset
|
393 |
{ WIDGETS_END}, |
0 | 394 |
}; |
395 |
||
396 |
static const WindowDesc _build_road_depot_desc = { |
|
397 |
-1,-1, 140, 122, |
|
398 |
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR, |
|
399 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
400 |
_build_road_depot_widgets, |
|
401 |
BuildRoadDepotWndProc |
|
402 |
}; |
|
403 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
404 |
static void ShowRoadDepotPicker(void) |
0 | 405 |
{ |
406 |
AllocateWindowDesc(&_build_road_depot_desc); |
|
407 |
} |
|
408 |
||
987
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
409 |
static void RoadStationPickerWndProc(Window *w, WindowEvent *e) |
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
410 |
{ |
0 | 411 |
switch(e->event) { |
412 |
case WE_PAINT: { |
|
413 |
int image; |
|
414 |
||
987
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
415 |
if (WP(w,def_d).close) return; |
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
416 |
|
0 | 417 |
w->click_state = ((1<<3) << _road_station_picker_orientation) | |
418 |
((1<<7) << _station_show_coverage); |
|
419 |
DrawWindowWidgets(w); |
|
420 |
||
987
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
421 |
if (_station_show_coverage) { |
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
422 |
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : 4; |
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
423 |
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
424 |
} else |
ea47ad079de8
(svn r1485) -Fix: [1031451] Catchment area shows when buying sign. Catchment area wasn't reset when road station window was unselected
darkvater
parents:
946
diff
changeset
|
425 |
SetTileSelectSize(1, 1); |
0 | 426 |
|
427 |
image = (w->window_class == WC_BUS_STATION) ? 0x47 : 0x43; |
|
428 |
||
429 |
StationPickerDrawSprite(103, 35, 0, image); |
|
430 |
StationPickerDrawSprite(103, 85, 0, image+1); |
|
431 |
StationPickerDrawSprite(35, 85, 0, image+2); |
|
432 |
StationPickerDrawSprite(35, 35, 0, image+3); |
|
433 |
||
434 |
DrawStringCentered(70, 120, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0); |
|
435 |
DrawStationCoverageAreaText(2, 146, |
|
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
436 |
((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)), |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
437 |
3); |
0 | 438 |
|
439 |
} break; |
|
440 |
||
441 |
case WE_CLICK: { |
|
1116
a38aed715c95
(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:
1109
diff
changeset
|
442 |
switch (e->click.widget) { |
a38aed715c95
(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:
1109
diff
changeset
|
443 |
case 3: case 4: case 5: case 6: |
0 | 444 |
_road_station_picker_orientation = e->click.widget - 3; |
541 | 445 |
SndPlayFx(SND_15_BEEP); |
0 | 446 |
SetWindowDirty(w); |
447 |
break; |
|
1116
a38aed715c95
(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:
1109
diff
changeset
|
448 |
case 7: case 8: |
0 | 449 |
_station_show_coverage = e->click.widget - 7; |
541 | 450 |
SndPlayFx(SND_15_BEEP); |
0 | 451 |
SetWindowDirty(w); |
452 |
break; |
|
453 |
} |
|
454 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
455 |
|
0 | 456 |
case WE_MOUSELOOP: { |
457 |
if (WP(w,def_d).close) { |
|
458 |
DeleteWindow(w); |
|
459 |
return; |
|
460 |
} |
|
461 |
||
462 |
CheckRedrawStationCoverage(w); |
|
463 |
} break; |
|
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
464 |
|
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
465 |
case WE_DESTROY: |
1116
a38aed715c95
(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:
1109
diff
changeset
|
466 |
if (!WP(w,def_d).close) |
a38aed715c95
(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:
1109
diff
changeset
|
467 |
ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
468 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
469 |
} |
0 | 470 |
} |
471 |
||
472 |
static const Widget _bus_station_picker_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
473 |
{ 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:
787
diff
changeset
|
474 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_3042_BUS_STATION_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
475 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 176, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
476 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
477 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
478 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
479 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
480 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 10, 69, 133, 144, 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:
787
diff
changeset
|
481 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 70, 129, 133, 144, 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:
5
diff
changeset
|
482 |
{ WIDGETS_END}, |
0 | 483 |
}; |
484 |
||
485 |
static const WindowDesc _bus_station_picker_desc = { |
|
486 |
-1,-1, 140, 177, |
|
487 |
WC_BUS_STATION,WC_BUILD_TOOLBAR, |
|
488 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
489 |
_bus_station_picker_widgets, |
|
490 |
RoadStationPickerWndProc |
|
491 |
}; |
|
492 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
493 |
static void ShowBusStationPicker(void) |
0 | 494 |
{ |
495 |
AllocateWindowDesc(&_bus_station_picker_desc); |
|
496 |
} |
|
497 |
||
498 |
static const Widget _truck_station_picker_widgets[] = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
499 |
{ 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:
787
diff
changeset
|
500 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_3043_TRUCK_STATION_ORIENT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
501 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 176, 0x0, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
502 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
503 |
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
504 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
505 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
506 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 10, 69, 133, 144, 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:
787
diff
changeset
|
507 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 70, 129, 133, 144, 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:
5
diff
changeset
|
508 |
{ WIDGETS_END}, |
0 | 509 |
}; |
510 |
||
511 |
static const WindowDesc _truck_station_picker_desc = { |
|
512 |
-1,-1, 140, 177, |
|
513 |
WC_TRUCK_STATION,WC_BUILD_TOOLBAR, |
|
514 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
515 |
_truck_station_picker_widgets, |
|
516 |
RoadStationPickerWndProc |
|
517 |
}; |
|
518 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
519 |
static void ShowTruckStationPicker(void) |
0 | 520 |
{ |
521 |
AllocateWindowDesc(&_truck_station_picker_desc); |
|
522 |
} |
|
523 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1072
diff
changeset
|
524 |
void InitializeRoadGui(void) |
0 | 525 |
{ |
526 |
_road_depot_orientation = 3; |
|
527 |
_road_station_picker_orientation = 3; |
|
528 |
} |