src/road_gui.cpp
branchnoai
changeset 9722 ebf0ece7d8f6
parent 9718 f82a4facea8b
child 9723 eee46cb39750
--- a/src/road_gui.cpp	Thu Nov 22 23:01:41 2007 +0000
+++ b/src/road_gui.cpp	Fri Nov 23 16:59:30 2007 +0000
@@ -29,8 +29,24 @@
 static void ShowRoadDepotPicker();
 
 static bool _remove_button_clicked;
+static bool _one_way_button_clicked;
 
-static byte _place_road_flag;
+/**
+ * Define the values of the RoadFlags
+ * @see CmdBuildLongRoad
+ */
+enum RoadFlags {
+	RF_NONE             = 0x00,
+	RF_START_HALFROAD_Y = 0x01,    // The start tile in Y-dir should have only a half road
+	RF_END_HALFROAD_Y   = 0x02,    // The end tile in Y-dir should have only a half road
+	RF_DIR_Y            = 0x04,    // The direction is Y-dir
+	RF_DIR_X            = RF_NONE, // Dummy; Dir X is set when RF_DIR_Y is not set
+	RF_START_HALFROAD_X = 0x08,    // The start tile in X-dir should have only a half road
+	RF_END_HALFROAD_X   = 0x10,    // The end tile in X-dir should have only a half road
+};
+DECLARE_ENUM_AS_BIT_SET(RoadFlags);
+
+static RoadFlags _place_road_flag;
 
 static RoadType _cur_roadtype;
 
@@ -42,16 +58,50 @@
 	if (success) SndPlayTileFx(SND_1F_SPLAT, tile);
 }
 
-static void PlaceRoad_NE(TileIndex tile)
+/**
+ * Set the initial flags for the road constuction.
+ * The flags are:
+ * @li The direction is the X-dir
+ * @li The first tile has a partitial RoadBit (true or false)
+ *
+ * @param tile The start tile
+ */
+static void PlaceRoad_X_Dir(TileIndex tile)
 {
-	_place_road_flag = (_tile_fract_coords.y >= 8) + 4;
-	VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_NE);
+	_place_road_flag = RF_DIR_X;
+	if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
+	VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_X_DIR);
 }
 
-static void PlaceRoad_NW(TileIndex tile)
+/**
+ * Set the initial flags for the road constuction.
+ * The flags are:
+ * @li The direction is the Y-dir
+ * @li The first tile has a partitial RoadBit (true or false)
+ *
+ * @param tile The start tile
+ */
+static void PlaceRoad_Y_Dir(TileIndex tile)
 {
-	_place_road_flag = (_tile_fract_coords.x >= 8) + 0;
-	VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_NW);
+	_place_road_flag = RF_DIR_Y;
+	if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
+	VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_Y_DIR);
+}
+
+/**
+ * Set the initial flags for the road constuction.
+ * The flags are:
+ * @li The direction is not set.
+ * @li The first tile has a partitial RoadBit (true or false)
+ *
+ * @param tile The start tile
+ */
+static void PlaceRoad_AutoRoad(TileIndex tile)
+{
+	_place_road_flag = RF_NONE;
+	if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
+	if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
+	VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD);
 }
 
 static void PlaceRoad_Bridge(TileIndex tile)
@@ -83,6 +133,7 @@
 
 	SpriteID cursor_nesw;           ///< Cursor for building NE and SW bits
 	SpriteID cursor_nwse;           ///< Cursor for building NW and SE bits
+	SpriteID cursor_autoroad;       ///< Cursor for building autoroad
 };
 
 /** What errors/cursors must be shown for several types of roads */
@@ -98,6 +149,7 @@
 
 		SPR_CURSOR_ROAD_NESW,
 		SPR_CURSOR_ROAD_NWSE,
+		SPR_CURSOR_AUTOROAD,
 	},
 	{
 		STR_1804_CAN_T_BUILD_TRAMWAY_HERE,
@@ -110,6 +162,7 @@
 
 		SPR_CURSOR_TRAMWAY_NESW,
 		SPR_CURSOR_TRAMWAY_NWSE,
+		SPR_CURSOR_AUTOTRAM,
 	},
 };
 
@@ -137,7 +190,7 @@
 		ResetObjectToPlace();
 		BuildRoadOutsideStation(tile, dir);
 		/* For a drive-through road stop build connecting road for other entrance */
-		if (HASBIT(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
+		if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
 	}
 }
 
@@ -151,7 +204,7 @@
 	uint32 p1 = _road_station_picker_orientation;
 
 	if (p1 >= DIAGDIR_END) {
-		SETBIT(p2, 1); // It's a drive-through stop
+		SetBit(p2, 1); // It's a drive-through stop
 		p1 -= DIAGDIR_END; // Adjust picker result to actual direction
 	}
 	DoCommandP(tile, p1, p2, CcRoadDepot, cmd);
@@ -187,10 +240,12 @@
 	RTW_STICKY,
 	RTW_ROAD_X,
 	RTW_ROAD_Y,
+	RTW_AUTOROAD,
 	RTW_DEMOLISH,
 	RTW_DEPOT,
 	RTW_BUS_STATION,
 	RTW_TRUCK_STATION,
+	RTW_ONE_WAY,
 	RTW_BUILD_BRIDGE,
 	RTW_BUILD_TUNNEL,
 	RTW_REMOVE,
@@ -198,48 +253,84 @@
 
 typedef void OnButtonClick(Window *w);
 
-static void BuildRoadClick_NE(Window *w)
+/**
+ * Function that handles the click on the
+ *  X road placement button.
+ *
+ * @param w The current window
+ */
+static void BuildRoadClick_X_Dir(Window *w)
 {
-	HandlePlacePushButton(w, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nesw, 1, PlaceRoad_NE);
+	HandlePlacePushButton(w, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, VHM_RECT, PlaceRoad_X_Dir);
 }
 
-static void BuildRoadClick_NW(Window *w)
+/**
+ * Function that handles the click on the
+ *  Y road placement button.
+ *
+ * @param w The current window
+ */
+static void BuildRoadClick_Y_Dir(Window *w)
 {
-	HandlePlacePushButton(w, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nwse, 1, PlaceRoad_NW);
+	HandlePlacePushButton(w, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, VHM_RECT, PlaceRoad_Y_Dir);
 }
 
+/**
+ * Function that handles the click on the
+ *  autoroad placement button.
+ *
+ * @param w The current window
+ */
+static void BuildRoadClick_AutoRoad(Window *w)
+{
+	HandlePlacePushButton(w, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, VHM_RECT, PlaceRoad_AutoRoad);
+}
 
 static void BuildRoadClick_Demolish(Window *w)
 {
-	HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, 1, PlaceRoad_DemolishArea);
+	HandlePlacePushButton(w, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceRoad_DemolishArea);
 }
 
 static void BuildRoadClick_Depot(Window *w)
 {
 	if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
-	if (HandlePlacePushButton(w, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();
+	if (HandlePlacePushButton(w, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, VHM_RECT, PlaceRoad_Depot)) ShowRoadDepotPicker();
 }
 
 static void BuildRoadClick_BusStation(Window *w)
 {
 	if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
-	if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowRVStationPicker(RoadStop::BUS);
+	if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, VHM_RECT, PlaceRoad_BusStation)) ShowRVStationPicker(RoadStop::BUS);
 }
 
 static void BuildRoadClick_TruckStation(Window *w)
 {
 	if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
-	if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowRVStationPicker(RoadStop::TRUCK);
+	if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, VHM_RECT, PlaceRoad_TruckStation)) ShowRVStationPicker(RoadStop::TRUCK);
+}
+
+/**
+ * Function that handles the click on the
+ *  one way road button.
+ *
+ * @param w The current window
+ */
+static void BuildRoadClick_OneWay(Window *w)
+{
+	if (IsWindowWidgetDisabled(w, RTW_ONE_WAY)) return;
+	SetWindowDirty(w);
+	ToggleWidgetLoweredState(w, RTW_ONE_WAY);
+	SetSelectionRed(false);
 }
 
 static void BuildRoadClick_Bridge(Window *w)
 {
-	HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge);
+	HandlePlacePushButton(w, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceRoad_Bridge);
 }
 
 static void BuildRoadClick_Tunnel(Window *w)
 {
-	HandlePlacePushButton(w, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel);
+	HandlePlacePushButton(w, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, VHM_SPECIAL, PlaceRoad_Tunnel);
 }
 
 static void BuildRoadClick_Remove(Window *w)
@@ -251,18 +342,22 @@
 	SetSelectionRed(IsWindowWidgetLowered(w, RTW_REMOVE));
 }
 
+/** Array with the handlers of the button-clicks for the road-toolbar */
 static OnButtonClick* const _build_road_button_proc[] = {
-	BuildRoadClick_NE,
-	BuildRoadClick_NW,
+	BuildRoadClick_X_Dir,
+	BuildRoadClick_Y_Dir,
+	BuildRoadClick_AutoRoad,
 	BuildRoadClick_Demolish,
 	BuildRoadClick_Depot,
 	BuildRoadClick_BusStation,
 	BuildRoadClick_TruckStation,
+	BuildRoadClick_OneWay,
 	BuildRoadClick_Bridge,
 	BuildRoadClick_Tunnel,
 	BuildRoadClick_Remove
 };
 
+/** Array with the keycode of the button-clicks for the road-toolbar */
 static const uint16 _road_keycodes[] = {
 	'1',
 	'2',
@@ -270,6 +365,8 @@
 	'4',
 	'5',
 	'6',
+	'7',
+	'8',
 	'B',
 	'T',
 	'R',
@@ -281,28 +378,42 @@
  * @param w The toolbar window
  * @param clicked_widget The widget which the player clicked just now
  */
-static void UpdateRemoveWidgetStatus(Window *w, int clicked_widget)
+static void UpdateOptionWidgetStatus(Window *w, int clicked_widget)
 {
+	/* The remove and the one way button state is driven
+	 * by the other buttons so they don't act on themselfs.
+	 * Both are only valid if they are able to apply as options. */
 	switch (clicked_widget) {
 		case RTW_REMOVE:
-			/* If it is the removal button that has been clicked, do nothing,
-			 * as it is up to the other buttons to drive removal status */
-			return;
+			RaiseWindowWidget(w, RTW_ONE_WAY);
+			break;
+		case RTW_ONE_WAY:
+			RaiseWindowWidget(w, RTW_REMOVE);
+			break;
+		case RTW_BUS_STATION:
+		case RTW_TRUCK_STATION:
+			DisableWindowWidget(w, RTW_ONE_WAY);
+			SetWindowWidgetDisabledState(w, RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget));
 			break;
 		case RTW_ROAD_X:
 		case RTW_ROAD_Y:
-		case RTW_BUS_STATION:
-		case RTW_TRUCK_STATION:
-			/* Removal button is enabled only if the road/station
-			 * button is still lowered.  Once raised, it has to be disabled */
-			SetWindowWidgetDisabledState(w, RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget));
+		case RTW_AUTOROAD:
+			SetWindowWidgetsDisabledState(w, !IsWindowWidgetLowered(w, clicked_widget),
+				RTW_REMOVE,
+				RTW_ONE_WAY,
+				WIDGET_LIST_END);
 			break;
-
 		default:
 			/* When any other buttons than road/station, raise and
 			 * disable the removal button */
-			DisableWindowWidget(w, RTW_REMOVE);
-			RaiseWindowWidget(w, RTW_REMOVE);
+			SetWindowWidgetsDisabledState(w, true,
+				RTW_REMOVE,
+				RTW_ONE_WAY,
+				WIDGET_LIST_END);
+			SetWindowWidgetsLoweredState (w, false,
+				RTW_REMOVE,
+				RTW_ONE_WAY,
+				WIDGET_LIST_END);
 			break;
 	}
 }
@@ -310,7 +421,12 @@
 static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: DisableWindowWidget(w, RTW_REMOVE); break;
+	case WE_CREATE:
+		SetWindowWidgetsDisabledState(w, true,
+			RTW_REMOVE,
+			RTW_ONE_WAY,
+			WIDGET_LIST_END);
+		break;
 
 	case WE_PAINT:
 		SetWindowWidgetsDisabledState(w, !CanBuildVehicleInfrastructure(VEH_ROAD),
@@ -324,9 +440,10 @@
 	case WE_CLICK:
 		if (e->we.click.widget >= RTW_ROAD_X) {
 			_remove_button_clicked = false;
+			_one_way_button_clicked = false;
 			_build_road_button_proc[e->we.click.widget - RTW_ROAD_X](w);
 		}
-		UpdateRemoveWidgetStatus(w, e->we.click.widget);
+		UpdateOptionWidgetStatus(w, e->we.click.widget);
 		break;
 
 	case WE_KEYPRESS:
@@ -334,8 +451,9 @@
 			if (e->we.keypress.keycode == _road_keycodes[i]) {
 				e->we.keypress.cont = false;
 				_remove_button_clicked = false;
+				_one_way_button_clicked = false;
 				_build_road_button_proc[i](w);
-				UpdateRemoveWidgetStatus(w, i + RTW_ROAD_X);
+				UpdateOptionWidgetStatus(w, i + RTW_ROAD_X);
 				break;
 			}
 		}
@@ -344,6 +462,7 @@
 
 	case WE_PLACE_OBJ:
 		_remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE);
+		_one_way_button_clicked = IsWindowWidgetLowered(w, RTW_ONE_WAY);
 		_place_proc(e->we.place.tile);
 		break;
 
@@ -361,13 +480,38 @@
 		break;
 
 	case WE_PLACE_DRAG:
+		/* Here we update the end tile flags
+		 * of the road placement actions.
+		 * At first we reset the end halfroad
+		 * bits and if needed we set them again. */
 		switch (e->we.place.select_proc) {
-			case DDSP_PLACE_ROAD_NE:
-				_place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.y & 8) >> 2);
+			case DDSP_PLACE_ROAD_X_DIR:
+				_place_road_flag &= ~RF_END_HALFROAD_X;
+				if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
 				break;
 
-			case DDSP_PLACE_ROAD_NW:
-				_place_road_flag = (_place_road_flag & ~2) | ((e->we.place.pt.x & 8) >> 2);
+			case DDSP_PLACE_ROAD_Y_DIR:
+				_place_road_flag &= ~RF_END_HALFROAD_Y;
+				if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
+				break;
+
+			case DDSP_PLACE_AUTOROAD:
+				_place_road_flag &= ~(RF_END_HALFROAD_Y | RF_END_HALFROAD_X);
+				if (e->we.place.pt.y & 8) _place_road_flag |= RF_END_HALFROAD_Y;
+				if (e->we.place.pt.x & 8) _place_road_flag |= RF_END_HALFROAD_X;
+
+				/* For autoroad we need to update the
+				 * direction of the road */
+				if (_thd.size.x > _thd.size.y || (_thd.size.x == _thd.size.y &&
+						( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
+						  (_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
+					/* Set dir = X */
+					_place_road_flag &= ~RF_DIR_Y;
+				} else {
+					/* Set dir = Y */
+					_place_road_flag |= RF_DIR_Y;
+				}
+
 				break;
 		}
 
@@ -389,10 +533,17 @@
 					DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
 					break;
 
-				case DDSP_PLACE_ROAD_NE:
-				case DDSP_PLACE_ROAD_NW:
-					DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | _ctrl_pressed << 5, CcPlaySound1D,
-						_remove_button_clicked ?
+				case DDSP_PLACE_ROAD_X_DIR:
+				case DDSP_PLACE_ROAD_Y_DIR:
+				case DDSP_PLACE_AUTOROAD:
+					/* Flag description:
+					 * Use the first three bits (0x07) if dir == Y
+					 * else use the last 2 bits (X dir has
+					 * not the 3rd bit set) */
+					_place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
+
+					DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5), CcPlaySound1D,
+						(_ctrl_pressed || _remove_button_clicked) ?
 						CMD_REMOVE_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
 						CMD_BUILD_LONG_ROAD | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road));
 					break;
@@ -417,23 +568,26 @@
 /** Widget definition of the build road toolbar */
 static const Widget _build_road_widgets[] = {
 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},             // RTW_CLOSEBOX
-{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   205,     0,    13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},   // RTW_CAPTION
-{  WWT_STICKYBOX,   RESIZE_NONE,     7,   206,   217,     0,    13, 0x0,                        STR_STICKY_BUTTON},                 // RTW_STICKY
+{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   250,     0,    13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},   // RTW_CAPTION
+{  WWT_STICKYBOX,   RESIZE_NONE,     7,   251,   262,     0,    13, 0x0,                        STR_STICKY_BUTTON},                 // RTW_STICKY
 
-{     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_ROAD_NW,            STR_180B_BUILD_ROAD_SECTION},       // RTW_ROAD_X
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_ROAD_NE,            STR_180B_BUILD_ROAD_SECTION},       // RTW_ROAD_Y
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},   // RTW_DEMOLISH
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    66,    87,    14,    35, SPR_IMG_ROAD_DEPOT,         STR_180C_BUILD_ROAD_VEHICLE_DEPOT}, // RTW_DEPOT
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    88,   109,    14,    35, SPR_IMG_BUS_STATION,        STR_180D_BUILD_BUS_STATION},        // RTW_BUS_STATION
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   110,   131,    14,    35, SPR_IMG_TRUCK_BAY,          STR_180E_BUILD_TRUCK_LOADING_BAY},  // RTW_TRUCK_STATION
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   132,   173,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_ROAD_BRIDGE},        // RTW_BUILD_BRIDGE
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   174,   195,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_ROAD_TUNNEL},        // RTW_BUILD_TUNNEL
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   196,   217,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR},  // RTW_REMOVE
+{     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_ROAD_X_DIR,         STR_180B_BUILD_ROAD_SECTION},       // RTW_ROAD_X
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_ROAD_Y_DIR,         STR_180B_BUILD_ROAD_SECTION},       // RTW_ROAD_Y
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_AUTOROAD,           STR_BUILD_AUTOROAD_TIP},            // RTW_AUTOROAD
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    66,    87,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},   // RTW_DEMOLISH
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    88,   109,    14,    35, SPR_IMG_ROAD_DEPOT,         STR_180C_BUILD_ROAD_VEHICLE_DEPOT}, // RTW_DEPOT
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   110,   131,    14,    35, SPR_IMG_BUS_STATION,        STR_180D_BUILD_BUS_STATION},        // RTW_BUS_STATION
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   132,   153,    14,    35, SPR_IMG_TRUCK_BAY,          STR_180E_BUILD_TRUCK_LOADING_BAY},  // RTW_TRUCK_STATION
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   154,   175,    14,    35, SPR_IMG_ROAD_ONE_WAY,       STR_TOGGLE_ONE_WAY_ROAD},           // RTW_ONE_WAY
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   176,   218,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_ROAD_BRIDGE},        // RTW_BUILD_BRIDGE
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   219,   240,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_ROAD_TUNNEL},        // RTW_BUILD_TUNNEL
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   241,   262,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR},  // RTW_REMOVE
+
 {   WIDGETS_END},
 };
 
 static const WindowDesc _build_road_desc = {
-	WDP_ALIGN_TBR, 22, 218, 36, 218, 36,
+	WDP_ALIGN_TBR, 22, 263, 36, 263, 36,
 	WC_BUILD_TOOLBAR, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
 	_build_road_widgets,
@@ -443,23 +597,26 @@
 /** Widget definition of the build tram toolbar */
 static const Widget _build_tramway_widgets[] = {
 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},                     // RTW_CLOSEBOX
-{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   205,     0,    13, STR_1802_TRAMWAY_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},        // RTW_CAPTION
-{  WWT_STICKYBOX,   RESIZE_NONE,     7,   206,   217,     0,    13, 0x0,                        STR_STICKY_BUTTON},                         // RTW_STICKY
+{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   228,     0,    13, STR_1802_TRAMWAY_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},        // RTW_CAPTION
+{  WWT_STICKYBOX,   RESIZE_NONE,     7,   229,   240,     0,    13, 0x0,                        STR_STICKY_BUTTON},                         // RTW_STICKY
 
-{     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_TRAMWAY_NW,         STR_180B_BUILD_TRAMWAY_SECTION},            // RTW_ROAD_X
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_TRAMWAY_NE,         STR_180B_BUILD_TRAMWAY_SECTION},            // RTW_ROAD_Y
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},           // RTW_DEMOLISH
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    66,    87,    14,    35, SPR_IMG_ROAD_DEPOT,         STR_180C_BUILD_TRAM_VEHICLE_DEPOT},         // RTW_DEPOT
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    88,   109,    14,    35, SPR_IMG_BUS_STATION,        STR_180D_BUILD_PASSENGER_TRAM_STATION},     // RTW_BUS_STATION
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   110,   131,    14,    35, SPR_IMG_TRUCK_BAY,          STR_180E_BUILD_CARGO_TRAM_STATION},         // RTW_TRUCK_STATION
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   132,   173,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_TRAMWAY_BRIDGE},             // RTW_BUILD_BRIDGE
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   174,   195,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_TRAMWAY_TUNNEL},             // RTW_BUILD_TUNNEL
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   196,   217,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS}, // RTW_REMOVE
+{     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_TRAMWAY_X_DIR,      STR_180B_BUILD_TRAMWAY_SECTION},            // RTW_ROAD_X
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_TRAMWAY_Y_DIR,      STR_180B_BUILD_TRAMWAY_SECTION},            // RTW_ROAD_Y
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_AUTOTRAM,           STR_BUILD_AUTOTRAM_TIP},                    // RTW_AUTOROAD
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    66,    87,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},           // RTW_DEMOLISH
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    88,   109,    14,    35, SPR_IMG_ROAD_DEPOT,         STR_180C_BUILD_TRAM_VEHICLE_DEPOT},         // RTW_DEPOT
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   110,   131,    14,    35, SPR_IMG_BUS_STATION,        STR_180D_BUILD_PASSENGER_TRAM_STATION},     // RTW_BUS_STATION
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   132,   153,    14,    35, SPR_IMG_TRUCK_BAY,          STR_180E_BUILD_CARGO_TRAM_STATION},         // RTW_TRUCK_STATION
+{      WWT_EMPTY,   RESIZE_NONE,     0,     0,     0,     0,     0, 0x0,                        STR_NULL},                                  // RTW_ONE_WAY
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   154,   196,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_TRAMWAY_BRIDGE},             // RTW_BUILD_BRIDGE
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   197,   218,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_TRAMWAY_TUNNEL},             // RTW_BUILD_TUNNEL
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   219,   240,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS}, // RTW_REMOVE
+
 {   WIDGETS_END},
 };
 
 static const WindowDesc _build_tramway_desc = {
-	WDP_ALIGN_TBR, 22, 218, 36, 218, 36,
+	WDP_ALIGN_TBR, 22, 241, 36, 241, 36,
 	WC_BUILD_TOOLBAR, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
 	_build_tramway_widgets,
@@ -479,23 +636,25 @@
 /** Widget definition of the build road toolbar in the scenario editor */
 static const Widget _build_road_scen_widgets[] = {
 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},            // RTW_CLOSEBOX
-{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   139,     0,    13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},  // RTW_CAPTION
-{  WWT_STICKYBOX,   RESIZE_NONE,     7,   140,   151,     0,    13, 0x0,                        STR_STICKY_BUTTON},                // RTW_STICKY
+{    WWT_CAPTION,   RESIZE_NONE,     7,    11,   184,     0,    13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},  // RTW_CAPTION
+{  WWT_STICKYBOX,   RESIZE_NONE,     7,   185,   196,     0,    13, 0x0,                        STR_STICKY_BUTTON},                // RTW_STICKY
 
-{     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_ROAD_NW,            STR_180B_BUILD_ROAD_SECTION},      // RTW_ROAD_X
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_ROAD_NE,            STR_180B_BUILD_ROAD_SECTION},      // RTW_ROAD_Y
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},  // RTW_DEMOLISH
+{     WWT_IMGBTN,   RESIZE_NONE,     7,     0,    21,    14,    35, SPR_IMG_ROAD_X_DIR,         STR_180B_BUILD_ROAD_SECTION},      // RTW_ROAD_X
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    22,    43,    14,    35, SPR_IMG_ROAD_Y_DIR,         STR_180B_BUILD_ROAD_SECTION},      // RTW_ROAD_Y
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    44,    65,    14,    35, SPR_IMG_AUTOROAD,           STR_BUILD_AUTOROAD_TIP},           // RTW_AUTOROAD
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    66,    87,    14,    35, SPR_IMG_DYNAMITE,           STR_018D_DEMOLISH_BUILDINGS_ETC},  // RTW_DEMOLISH
 {      WWT_EMPTY,   RESIZE_NONE,     0,     0,     0,     0,     0, 0x0,                        STR_NULL},                         // RTW_DEPOT
 {      WWT_EMPTY,   RESIZE_NONE,     0,     0,     0,     0,     0, 0x0,                        STR_NULL},                         // RTW_BUS_STATION
 {      WWT_EMPTY,   RESIZE_NONE,     0,     0,     0,     0,     0, 0x0,                        STR_NULL},                         // RTW_TRUCK_STATION
-{     WWT_IMGBTN,   RESIZE_NONE,     7,    66,   107,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_ROAD_BRIDGE},       // RTW_BUILD_BRIDGE
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   108,   129,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_ROAD_TUNNEL},       // RTW_BUILD_TUNNEL
-{     WWT_IMGBTN,   RESIZE_NONE,     7,   130,   151,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR}, // RTW_REMOVE
+{     WWT_IMGBTN,   RESIZE_NONE,     7,    88,   109,    14,    35, SPR_IMG_ROAD_ONE_WAY,       STR_TOGGLE_ONE_WAY_ROAD},          // RTW_ONE_WAY
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   110,   152,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_ROAD_BRIDGE},       // RTW_BUILD_BRIDGE
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   153,   174,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_ROAD_TUNNEL},       // RTW_BUILD_TUNNEL
+{     WWT_IMGBTN,   RESIZE_NONE,     7,   175,   196,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR}, // RTW_REMOVE
 {   WIDGETS_END},
 };
 
 static const WindowDesc _build_road_scen_desc = {
-	WDP_AUTO, WDP_AUTO, 152, 36, 152, 36,
+	WDP_AUTO, WDP_AUTO, 197, 36, 197, 36,
 	WC_SCEN_BUILD_ROAD, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
 	_build_road_scen_widgets,