author | peter1138 |
Fri, 09 Jun 2006 16:35:07 +0000 | |
changeset 3997 | 29c77eab14a4 |
parent 3793 | 33cdb5bf7b21 |
child 4000 | bab1ebc37da0 |
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" |
3150
025fe8cd7104
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3132
diff
changeset
|
5 |
#include "road_map.h" |
1363
01d3de5d8039
(svn r1867) Include tables/sprites.h only in files which need it
tron
parents:
1217
diff
changeset
|
6 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
337
diff
changeset
|
7 |
#include "table/strings.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
8 |
#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
|
9 |
#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
|
10 |
#include "tile.h" |
0 | 11 |
#include "window.h" |
12 |
#include "gui.h" |
|
13 |
#include "viewport.h" |
|
14 |
#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
|
15 |
#include "sound.h" |
0 | 16 |
#include "command.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2049
diff
changeset
|
17 |
#include "variables.h" |
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
18 |
//needed for catchments |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
19 |
#include "station.h" |
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
20 |
|
0 | 21 |
|
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
|
22 |
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
|
23 |
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
|
24 |
static void ShowRoadDepotPicker(void); |
0 | 25 |
|
26 |
static bool _remove_button_clicked; |
|
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 |
||
3151 | 71 |
static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction) |
0 | 72 |
{ |
900 | 73 |
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
|
74 |
// if there is a roadpiece just outside of the station entrance, build a connecting route |
3793
33cdb5bf7b21
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3491
diff
changeset
|
75 |
if (IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) { |
3151 | 76 |
DoCommandP(tile, DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD); |
0 | 77 |
} |
78 |
} |
|
79 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
80 |
void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 81 |
{ |
82 |
if (success) { |
|
541 | 83 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 84 |
ResetObjectToPlace(); |
3151 | 85 |
BuildRoadOutsideStation(tile, p1); |
0 | 86 |
} |
87 |
} |
|
88 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
89 |
static void PlaceRoad_Depot(TileIndex tile) |
0 | 90 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
91 |
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 | 92 |
} |
93 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
94 |
static void PlaceRoad_BusStation(TileIndex tile) |
0 | 95 |
{ |
1217
ab9f02a224ab
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1209
diff
changeset
|
96 |
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 | 97 |
} |
98 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
99 |
static void PlaceRoad_TruckStation(TileIndex tile) |
0 | 100 |
{ |
1217
ab9f02a224ab
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1209
diff
changeset
|
101 |
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 | 102 |
} |
103 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
104 |
static void PlaceRoad_DemolishArea(TileIndex tile) |
0 | 105 |
{ |
106 |
VpStartPlaceSizing(tile, 4); |
|
107 |
} |
|
108 |
||
109 |
typedef void OnButtonClick(Window *w); |
|
110 |
||
111 |
static void BuildRoadClick_NE(Window *w) |
|
112 |
{ |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
113 |
HandlePlacePushButton(w, 3, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE); |
0 | 114 |
} |
115 |
||
116 |
static void BuildRoadClick_NW(Window *w) |
|
117 |
{ |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
118 |
HandlePlacePushButton(w, 4, SPR_CURSOR_ROAD_NWSE, 1, PlaceRoad_NW); |
0 | 119 |
} |
120 |
||
121 |
||
122 |
static void BuildRoadClick_Demolish(Window *w) |
|
123 |
{ |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
124 |
HandlePlacePushButton(w, 5, ANIMCURSOR_DEMOLISH, 1, PlaceRoad_DemolishArea); |
0 | 125 |
} |
126 |
||
127 |
static void BuildRoadClick_Depot(Window *w) |
|
128 |
{ |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
129 |
if (_game_mode == GM_EDITOR) return; |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
130 |
if (HandlePlacePushButton(w, 6, SPR_CURSOR_ROAD_DEPOT, 1, PlaceRoad_Depot)) ShowRoadDepotPicker(); |
0 | 131 |
} |
132 |
||
133 |
static void BuildRoadClick_BusStation(Window *w) |
|
134 |
{ |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
135 |
if (_game_mode == GM_EDITOR) return; |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
136 |
if (HandlePlacePushButton(w, 7, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowBusStationPicker(); |
0 | 137 |
} |
138 |
||
139 |
static void BuildRoadClick_TruckStation(Window *w) |
|
140 |
{ |
|
661
a0bdbdffb06a
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
651
diff
changeset
|
141 |
if (_game_mode == GM_EDITOR) return; |
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
142 |
if (HandlePlacePushButton(w, 8, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker(); |
0 | 143 |
} |
144 |
||
145 |
static void BuildRoadClick_Bridge(Window *w) |
|
146 |
{ |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
147 |
HandlePlacePushButton(w, 9, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge); |
0 | 148 |
} |
149 |
||
150 |
static void BuildRoadClick_Tunnel(Window *w) |
|
151 |
{ |
|
1914
5ede46fd496f
(svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents:
1891
diff
changeset
|
152 |
HandlePlacePushButton(w, 10, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel); |
0 | 153 |
} |
154 |
||
155 |
static void BuildRoadClick_Remove(Window *w) |
|
156 |
{ |
|
2635 | 157 |
if (HASBIT(w->disabled_state, 11)) return; |
0 | 158 |
SetWindowDirty(w); |
541 | 159 |
SndPlayFx(SND_15_BEEP); |
2635 | 160 |
TOGGLEBIT(w->click_state, 11); |
3132
724ede39bda9
(svn r3747) Change HASBIT() to return 0/1 instead of 0/value of tested bit, because the name suggests it does the former and current behavior broke in some places in very subtle ways (for example HASBIT(x, 0) != HASBIT(y, 1) doesn't work, returning a bool after HASBIT(x, 9) neither)
tron
parents:
2952
diff
changeset
|
161 |
SetSelectionRed(HASBIT(w->click_state, 11)); |
0 | 162 |
} |
163 |
||
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
164 |
static void BuildRoadClick_Landscaping(Window *w) |
0 | 165 |
{ |
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
166 |
ShowTerraformToolbar(); |
0 | 167 |
} |
168 |
||
2639 | 169 |
static OnButtonClick* const _build_road_button_proc[] = { |
0 | 170 |
BuildRoadClick_NE, |
171 |
BuildRoadClick_NW, |
|
172 |
BuildRoadClick_Demolish, |
|
173 |
BuildRoadClick_Depot, |
|
174 |
BuildRoadClick_BusStation, |
|
175 |
BuildRoadClick_TruckStation, |
|
176 |
BuildRoadClick_Bridge, |
|
177 |
BuildRoadClick_Tunnel, |
|
178 |
BuildRoadClick_Remove, |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
179 |
BuildRoadClick_Landscaping, |
0 | 180 |
}; |
181 |
||
2639 | 182 |
static void BuildRoadToolbWndProc(Window* w, WindowEvent* e) |
183 |
{ |
|
184 |
switch (e->event) { |
|
0 | 185 |
case WE_PAINT: |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
186 |
w->disabled_state &= ~(1 << 11); |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
187 |
if (!(w->click_state & ((1<<3)|(1<<4)))) { |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
188 |
w->disabled_state |= (1 << 11); |
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
189 |
w->click_state &= ~(1<<11); |
0 | 190 |
} |
191 |
DrawWindowWidgets(w); |
|
192 |
break; |
|
193 |
||
194 |
case WE_CLICK: { |
|
2639 | 195 |
if (e->click.widget >= 3) _build_road_button_proc[e->click.widget - 3](w); |
0 | 196 |
} break; |
197 |
||
198 |
case WE_KEYPRESS: |
|
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
199 |
switch (e->keypress.keycode) { |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
200 |
case '1': BuildRoadClick_NE(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
201 |
case '2': BuildRoadClick_NW(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
202 |
case '3': BuildRoadClick_Demolish(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
203 |
case '4': BuildRoadClick_Depot(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
204 |
case '5': BuildRoadClick_BusStation(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
205 |
case '6': BuildRoadClick_TruckStation(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
206 |
case 'B': BuildRoadClick_Bridge(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
207 |
case 'T': BuildRoadClick_Tunnel(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
208 |
case 'R': BuildRoadClick_Remove(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
209 |
case 'L': BuildRoadClick_Landscaping(w); break; |
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2619
diff
changeset
|
210 |
default: return; |
0 | 211 |
} |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
212 |
MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection |
0 | 213 |
e->keypress.cont = false; |
214 |
break; |
|
215 |
||
216 |
case WE_PLACE_OBJ: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
217 |
_remove_button_clicked = (w->click_state & (1 << 11)) != 0; |
0 | 218 |
_place_proc(e->place.tile); |
219 |
break; |
|
220 |
||
221 |
case WE_ABORT_PLACE_OBJ: |
|
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
222 |
UnclickWindowButtons(w); |
0 | 223 |
SetWindowDirty(w); |
224 |
||
225 |
w = FindWindowById(WC_BUS_STATION, 0); |
|
2639 | 226 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 227 |
w = FindWindowById(WC_TRUCK_STATION, 0); |
2639 | 228 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 229 |
w = FindWindowById(WC_BUILD_DEPOT, 0); |
2639 | 230 |
if (w != NULL) WP(w,def_d).close = true; |
0 | 231 |
break; |
232 |
||
233 |
case WE_PLACE_DRAG: { |
|
234 |
int sel_method; |
|
235 |
if (e->place.userdata == 1) { |
|
236 |
sel_method = VPM_FIX_X; |
|
237 |
_place_road_flag = (_place_road_flag&~2) | ((e->place.pt.y&8)>>2); |
|
238 |
} else if (e->place.userdata == 2) { |
|
239 |
sel_method = VPM_FIX_Y; |
|
240 |
_place_road_flag = (_place_road_flag&~2) | ((e->place.pt.x&8)>>2); |
|
241 |
} else if (e->place.userdata == 4) { |
|
242 |
sel_method = VPM_X_AND_Y; |
|
243 |
} else { |
|
244 |
sel_method = VPM_X_OR_Y; |
|
245 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
246 |
|
0 | 247 |
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, sel_method); |
248 |
return; |
|
249 |
} |
|
250 |
||
251 |
case WE_PLACE_MOUSEUP: |
|
252 |
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
|
253 |
TileIndex start_tile = e->place.starttile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
254 |
TileIndex end_tile = e->place.tile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
255 |
|
0 | 256 |
if (e->place.userdata == 0) { |
257 |
ResetObjectToPlace(); |
|
258 |
ShowBuildBridgeWindow(start_tile, end_tile, 0x80); |
|
259 |
} else if (e->place.userdata != 4) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
260 |
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
|
261 |
_remove_button_clicked ? |
0 | 262 |
CMD_REMOVE_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1805_CAN_T_REMOVE_ROAD_FROM) : |
263 |
CMD_BUILD_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1804_CAN_T_BUILD_ROAD_HERE)); |
|
264 |
} else { |
|
265 |
DoCommandP(end_tile, start_tile, _place_road_flag, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA)); |
|
266 |
} |
|
267 |
} |
|
268 |
break; |
|
269 |
||
270 |
case WE_PLACE_PRESIZE: { |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
271 |
TileIndex tile = e->place.tile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
272 |
|
3491
4c8427796c64
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents:
3151
diff
changeset
|
273 |
DoCommand(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL); |
0 | 274 |
VpSetPresizeRange(tile, _build_tunnel_endtile==0?tile:_build_tunnel_endtile); |
275 |
break; |
|
276 |
} |
|
2619
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
277 |
|
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
278 |
case WE_DESTROY: |
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
279 |
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
280 |
break; |
0 | 281 |
} |
282 |
} |
|
283 |
||
284 |
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
|
285 |
{ 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
|
286 |
{ 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
|
287 |
{ 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
|
288 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
289 |
{ 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
|
290 |
{ 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
|
291 |
{ 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
|
292 |
{ 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
|
293 |
{ 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
|
294 |
{ 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
|
295 |
{ 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
|
296 |
{ 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
|
297 |
{ 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
|
298 |
{ 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
|
299 |
{ WIDGETS_END}, |
0 | 300 |
}; |
301 |
||
302 |
static const WindowDesc _build_road_desc = { |
|
606
0e507bb0f63a
(svn r1030) Some toolbar icons are arranged differently:
dominik
parents:
568
diff
changeset
|
303 |
640-240, 22, 240, 36, |
0 | 304 |
WC_BUILD_TOOLBAR,0, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
679
diff
changeset
|
305 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 306 |
_build_road_widgets, |
307 |
BuildRoadToolbWndProc |
|
308 |
}; |
|
309 |
||
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
|
310 |
void ShowBuildRoadToolbar(void) |
0 | 311 |
{ |
946
81cf624bbdc5
(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
dominik
parents:
900
diff
changeset
|
312 |
if (_current_player == OWNER_SPECTATOR) return; |
0 | 313 |
DeleteWindowById(WC_BUILD_TOOLBAR, 0); |
314 |
AllocateWindowDesc(&_build_road_desc); |
|
2619
c2f488e400b1
(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.
peter1138
parents:
2186
diff
changeset
|
315 |
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(); |
0 | 316 |
} |
317 |
||
318 |
static const Widget _build_road_scen_widgets[] = { |
|
2725
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
319 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
320 |
{ 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
|
321 |
{ 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
|
322 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
787
diff
changeset
|
323 |
{ 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
|
324 |
{ 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
|
325 |
{ 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
|
326 |
{ 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
|
327 |
{ 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
|
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_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
|
330 |
{ 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
|
331 |
{ 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
|
332 |
{ 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
|
333 |
{ WIDGETS_END}, |
0 | 334 |
}; |
335 |
||
336 |
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
|
337 |
-1, -1, 174, 36, |
0 | 338 |
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
|
339 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 340 |
_build_road_scen_widgets, |
341 |
BuildRoadToolbWndProc |
|
342 |
}; |
|
343 |
||
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
|
344 |
void ShowBuildRoadScenToolbar(void) |
0 | 345 |
{ |
346 |
AllocateWindowDescFront(&_build_road_scen_desc, 0); |
|
347 |
} |
|
348 |
||
2639 | 349 |
static void BuildRoadDepotWndProc(Window* w, WindowEvent* e) |
350 |
{ |
|
351 |
switch (e->event) { |
|
0 | 352 |
case WE_PAINT: |
353 |
w->click_state = (1<<3) << _road_depot_orientation; |
|
354 |
DrawWindowWidgets(w); |
|
355 |
||
356 |
DrawRoadDepotSprite(70, 17, 0); |
|
357 |
DrawRoadDepotSprite(70, 69, 1); |
|
2639 | 358 |
DrawRoadDepotSprite( 2, 69, 2); |
359 |
DrawRoadDepotSprite( 2, 17, 3); |
|
0 | 360 |
break; |
361 |
||
362 |
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
|
363 |
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
|
364 |
case 3: case 4: case 5: case 6: |
0 | 365 |
_road_depot_orientation = e->click.widget - 3; |
541 | 366 |
SndPlayFx(SND_15_BEEP); |
0 | 367 |
SetWindowDirty(w); |
368 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
369 |
} |
0 | 370 |
} break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
371 |
|
0 | 372 |
case WE_MOUSELOOP: |
2639 | 373 |
if (WP(w,def_d).close) DeleteWindow(w); |
0 | 374 |
break; |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
375 |
|
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
376 |
case WE_DESTROY: |
2639 | 377 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
378 |
break; |
0 | 379 |
} |
380 |
} |
|
381 |
||
382 |
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
|
383 |
{ 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
|
384 |
{ 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
|
385 |
{ 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
|
386 |
{ 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
|
387 |
{ 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
|
388 |
{ 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
|
389 |
{ 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
|
390 |
{ WIDGETS_END}, |
0 | 391 |
}; |
392 |
||
393 |
static const WindowDesc _build_road_depot_desc = { |
|
394 |
-1,-1, 140, 122, |
|
395 |
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR, |
|
396 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
397 |
_build_road_depot_widgets, |
|
398 |
BuildRoadDepotWndProc |
|
399 |
}; |
|
400 |
||
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
|
401 |
static void ShowRoadDepotPicker(void) |
0 | 402 |
{ |
403 |
AllocateWindowDesc(&_build_road_depot_desc); |
|
404 |
} |
|
405 |
||
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
|
406 |
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
|
407 |
{ |
2952 | 408 |
switch (e->event) { |
0 | 409 |
case WE_PAINT: { |
410 |
int image; |
|
411 |
||
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
|
412 |
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
|
413 |
|
0 | 414 |
w->click_state = ((1<<3) << _road_station_picker_orientation) | |
415 |
((1<<7) << _station_show_coverage); |
|
416 |
DrawWindowWidgets(w); |
|
417 |
||
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
|
418 |
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
|
419 |
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
|
420 |
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
|
421 |
} 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
|
422 |
SetTileSelectSize(1, 1); |
0 | 423 |
|
424 |
image = (w->window_class == WC_BUS_STATION) ? 0x47 : 0x43; |
|
425 |
||
426 |
StationPickerDrawSprite(103, 35, 0, image); |
|
427 |
StationPickerDrawSprite(103, 85, 0, image+1); |
|
428 |
StationPickerDrawSprite(35, 85, 0, image+2); |
|
429 |
StationPickerDrawSprite(35, 35, 0, image+3); |
|
430 |
||
431 |
DrawStringCentered(70, 120, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0); |
|
432 |
DrawStationCoverageAreaText(2, 146, |
|
568
6eb7d394fb35
(svn r979) Allow more realistically sized catchment areas
Celestar
parents:
543
diff
changeset
|
433 |
((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
|
434 |
3); |
0 | 435 |
|
436 |
} break; |
|
437 |
||
438 |
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
|
439 |
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
|
440 |
case 3: case 4: case 5: case 6: |
0 | 441 |
_road_station_picker_orientation = e->click.widget - 3; |
541 | 442 |
SndPlayFx(SND_15_BEEP); |
0 | 443 |
SetWindowDirty(w); |
444 |
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
|
445 |
case 7: case 8: |
0 | 446 |
_station_show_coverage = e->click.widget - 7; |
541 | 447 |
SndPlayFx(SND_15_BEEP); |
0 | 448 |
SetWindowDirty(w); |
449 |
break; |
|
450 |
} |
|
451 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
452 |
|
0 | 453 |
case WE_MOUSELOOP: { |
454 |
if (WP(w,def_d).close) { |
|
455 |
DeleteWindow(w); |
|
456 |
return; |
|
457 |
} |
|
458 |
||
459 |
CheckRedrawStationCoverage(w); |
|
460 |
} break; |
|
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
461 |
|
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
462 |
case WE_DESTROY: |
2639 | 463 |
if (!WP(w,def_d).close) ResetObjectToPlace(); |
1072
01bf9fc64236
(svn r1573) -Fix: Station and depot building mode is now terminated if the
celestar
parents:
1035
diff
changeset
|
464 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
465 |
} |
0 | 466 |
} |
467 |
||
468 |
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
|
469 |
{ 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
|
470 |
{ 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
|
471 |
{ 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
|
472 |
{ 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
|
473 |
{ 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
|
474 |
{ 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
|
475 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION}, |
2725
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
476 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF,STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
477 |
{ WWT_TEXTBTN, 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
|
478 |
{ WIDGETS_END}, |
0 | 479 |
}; |
480 |
||
481 |
static const WindowDesc _bus_station_picker_desc = { |
|
482 |
-1,-1, 140, 177, |
|
483 |
WC_BUS_STATION,WC_BUILD_TOOLBAR, |
|
484 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
485 |
_bus_station_picker_widgets, |
|
486 |
RoadStationPickerWndProc |
|
487 |
}; |
|
488 |
||
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
|
489 |
static void ShowBusStationPicker(void) |
0 | 490 |
{ |
491 |
AllocateWindowDesc(&_bus_station_picker_desc); |
|
492 |
} |
|
493 |
||
494 |
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
|
495 |
{ 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
|
496 |
{ 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
|
497 |
{ 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
|
498 |
{ 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
|
499 |
{ 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
|
500 |
{ 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
|
501 |
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY}, |
2725
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
502 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
5c632bc5be28
(svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents:
2639
diff
changeset
|
503 |
{ WWT_TEXTBTN, 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
|
504 |
{ WIDGETS_END}, |
0 | 505 |
}; |
506 |
||
507 |
static const WindowDesc _truck_station_picker_desc = { |
|
508 |
-1,-1, 140, 177, |
|
509 |
WC_TRUCK_STATION,WC_BUILD_TOOLBAR, |
|
510 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
511 |
_truck_station_picker_widgets, |
|
512 |
RoadStationPickerWndProc |
|
513 |
}; |
|
514 |
||
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
|
515 |
static void ShowTruckStationPicker(void) |
0 | 516 |
{ |
517 |
AllocateWindowDesc(&_truck_station_picker_desc); |
|
518 |
} |
|
519 |
||
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
|
520 |
void InitializeRoadGui(void) |
0 | 521 |
{ |
522 |
_road_depot_orientation = 3; |
|
523 |
_road_station_picker_orientation = 3; |
|
524 |
} |