src/road_gui.cpp
branchNewGRF_ports
changeset 6719 4cc327ad39d5
parent 6718 5a8b295aa345
child 6720 35756db7e577
equal deleted inserted replaced
6718:5a8b295aa345 6719:4cc327ad39d5
     1 /* $Id$ */
     1 /* $Id$ */
       
     2 
       
     3 /** @file road_gui.cpp */
     2 
     4 
     3 #include "stdafx.h"
     5 #include "stdafx.h"
     4 #include "openttd.h"
     6 #include "openttd.h"
     5 #include "road_cmd.h"
       
     6 #include "road_map.h"
       
     7 #include "table/sprites.h"
     7 #include "table/sprites.h"
     8 #include "table/strings.h"
     8 #include "table/strings.h"
     9 #include "functions.h"
     9 #include "functions.h"
    10 #include "map.h"
    10 #include "map.h"
    11 #include "tile.h"
    11 #include "tile.h"
    14 #include "viewport.h"
    14 #include "viewport.h"
    15 #include "gfx.h"
    15 #include "gfx.h"
    16 #include "sound.h"
    16 #include "sound.h"
    17 #include "command.h"
    17 #include "command.h"
    18 #include "variables.h"
    18 #include "variables.h"
       
    19 #include "road.h"
       
    20 #include "road_cmd.h"
       
    21 #include "road_map.h"
    19 #include "station_map.h"
    22 #include "station_map.h"
    20 //needed for catchments
    23 //needed for catchments
    21 #include "station.h"
    24 #include "station.h"
    22 
    25 
    23 
    26 
    24 static void ShowBusStationPicker();
    27 static void ShowRVStationPicker(RoadStop::Type rs);
    25 static void ShowTruckStationPicker();
       
    26 static void ShowRoadDepotPicker();
    28 static void ShowRoadDepotPicker();
    27 
    29 
    28 static bool _remove_button_clicked;
    30 static bool _remove_button_clicked;
    29 
    31 
    30 static byte _place_road_flag;
    32 static byte _place_road_flag;
       
    33 
       
    34 static RoadType _cur_roadtype;
    31 
    35 
    32 static DiagDirection _road_depot_orientation;
    36 static DiagDirection _road_depot_orientation;
    33 static DiagDirection _road_station_picker_orientation;
    37 static DiagDirection _road_station_picker_orientation;
    34 
    38 
    35 void CcPlaySound1D(bool success, TileIndex tile, uint32 p1, uint32 p2)
    39 void CcPlaySound1D(bool success, TileIndex tile, uint32 p1, uint32 p2)
    38 }
    42 }
    39 
    43 
    40 static void PlaceRoad_NE(TileIndex tile)
    44 static void PlaceRoad_NE(TileIndex tile)
    41 {
    45 {
    42 	_place_road_flag = (_tile_fract_coords.y >= 8) + 4;
    46 	_place_road_flag = (_tile_fract_coords.y >= 8) + 4;
    43 	VpStartPlaceSizing(tile, VPM_FIX_X);
    47 	VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_NE);
    44 }
    48 }
    45 
    49 
    46 static void PlaceRoad_NW(TileIndex tile)
    50 static void PlaceRoad_NW(TileIndex tile)
    47 {
    51 {
    48 	_place_road_flag = (_tile_fract_coords.x >= 8) + 0;
    52 	_place_road_flag = (_tile_fract_coords.x >= 8) + 0;
    49 	VpStartPlaceSizing(tile, VPM_FIX_Y);
    53 	VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_NW);
    50 }
    54 }
    51 
    55 
    52 static void PlaceRoad_Bridge(TileIndex tile)
    56 static void PlaceRoad_Bridge(TileIndex tile)
    53 {
    57 {
    54 	VpStartPlaceSizing(tile, VPM_X_OR_Y);
    58 	VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
    55 }
    59 }
    56 
    60 
    57 
    61 
    58 void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
    62 void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
    59 {
    63 {
    63 	} else {
    67 	} else {
    64 		SetRedErrorSquare(_build_tunnel_endtile);
    68 		SetRedErrorSquare(_build_tunnel_endtile);
    65 	}
    69 	}
    66 }
    70 }
    67 
    71 
       
    72 /** Structure holding information per roadtype for several functions */
       
    73 struct RoadTypeInfo {
       
    74 	StringID err_build_road;        ///< Building a normal piece of road
       
    75 	StringID err_remove_road;       ///< Removing a normal piece of road
       
    76 	StringID err_depot;             ///< Building a depot
       
    77 	StringID err_build_station[2];  ///< Building a bus or truck station
       
    78 	StringID err_remove_station[2]; ///< Removing of a bus or truck station
       
    79 
       
    80 	StringID picker_title[2];       ///< Title for the station picker for bus or truck stations
       
    81 	StringID picker_tooltip[2];     ///< Tooltip for the station picker for bus or truck stations
       
    82 
       
    83 	SpriteID cursor_nesw;           ///< Cursor for building NE and SW bits
       
    84 	SpriteID cursor_nwse;           ///< Cursor for building NW and SE bits
       
    85 };
       
    86 
       
    87 /** What errors/cursors must be shown for several types of roads */
       
    88 static const RoadTypeInfo _road_type_infos[] = {
       
    89 	{
       
    90 		STR_1804_CAN_T_BUILD_ROAD_HERE,
       
    91 		STR_1805_CAN_T_REMOVE_ROAD_FROM,
       
    92 		STR_1807_CAN_T_BUILD_ROAD_VEHICLE,
       
    93 		{ STR_1808_CAN_T_BUILD_BUS_STATION,        STR_1809_CAN_T_BUILD_TRUCK_STATION },
       
    94 		{ STR_CAN_T_REMOVE_BUS_STATION,            STR_CAN_T_REMOVE_TRUCK_STATION     },
       
    95 		{ STR_3042_BUS_STATION_ORIENTATION,        STR_3043_TRUCK_STATION_ORIENT      },
       
    96 		{ STR_3051_SELECT_BUS_STATION_ORIENTATION, STR_3052_SELECT_TRUCK_LOADING_BAY  },
       
    97 
       
    98 		SPR_CURSOR_ROAD_NESW,
       
    99 		SPR_CURSOR_ROAD_NWSE,
       
   100 	},
       
   101 	{
       
   102 		STR_1804_CAN_T_BUILD_TRAMWAY_HERE,
       
   103 		STR_1805_CAN_T_REMOVE_TRAMWAY_FROM,
       
   104 		STR_1807_CAN_T_BUILD_TRAM_VEHICLE,
       
   105 		{ STR_1808_CAN_T_BUILD_PASSENGER_TRAM_STATION,        STR_1809_CAN_T_BUILD_CARGO_TRAM_STATION        },
       
   106 		{ STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION,            STR_CAN_T_REMOVE_CARGO_TRAM_STATION            },
       
   107 		{ STR_3042_PASSENGER_TRAM_STATION_ORIENTATION,        STR_3043_CARGO_TRAM_STATION_ORIENT             },
       
   108 		{ STR_3051_SELECT_PASSENGER_TRAM_STATION_ORIENTATION, STR_3052_SELECT_CARGO_TRAM_STATION_ORIENTATION },
       
   109 
       
   110 		SPR_CURSOR_TRAMWAY_NESW,
       
   111 		SPR_CURSOR_TRAMWAY_NWSE,
       
   112 	},
       
   113 };
       
   114 
    68 static void PlaceRoad_Tunnel(TileIndex tile)
   115 static void PlaceRoad_Tunnel(TileIndex tile)
    69 {
   116 {
    70 	DoCommandP(tile, 0x200, 0, CcBuildRoadTunnel, CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE));
   117 	DoCommandP(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, CcBuildRoadTunnel, CMD_BUILD_TUNNEL | CMD_AUTO | CMD_MSG(STR_5016_CAN_T_BUILD_TUNNEL_HERE));
    71 }
   118 }
    72 
   119 
    73 static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
   120 static void BuildRoadOutsideStation(TileIndex tile, DiagDirection direction)
    74 {
   121 {
    75 	tile += TileOffsByDiagDir(direction);
   122 	tile += TileOffsByDiagDir(direction);
    76 	// if there is a roadpiece just outside of the station entrance, build a connecting route
   123 	// if there is a roadpiece just outside of the station entrance, build a connecting route
    77 	if (IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
   124 	if (IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_NORMAL) {
    78 		DoCommandP(tile, DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
   125 		if (GetRoadBits(tile, _cur_roadtype) != ROAD_NONE) {
       
   126 			DoCommandP(tile, _cur_roadtype << 4 | DiagDirToRoadBits(ReverseDiagDir(direction)), 0, NULL, CMD_BUILD_ROAD);
       
   127 		}
    79 	}
   128 	}
    80 }
   129 }
    81 
   130 
    82 void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
   131 void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
    83 {
   132 {
    84 	if (success) {
   133 	if (success) {
       
   134 		DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
    85 		SndPlayTileFx(SND_1F_SPLAT, tile);
   135 		SndPlayTileFx(SND_1F_SPLAT, tile);
    86 		ResetObjectToPlace();
   136 		ResetObjectToPlace();
    87 		BuildRoadOutsideStation(tile, (DiagDirection)p1);
   137 		BuildRoadOutsideStation(tile, dir);
    88 		/* For a drive-through road stop build connecting road for other entrance */
   138 		/* For a drive-through road stop build connecting road for other entrance */
    89 		if (HASBIT(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir((DiagDirection)p1));
   139 		if (HASBIT(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
    90 	}
   140 	}
    91 }
   141 }
    92 
   142 
    93 static void PlaceRoad_Depot(TileIndex tile)
   143 static void PlaceRoad_Depot(TileIndex tile)
    94 {
   144 {
    95 	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));
   145 	DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0, CcRoadDepot, CMD_BUILD_ROAD_DEPOT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot));
    96 }
   146 }
    97 
   147 
    98 static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
   148 static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
    99 {
   149 {
   100 	uint32 p1 = _road_station_picker_orientation;
   150 	uint32 p1 = _road_station_picker_orientation;
   107 }
   157 }
   108 
   158 
   109 static void PlaceRoad_BusStation(TileIndex tile)
   159 static void PlaceRoad_BusStation(TileIndex tile)
   110 {
   160 {
   111 	if (_remove_button_clicked) {
   161 	if (_remove_button_clicked) {
   112 		DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(STR_CAN_T_REMOVE_BUS_STATION));
   162 		DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::BUS]));
   113 	} else {
   163 	} else {
   114 		PlaceRoadStop(tile, RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1808_CAN_T_BUILD_BUS_STATION));
   164 		PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::BUS]));
   115 	}
   165 	}
   116 }
   166 }
   117 
   167 
   118 static void PlaceRoad_TruckStation(TileIndex tile)
   168 static void PlaceRoad_TruckStation(TileIndex tile)
   119 {
   169 {
   120 	if (_remove_button_clicked) {
   170 	if (_remove_button_clicked) {
   121 		DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(STR_CAN_T_REMOVE_TRUCK_STATION));
   171 		DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::TRUCK]));
   122 	} else {
   172 	} else {
   123 		PlaceRoadStop(tile, RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1809_CAN_T_BUILD_TRUCK_STATION));
   173 		PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::TRUCK]));
   124 	}
   174 	}
   125 }
   175 }
   126 
   176 
   127 static void PlaceRoad_DemolishArea(TileIndex tile)
   177 static void PlaceRoad_DemolishArea(TileIndex tile)
   128 {
   178 {
   129 	VpStartPlaceSizing(tile, 4);
   179 	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_DEMOLISH_AREA);
   130 }
   180 }
   131 
   181 
   132 
   182 
   133 enum {
   183 enum {
   134 	RTW_ROAD_X        =  3,
   184 	RTW_ROAD_X        =  3,
   145 
   195 
   146 typedef void OnButtonClick(Window *w);
   196 typedef void OnButtonClick(Window *w);
   147 
   197 
   148 static void BuildRoadClick_NE(Window *w)
   198 static void BuildRoadClick_NE(Window *w)
   149 {
   199 {
   150 	HandlePlacePushButton(w, RTW_ROAD_X, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE);
   200 	HandlePlacePushButton(w, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nesw, 1, PlaceRoad_NE);
   151 }
   201 }
   152 
   202 
   153 static void BuildRoadClick_NW(Window *w)
   203 static void BuildRoadClick_NW(Window *w)
   154 {
   204 {
   155 	HandlePlacePushButton(w, RTW_ROAD_Y, SPR_CURSOR_ROAD_NWSE, 1, PlaceRoad_NW);
   205 	HandlePlacePushButton(w, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nwse, 1, PlaceRoad_NW);
   156 }
   206 }
   157 
   207 
   158 
   208 
   159 static void BuildRoadClick_Demolish(Window *w)
   209 static void BuildRoadClick_Demolish(Window *w)
   160 {
   210 {
   168 }
   218 }
   169 
   219 
   170 static void BuildRoadClick_BusStation(Window *w)
   220 static void BuildRoadClick_BusStation(Window *w)
   171 {
   221 {
   172 	if (_game_mode == GM_EDITOR) return;
   222 	if (_game_mode == GM_EDITOR) return;
   173 	if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowBusStationPicker();
   223 	if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowRVStationPicker(RoadStop::BUS);
   174 }
   224 }
   175 
   225 
   176 static void BuildRoadClick_TruckStation(Window *w)
   226 static void BuildRoadClick_TruckStation(Window *w)
   177 {
   227 {
   178 	if (_game_mode == GM_EDITOR) return;
   228 	if (_game_mode == GM_EDITOR) return;
   179 	if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker();
   229 	if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowRVStationPicker(RoadStop::TRUCK);
   180 }
   230 }
   181 
   231 
   182 static void BuildRoadClick_Bridge(Window *w)
   232 static void BuildRoadClick_Bridge(Window *w)
   183 {
   233 {
   184 	HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge);
   234 	HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge);
   223 		DrawWindowWidgets(w);
   273 		DrawWindowWidgets(w);
   224 		break;
   274 		break;
   225 
   275 
   226 	case WE_CLICK: {
   276 	case WE_CLICK: {
   227 		if (e->we.click.widget >= 3) _build_road_button_proc[e->we.click.widget - 3](w);
   277 		if (e->we.click.widget >= 3) _build_road_button_proc[e->we.click.widget - 3](w);
   228 	}	break;
   278 	} break;
   229 
   279 
   230 	case WE_KEYPRESS:
   280 	case WE_KEYPRESS:
   231 		switch (e->we.keypress.keycode) {
   281 		switch (e->we.keypress.keycode) {
   232 			case '1': BuildRoadClick_NE(w);           break;
   282 			case '1': BuildRoadClick_NE(w);           break;
   233 			case '2': BuildRoadClick_NW(w);           break;
   283 			case '2': BuildRoadClick_NW(w);           break;
   253 		RaiseWindowButtons(w);
   303 		RaiseWindowButtons(w);
   254 		DisableWindowWidget(w, RTW_REMOVE);
   304 		DisableWindowWidget(w, RTW_REMOVE);
   255 		InvalidateWidget(w, RTW_REMOVE);
   305 		InvalidateWidget(w, RTW_REMOVE);
   256 
   306 
   257 		w = FindWindowById(WC_BUS_STATION, 0);
   307 		w = FindWindowById(WC_BUS_STATION, 0);
   258 		if (w != NULL) WP(w,def_d).close = true;
   308 		if (w != NULL) WP(w, def_d).close = true;
   259 		w = FindWindowById(WC_TRUCK_STATION, 0);
   309 		w = FindWindowById(WC_TRUCK_STATION, 0);
   260 		if (w != NULL) WP(w,def_d).close = true;
   310 		if (w != NULL) WP(w, def_d).close = true;
   261 		w = FindWindowById(WC_BUILD_DEPOT, 0);
   311 		w = FindWindowById(WC_BUILD_DEPOT, 0);
   262 		if (w != NULL) WP(w,def_d).close = true;
   312 		if (w != NULL) WP(w, def_d).close = true;
   263 		break;
   313 		break;
   264 
   314 
   265 	case WE_PLACE_DRAG: {
   315 	case WE_PLACE_DRAG:
   266 		int sel_method;
   316 		switch (e->we.place.select_proc) {
   267 		switch (e->we.place.userdata) {
   317 			case DDSP_PLACE_ROAD_NE:
   268 			case 1:
       
   269 				sel_method = VPM_FIX_X;
       
   270 				_place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.y & 8) >> 2);
   318 				_place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.y & 8) >> 2);
   271 				break;
   319 				break;
   272 
   320 
   273 			case 2:
   321 			case DDSP_PLACE_ROAD_NW:
   274 				sel_method = VPM_FIX_Y;
       
   275 				_place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.x & 8) >> 2);
   322 				_place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.x & 8) >> 2);
   276 				break;
   323 				break;
   277 
   324 		}
   278 			case 4:
   325 
   279 				sel_method = VPM_X_AND_Y;
   326 		VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, e->we.place.select_method);
   280 				break;
       
   281 
       
   282 			default:
       
   283 				sel_method = VPM_X_OR_Y;
       
   284 				break;
       
   285 		}
       
   286 
       
   287 		VpSelectTilesWithMethod(e->we.place.pt.x, e->we.place.pt.y, sel_method);
       
   288 		return;
   327 		return;
   289 	}
       
   290 
   328 
   291 	case WE_PLACE_MOUSEUP:
   329 	case WE_PLACE_MOUSEUP:
   292 		if (e->we.place.pt.x != -1) {
   330 		if (e->we.place.pt.x != -1) {
   293 			TileIndex start_tile = e->we.place.starttile;
   331 			TileIndex start_tile = e->we.place.starttile;
   294 			TileIndex end_tile = e->we.place.tile;
   332 			TileIndex end_tile = e->we.place.tile;
   295 
   333 
   296 			if (e->we.place.userdata == 0) {
   334 			switch (e->we.place.select_proc) {
   297 				ResetObjectToPlace();
   335 				case DDSP_BUILD_BRIDGE:
   298 				ShowBuildBridgeWindow(start_tile, end_tile, 0x80);
   336 					ResetObjectToPlace();
   299 			} else if (e->we.place.userdata != 4) {
   337 					ShowBuildBridgeWindow(start_tile, end_tile, 0x80 | RoadTypeToRoadTypes(_cur_roadtype));
   300 				DoCommandP(end_tile, start_tile, _place_road_flag, CcPlaySound1D,
   338 					break;
   301 					_remove_button_clicked ?
   339 
   302 					CMD_REMOVE_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1805_CAN_T_REMOVE_ROAD_FROM) :
   340 				case DDSP_DEMOLISH_AREA:
   303 					CMD_BUILD_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1804_CAN_T_BUILD_ROAD_HERE));
   341 					DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
   304 			} else {
   342 					break;
   305 				DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
   343 
       
   344 				case DDSP_PLACE_ROAD_NE:
       
   345 				case DDSP_PLACE_ROAD_NW:
       
   346 					DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | _ctrl_pressed << 5, CcPlaySound1D,
       
   347 						_remove_button_clicked ?
       
   348 						CMD_REMOVE_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
       
   349 						CMD_BUILD_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road));
       
   350 					break;
   306 			}
   351 			}
   307 		}
   352 		}
   308 		break;
   353 		break;
   309 
   354 
   310 	case WE_PLACE_PRESIZE: {
   355 	case WE_PLACE_PRESIZE: {
   311 		TileIndex tile = e->we.place.tile;
   356 		TileIndex tile = e->we.place.tile;
   312 
   357 
   313 		DoCommand(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);
   358 		DoCommand(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, DC_AUTO, CMD_BUILD_TUNNEL);
   314 		VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
   359 		VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
   315 		break;
   360 		break;
   316 	}
   361 	}
   317 
   362 
   318 	case WE_DESTROY:
   363 	case WE_DESTROY:
   344 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
   389 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
   345 	_build_road_widgets,
   390 	_build_road_widgets,
   346 	BuildRoadToolbWndProc
   391 	BuildRoadToolbWndProc
   347 };
   392 };
   348 
   393 
   349 void ShowBuildRoadToolbar()
   394 static const Widget _build_tramway_widgets[] = {
       
   395 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},
       
   396 {    WWT_CAPTION,   RESIZE_NONE,     7,    11,   205,     0,    13, STR_1802_TRAMWAY_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
       
   397 {  WWT_STICKYBOX,   RESIZE_NONE,     7,   206,   217,     0,    13, 0x0,                        STR_STICKY_BUTTON},
       
   398 
       
   399 {     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_TRAMWAY_NW,         STR_180B_BUILD_TRAMWAY_SECTION},
       
   400 {     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_TRAMWAY_NE,         STR_180B_BUILD_TRAMWAY_SECTION},
       
   401 {     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},
       
   402 {     WWT_IMGBTN,   RESIZE_NONE,     7,    66,    87,    14,    35, SPR_IMG_ROAD_DEPOT,         STR_180C_BUILD_TRAM_VEHICLE_DEPOT},
       
   403 {     WWT_IMGBTN,   RESIZE_NONE,     7,    88,   109,    14,    35, SPR_IMG_BUS_STATION,        STR_180D_BUILD_PASSENGER_TRAM_STATION},
       
   404 {     WWT_IMGBTN,   RESIZE_NONE,     7,   110,   131,    14,    35, SPR_IMG_TRUCK_BAY,          STR_180E_BUILD_CARGO_TRAM_STATION},
       
   405 
       
   406 {     WWT_IMGBTN,   RESIZE_NONE,     7,   132,   173,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_TRAMWAY_BRIDGE},
       
   407 {     WWT_IMGBTN,   RESIZE_NONE,     7,   174,   195,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_TRAMWAY_TUNNEL},
       
   408 {     WWT_IMGBTN,   RESIZE_NONE,     7,   196,   217,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS},
       
   409 {   WIDGETS_END},
       
   410 };
       
   411 
       
   412 static const WindowDesc _build_tramway_desc = {
       
   413 	WDP_ALIGN_TBR, 22, 218, 36,
       
   414 	WC_BUILD_TOOLBAR, WC_NONE,
       
   415 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
       
   416 	_build_tramway_widgets,
       
   417 	BuildRoadToolbWndProc
       
   418 };
       
   419 
       
   420 void ShowBuildRoadToolbar(RoadType roadtype)
   350 {
   421 {
   351 	if (!IsValidPlayer(_current_player)) return;
   422 	if (!IsValidPlayer(_current_player)) return;
       
   423 	_cur_roadtype = roadtype;
   352 
   424 
   353 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
   425 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
   354 	Window *w = AllocateWindowDesc(&_build_road_desc);
   426 	Window *w = AllocateWindowDesc(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc);
   355 	if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
   427 	if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
   356 }
   428 }
   357 
   429 
   358 static const Widget _build_road_scen_widgets[] = {
   430 static const Widget _build_road_scen_widgets[] = {
   359 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},
   431 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},
   380 	BuildRoadToolbWndProc
   452 	BuildRoadToolbWndProc
   381 };
   453 };
   382 
   454 
   383 void ShowBuildRoadScenToolbar()
   455 void ShowBuildRoadScenToolbar()
   384 {
   456 {
       
   457 	_cur_roadtype = ROADTYPE_ROAD;
   385 	AllocateWindowDescFront(&_build_road_scen_desc, 0);
   458 	AllocateWindowDescFront(&_build_road_scen_desc, 0);
   386 }
   459 }
   387 
   460 
   388 static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
   461 static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
   389 {
   462 {
   391 	case WE_CREATE: LowerWindowWidget(w, _road_depot_orientation + 3); break;
   464 	case WE_CREATE: LowerWindowWidget(w, _road_depot_orientation + 3); break;
   392 
   465 
   393 	case WE_PAINT:
   466 	case WE_PAINT:
   394 		DrawWindowWidgets(w);
   467 		DrawWindowWidgets(w);
   395 
   468 
   396 		DrawRoadDepotSprite(70, 17, DIAGDIR_NE);
   469 		DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
   397 		DrawRoadDepotSprite(70, 69, DIAGDIR_SE);
   470 		DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
   398 		DrawRoadDepotSprite( 2, 69, DIAGDIR_SW);
   471 		DrawRoadDepotSprite( 2, 69, DIAGDIR_SW, _cur_roadtype);
   399 		DrawRoadDepotSprite( 2, 17, DIAGDIR_NW);
   472 		DrawRoadDepotSprite( 2, 17, DIAGDIR_NW, _cur_roadtype);
   400 		break;
   473 		break;
   401 
   474 
   402 	case WE_CLICK: {
   475 	case WE_CLICK: {
   403 		switch (e->we.click.widget) {
   476 		switch (e->we.click.widget) {
   404 		case 3: case 4: case 5: case 6:
   477 		case 3: case 4: case 5: case 6:
   407 			LowerWindowWidget(w, _road_depot_orientation + 3);
   480 			LowerWindowWidget(w, _road_depot_orientation + 3);
   408 			SndPlayFx(SND_15_BEEP);
   481 			SndPlayFx(SND_15_BEEP);
   409 			SetWindowDirty(w);
   482 			SetWindowDirty(w);
   410 			break;
   483 			break;
   411 		}
   484 		}
   412 	}	break;
   485 	} break;
   413 
   486 
   414 	case WE_MOUSELOOP:
   487 	case WE_MOUSELOOP:
   415 		if (WP(w,def_d).close) DeleteWindow(w);
   488 		if (WP(w, def_d).close) DeleteWindow(w);
   416 		break;
   489 		break;
   417 
   490 
   418 	case WE_DESTROY:
   491 	case WE_DESTROY:
   419 		if (!WP(w,def_d).close) ResetObjectToPlace();
   492 		if (!WP(w, def_d).close) ResetObjectToPlace();
   420 		break;
   493 		break;
   421 	}
   494 	}
   422 }
   495 }
   423 
   496 
   424 static const Widget _build_road_depot_widgets[] = {
   497 static const Widget _build_road_depot_widgets[] = {
   430 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    69,   118, 0x0,                             STR_1813_SELECT_ROAD_VEHICLE_DEPOT},
   503 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    69,   118, 0x0,                             STR_1813_SELECT_ROAD_VEHICLE_DEPOT},
   431 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    17,    66, 0x0,                             STR_1813_SELECT_ROAD_VEHICLE_DEPOT},
   504 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    17,    66, 0x0,                             STR_1813_SELECT_ROAD_VEHICLE_DEPOT},
   432 {   WIDGETS_END},
   505 {   WIDGETS_END},
   433 };
   506 };
   434 
   507 
       
   508 static const Widget _build_tram_depot_widgets[] = {
       
   509 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                        STR_018B_CLOSE_WINDOW},
       
   510 {    WWT_CAPTION,   RESIZE_NONE,     7,    11,   139,     0,    13, STR_1806_TRAM_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
       
   511 {      WWT_PANEL,   RESIZE_NONE,     7,     0,   139,    14,   121, 0x0,                             STR_NULL},
       
   512 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    17,    66, 0x0,                             STR_1813_SELECT_TRAM_VEHICLE_DEPOT},
       
   513 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    69,   118, 0x0,                             STR_1813_SELECT_TRAM_VEHICLE_DEPOT},
       
   514 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    69,   118, 0x0,                             STR_1813_SELECT_TRAM_VEHICLE_DEPOT},
       
   515 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    17,    66, 0x0,                             STR_1813_SELECT_TRAM_VEHICLE_DEPOT},
       
   516 {   WIDGETS_END},
       
   517 };
       
   518 
   435 static const WindowDesc _build_road_depot_desc = {
   519 static const WindowDesc _build_road_depot_desc = {
   436 	WDP_AUTO, WDP_AUTO, 140, 122,
   520 	WDP_AUTO, WDP_AUTO, 140, 122,
   437 	WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
   521 	WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
   438 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   522 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   439 	_build_road_depot_widgets,
   523 	_build_road_depot_widgets,
   440 	BuildRoadDepotWndProc
   524 	BuildRoadDepotWndProc
   441 };
   525 };
   442 
   526 
       
   527 static const WindowDesc _build_tram_depot_desc = {
       
   528 	WDP_AUTO, WDP_AUTO, 140, 122,
       
   529 	WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
       
   530 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
       
   531 	_build_tram_depot_widgets,
       
   532 	BuildRoadDepotWndProc
       
   533 };
       
   534 
   443 static void ShowRoadDepotPicker()
   535 static void ShowRoadDepotPicker()
   444 {
   536 {
   445 	AllocateWindowDesc(&_build_road_depot_desc);
   537 	AllocateWindowDesc(_cur_roadtype == ROADTYPE_ROAD ? &_build_road_depot_desc : &_build_tram_depot_desc);
   446 }
   538 }
   447 
   539 
   448 static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
   540 static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
   449 {
   541 {
   450 	switch (e->event) {
   542 	switch (e->event) {
   451 	case WE_CREATE:
   543 	case WE_CREATE:
       
   544 		/* Trams don't have non-drivethrough stations */
       
   545 		if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
       
   546 			_road_station_picker_orientation = DIAGDIR_END;
       
   547 		}
       
   548 		SetWindowWidgetsDisabledState(w, _cur_roadtype == ROADTYPE_TRAM, 3, 4, 5, 6, WIDGET_LIST_END);
       
   549 
   452 		LowerWindowWidget(w, _road_station_picker_orientation + 3);
   550 		LowerWindowWidget(w, _road_station_picker_orientation + 3);
   453 		LowerWindowWidget(w, _station_show_coverage + 9);
   551 		LowerWindowWidget(w, _station_show_coverage + 9);
   454 		break;
   552 		break;
   455 
   553 
   456 	case WE_PAINT: {
   554 	case WE_PAINT: {
   457 		int image;
   555 		int image;
   458 
   556 
   459 		if (WP(w,def_d).close) return;
   557 		if (WP(w, def_d).close) return;
   460 
   558 
   461 		DrawWindowWidgets(w);
   559 		DrawWindowWidgets(w);
   462 
   560 
   463 		_thd.airport_template = false;  // ensure irregular airport support disabled
   561 		_thd.airport_template = false;  // ensure irregular airport support disabled
   464 
   562 
   469 			SetTileSelectSize(1, 1);
   567 			SetTileSelectSize(1, 1);
   470 		}
   568 		}
   471 
   569 
   472 		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE : GFX_TRUCK_BASE;
   570 		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE : GFX_TRUCK_BASE;
   473 
   571 
   474 		StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, image);
   572 		StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, ROADTYPE_ROAD, image);
   475 		StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image+1);
   573 		StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, ROADTYPE_ROAD, image + 1);
   476 		StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image+2);
   574 		StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, ROADTYPE_ROAD, image + 2);
   477 		StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image+3);
   575 		StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, ROADTYPE_ROAD, image + 3);
   478 
   576 
   479 		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE_EXT : GFX_TRUCK_BASE_EXT;
   577 		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE_EXT : GFX_TRUCK_BASE_EXT;
   480 
   578 
   481 		StationPickerDrawSprite(171, 35, RAILTYPE_BEGIN, image);
   579 		StationPickerDrawSprite(171, 35, RAILTYPE_BEGIN, _cur_roadtype, image);
   482 		StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, image + 1);
   580 		StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, _cur_roadtype, image + 1);
   483 
   581 
   484 		DrawStationCoverageAreaText(2, 146,
   582 		DrawStationCoverageAreaText(2, 146,
   485 			((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)),
   583 			((w->window_class == WC_BUS_STATION) ? (1 << CT_PASSENGERS) : ~(1 << CT_PASSENGERS)),
   486 			3);
   584 			3);
   487 
   585 
   488 	} break;
   586 	} break;
   489 
   587 
   490 	case WE_CLICK: {
   588 	case WE_CLICK: {
   505 			break;
   603 			break;
   506 		}
   604 		}
   507 	} break;
   605 	} break;
   508 
   606 
   509 	case WE_MOUSELOOP: {
   607 	case WE_MOUSELOOP: {
   510 		if (WP(w,def_d).close) {
   608 		if (WP(w, def_d).close) {
   511 			DeleteWindow(w);
   609 			DeleteWindow(w);
   512 			return;
   610 			return;
   513 		}
   611 		}
   514 
   612 
   515 		CheckRedrawStationCoverage(w);
   613 		CheckRedrawStationCoverage(w);
   516 	} break;
   614 	} break;
   517 
   615 
   518 	case WE_DESTROY:
   616 	case WE_DESTROY:
   519 		if (!WP(w,def_d).close) ResetObjectToPlace();
   617 		if (!WP(w, def_d).close) ResetObjectToPlace();
   520 		break;
   618 		break;
   521 	}
   619 	}
   522 }
   620 }
   523 
   621 
   524 static const Widget _bus_station_picker_widgets[] = {
   622 static const Widget _rv_station_picker_widgets[] = {
   525 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
   623 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
   526 {    WWT_CAPTION,   RESIZE_NONE,     7,    11,   206,     0,    13, STR_3042_BUS_STATION_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
   624 {    WWT_CAPTION,   RESIZE_NONE,     7,    11,   206,     0,    13, STR_NULL,                         STR_018C_WINDOW_TITLE_DRAG_THIS},
   527 {      WWT_PANEL,   RESIZE_NONE,     7,     0,   206,    14,   176, 0x0,                              STR_NULL},
   625 {      WWT_PANEL,   RESIZE_NONE,     7,     0,   206,    14,   176, 0x0,                              STR_NULL},
   528 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    17,    66, 0x0,                              STR_3051_SELECT_BUS_STATION_ORIENTATION},
   626 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    17,    66, 0x0,                              STR_NULL},
   529 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    69,   118, 0x0,                              STR_3051_SELECT_BUS_STATION_ORIENTATION},
   627 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    69,   118, 0x0,                              STR_NULL},
   530 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    69,   118, 0x0,                              STR_3051_SELECT_BUS_STATION_ORIENTATION},
   628 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    69,   118, 0x0,                              STR_NULL},
   531 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    17,    66, 0x0,                              STR_3051_SELECT_BUS_STATION_ORIENTATION},
   629 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    17,    66, 0x0,                              STR_NULL},
   532 {      WWT_PANEL,   RESIZE_NONE,    14,   139,   204,    17,    66, 0x0,                              STR_3051_SELECT_BUS_STATION_ORIENTATION},
   630 {      WWT_PANEL,   RESIZE_NONE,    14,   139,   204,    17,    66, 0x0,                              STR_NULL},
   533 {      WWT_PANEL,   RESIZE_NONE,    14,   139,   204,    69,   118, 0x0,                              STR_3051_SELECT_BUS_STATION_ORIENTATION},
   631 {      WWT_PANEL,   RESIZE_NONE,    14,   139,   204,    69,   118, 0x0,                              STR_NULL},
   534 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    10,    69,   133,   144, STR_02DB_OFF,                     STR_3065_DON_T_HIGHLIGHT_COVERAGE},
   632 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    10,    69,   133,   144, STR_02DB_OFF,                     STR_3065_DON_T_HIGHLIGHT_COVERAGE},
   535 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    70,   129,   133,   144, STR_02DA_ON,                      STR_3064_HIGHLIGHT_COVERAGE_AREA},
   633 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    70,   129,   133,   144, STR_02DA_ON,                      STR_3064_HIGHLIGHT_COVERAGE_AREA},
   536 {      WWT_LABEL,   RESIZE_NONE,     7,     0,   139,   120,   133, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
   634 {      WWT_LABEL,   RESIZE_NONE,     7,     0,   139,   120,   133, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
   537 {   WIDGETS_END},
   635 {   WIDGETS_END},
   538 };
   636 };
   539 
   637 
   540 static const WindowDesc _bus_station_picker_desc = {
   638 static const WindowDesc _rv_station_picker_desc = {
   541 	WDP_AUTO, WDP_AUTO, 207, 177,
   639 	WDP_AUTO, WDP_AUTO, 207, 177,
   542 	WC_BUS_STATION, WC_BUILD_TOOLBAR,
   640 	WC_BUS_STATION, WC_BUILD_TOOLBAR,
   543 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   641 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   544 	_bus_station_picker_widgets,
   642 	_rv_station_picker_widgets,
   545 	RoadStationPickerWndProc
   643 	RoadStationPickerWndProc
   546 };
   644 };
   547 
   645 
   548 static void ShowBusStationPicker()
   646 static void ShowRVStationPicker(RoadStop::Type rs)
   549 {
   647 {
   550 	AllocateWindowDesc(&_bus_station_picker_desc);
   648 	Window *w = AllocateWindowDesc(&_rv_station_picker_desc);
   551 }
   649 	if (w == NULL) return;
   552 
   650 
   553 static const Widget _truck_station_picker_widgets[] = {
   651 	w->window_class = (rs == RoadStop::BUS) ? WC_BUS_STATION : WC_TRUCK_STATION;
   554 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
   652 	w->widget[1].data = _road_type_infos[_cur_roadtype].picker_title[rs];
   555 {    WWT_CAPTION,   RESIZE_NONE,     7,    11,   206,     0,    13, STR_3043_TRUCK_STATION_ORIENT,    STR_018C_WINDOW_TITLE_DRAG_THIS},
   653 	for (uint i = 3; i < 9; i++) w->widget[i].tooltips = _road_type_infos[_cur_roadtype].picker_tooltip[rs];
   556 {      WWT_PANEL,   RESIZE_NONE,     7,     0,   206,    14,   176, 0x0,                              STR_NULL},
       
   557 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    17,    66, 0x0,                              STR_3052_SELECT_TRUCK_LOADING_BAY},
       
   558 {      WWT_PANEL,   RESIZE_NONE,    14,    71,   136,    69,   118, 0x0,                              STR_3052_SELECT_TRUCK_LOADING_BAY},
       
   559 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    69,   118, 0x0,                              STR_3052_SELECT_TRUCK_LOADING_BAY},
       
   560 {      WWT_PANEL,   RESIZE_NONE,    14,     3,    68,    17,    66, 0x0,                              STR_3052_SELECT_TRUCK_LOADING_BAY},
       
   561 {      WWT_PANEL,   RESIZE_NONE,    14,   139,   204,    17,    66, 0x0,                              STR_3052_SELECT_TRUCK_LOADING_BAY},
       
   562 {      WWT_PANEL,   RESIZE_NONE,    14,   139,   204,    69,   118, 0x0,                              STR_3052_SELECT_TRUCK_LOADING_BAY},
       
   563 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    10,    69,   133,   144, STR_02DB_OFF,                     STR_3065_DON_T_HIGHLIGHT_COVERAGE},
       
   564 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    70,   129,   133,   144, STR_02DA_ON,                      STR_3064_HIGHLIGHT_COVERAGE_AREA},
       
   565 {      WWT_LABEL,   RESIZE_NONE,     7,     0,   139,   120,   133, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
       
   566 {   WIDGETS_END},
       
   567 };
       
   568 
       
   569 static const WindowDesc _truck_station_picker_desc = {
       
   570 	WDP_AUTO, WDP_AUTO, 207, 177,
       
   571 	WC_TRUCK_STATION, WC_BUILD_TOOLBAR,
       
   572 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
       
   573 	_truck_station_picker_widgets,
       
   574 	RoadStationPickerWndProc
       
   575 };
       
   576 
       
   577 static void ShowTruckStationPicker()
       
   578 {
       
   579 	AllocateWindowDesc(&_truck_station_picker_desc);
       
   580 }
   654 }
   581 
   655 
   582 void InitializeRoadGui()
   656 void InitializeRoadGui()
   583 {
   657 {
   584 	_road_depot_orientation = DIAGDIR_NW;
   658 	_road_depot_orientation = DIAGDIR_NW;