Changeset - r7906:fcc177c43cab
[Not reviewed]
master
0 6 0
skidd13 - 17 years ago 2007-11-18 13:55:23
skidd13@openttd.org
(svn r11457) -Fix: (r11455) Reenable the accidentaly removed one way roads option
-Change: Enable one way roads like the remove via a toolbar icon
6 files changed with 80 insertions and 37 deletions:
0 comments (0 inline, 0 general)
bin/data/openttdd.grf
Show inline comments
 
binary diff not shown
bin/data/openttdw.grf
Show inline comments
 
binary diff not shown
src/lang/english.txt
Show inline comments
 
@@ -1674,24 +1674,25 @@ STR_BUILD_AUTOROAD_TIP                  
 
STR_180B_BUILD_TRAMWAY_SECTION                                  :{BLACK}Build tramway section
 
STR_BUILD_AUTOTRAM_TIP                                          :{BLACK}Build tramway section using the Autotram mode
 
STR_180C_BUILD_ROAD_VEHICLE_DEPOT                               :{BLACK}Build road vehicle depot (for building and servicing vehicles)
 
STR_180C_BUILD_TRAM_VEHICLE_DEPOT                               :{BLACK}Build tram vehicle depot (for building and servicing vehicles)
 
STR_180D_BUILD_BUS_STATION                                      :{BLACK}Build bus station
 
STR_180E_BUILD_TRUCK_LOADING_BAY                                :{BLACK}Build lorry loading bay
 
STR_180D_BUILD_PASSENGER_TRAM_STATION                           :{BLACK}Build passenger tram station
 
STR_180E_BUILD_CARGO_TRAM_STATION                               :{BLACK}Build freight tram station
 
STR_180F_BUILD_ROAD_BRIDGE                                      :{BLACK}Build road bridge
 
STR_180F_BUILD_TRAMWAY_BRIDGE                                   :{BLACK}Build tramway bridge
 
STR_1810_BUILD_ROAD_TUNNEL                                      :{BLACK}Build road tunnel
 
STR_1810_BUILD_TRAMWAY_TUNNEL                                   :{BLACK}Build tramway tunnel
 
STR_TOGGLE_ONE_WAY_ROAD                                         :{BLACK}Activate/Deactivate one way roads
 
STR_1811_TOGGLE_BUILD_REMOVE_FOR                                :{BLACK}Toggle build/remove for road construction
 
STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS                       :{BLACK}Toggle build/remove for tramway construction
 
STR_1813_SELECT_ROAD_VEHICLE_DEPOT                              :{BLACK}Select road vehicle depot orientation
 
STR_1813_SELECT_TRAM_VEHICLE_DEPOT                              :{BLACK}Select tram vehicle depot orientation
 
STR_1814_ROAD                                                   :Road
 
STR_1815_ROAD_WITH_STREETLIGHTS                                 :Road with streetlights
 
STR_1816_TREE_LINED_ROAD                                        :Tree-lined road
 
STR_1817_ROAD_VEHICLE_DEPOT                                     :Road vehicle depot
 
STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Road/rail level crossing
 
STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Can't remove bus station...
 
STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Can't remove lorry station...
 
STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Can't remove passenger tram station...
src/road_gui.cpp
Show inline comments
 
@@ -20,24 +20,25 @@
 
#include "road.h"
 
#include "road_cmd.h"
 
#include "road_map.h"
 
#include "station_map.h"
 
//needed for catchments
 
#include "station.h"
 

	
 

	
 
static void ShowRVStationPicker(RoadStop::Type rs);
 
static void ShowRoadDepotPicker();
 

	
 
static bool _remove_button_clicked;
 
static bool _one_way_button_clicked;
 

	
 
/**
 
 * 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
 
@@ -235,24 +236,25 @@ static void PlaceRoad_DemolishArea(TileI
 
/** Enum referring to the widgets of the build road toolbar */
 
enum RoadToolbarWidgets {
 
	RTW_CLOSEBOX = 0,
 
	RTW_CAPTION,
 
	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,
 
};
 

	
 
typedef void OnButtonClick(Window *w);
 

	
 
/**
 
 * Function that handles the click on the
 
 *  X road placement button.
 
 *
 
 * @param w The current window
 
@@ -298,24 +300,37 @@ static void BuildRoadClick_Depot(Window 
 
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, 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, 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);
 
}
 

	
 
static void BuildRoadClick_Bridge(Window *w)
 
{
 
	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, VHM_SPECIAL, PlaceRoad_Tunnel);
 
}
 

	
 
static void BuildRoadClick_Remove(Window *w)
 
{
 
@@ -326,113 +341,136 @@ static void BuildRoadClick_Remove(Window
 
	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_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',
 
	'3',
 
	'4',
 
	'5',
 
	'6',
 
	'7',
 
	'8',
 
	'B',
 
	'T',
 
	'R',
 
};
 

	
 
/**
 
 * Update the remove button lowered state of the road toolbar
 
 *
 
 * @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_AUTOROAD:
 
		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));
 
			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;
 
	}
 
}
 

	
 
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),
 
			RTW_DEPOT,
 
			RTW_BUS_STATION,
 
			RTW_TRUCK_STATION,
 
			WIDGET_LIST_END);
 
		DrawWindowWidgets(w);
 
		break;
 

	
 
	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:
 
		for (uint8 i = 0; i != lengthof(_road_keycodes); i++) {
 
			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;
 
			}
 
		}
 
		MarkTileDirty(_thd.pos.x, _thd.pos.y); // redraw tile selection
 
		break;
 

	
 
	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;
 

	
 
	case WE_ABORT_PLACE_OBJ:
 
		RaiseWindowButtons(w);
 
		DisableWindowWidget(w, RTW_REMOVE);
 
		InvalidateWidget(w, RTW_REMOVE);
 

	
 
		w = FindWindowById(WC_BUS_STATION, 0);
 
		if (w != NULL) WP(w, def_d).close = true;
 
		w = FindWindowById(WC_TRUCK_STATION, 0);
 
		if (w != NULL) WP(w, def_d).close = true;
 
@@ -494,25 +532,25 @@ static void BuildRoadToolbWndProc(Window
 
					DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
 
					break;
 

	
 
				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) | _ctrl_pressed << 5, CcPlaySound1D,
 
					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;
 
			}
 
		}
 
		break;
 

	
 
	case WE_PLACE_PRESIZE: {
 
		TileIndex tile = e->we.place.tile;
 

	
 
		DoCommand(tile, 0x200 | RoadTypeToRoadTypes(_cur_roadtype), 0, DC_AUTO, CMD_BUILD_TUNNEL);
 
@@ -520,108 +558,111 @@ static void BuildRoadToolbWndProc(Window
 
		break;
 
	}
 

	
 
	case WE_DESTROY:
 
		if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
		break;
 
	}
 
}
 

	
 
/** 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,   227,     0,    13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},   // RTW_CAPTION
 
{  WWT_STICKYBOX,   RESIZE_NONE,     7,   228,   239,     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_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,   153,   195,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_ROAD_BRIDGE},        // RTW_BUILD_BRIDGE
 
{     WWT_IMGBTN,   RESIZE_NONE,     7,   196,   217,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_ROAD_TUNNEL},        // RTW_BUILD_TUNNEL
 
{     WWT_IMGBTN,   RESIZE_NONE,     7,   218,   239,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR},  // RTW_REMOVE
 
{     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, 240, 36, 240, 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,
 
	BuildRoadToolbWndProc
 
};
 

	
 
/** 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,   227,     0,    13, STR_1802_TRAMWAY_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},        // RTW_CAPTION
 
{  WWT_STICKYBOX,   RESIZE_NONE,     7,   228,   239,     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_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_IMGBTN,   RESIZE_NONE,     7,   153,   195,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_TRAMWAY_BRIDGE},             // RTW_BUILD_BRIDGE
 
{     WWT_IMGBTN,   RESIZE_NONE,     7,   196,   217,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_TRAMWAY_TUNNEL},             // RTW_BUILD_TUNNEL
 
{     WWT_IMGBTN,   RESIZE_NONE,     7,   218,   239,    14,    35, SPR_IMG_REMOVE,             STR_1811_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS}, // RTW_REMOVE
 
{      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, 240, 36, 240, 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,
 
	BuildRoadToolbWndProc
 
};
 

	
 
void ShowBuildRoadToolbar(RoadType roadtype)
 
{
 
	if (!IsValidPlayer(_current_player)) return;
 
	_cur_roadtype = roadtype;
 

	
 
	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 
	Window *w = AllocateWindowDesc(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc);
 
	if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
 
}
 

	
 
/** 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,   161,     0,    13, STR_1802_ROAD_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},  // RTW_CAPTION
 
{  WWT_STICKYBOX,   RESIZE_NONE,     7,   162,   173,     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_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,    88,   130,    14,    35, SPR_IMG_BRIDGE,             STR_180F_BUILD_ROAD_BRIDGE},       // RTW_BUILD_BRIDGE
 
{     WWT_IMGBTN,   RESIZE_NONE,     7,   131,   151,    14,    35, SPR_IMG_ROAD_TUNNEL,        STR_1810_BUILD_ROAD_TUNNEL},       // RTW_BUILD_TUNNEL
 
{     WWT_IMGBTN,   RESIZE_NONE,     7,   152,   173,    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, 174, 36, 174, 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,
 
	BuildRoadToolbWndProc
 
};
 

	
 
void ShowBuildRoadScenToolbar()
 
{
 
	_cur_roadtype = ROADTYPE_ROAD;
 
	AllocateWindowDescFront(&_build_road_scen_desc, 0);
 
}
 

	
src/table/files.h
Show inline comments
 
@@ -25,28 +25,28 @@
 

	
 
static FileList files_dos = {
 
	{
 
		{ "TRG1.GRF",      {0x93, 0x11, 0x67, 0x62, 0x80, 0xe5, 0xb1, 0x40, 0x77, 0xa8, 0xee, 0x41, 0xc1, 0xb4, 0x21, 0x92} }, //    0 - 4792 inclusive
 
		{ "TRGI.GRF",      {0xda, 0x6a, 0x6c, 0x9d, 0xcc, 0x45, 0x1e, 0xec, 0x88, 0xd7, 0x92, 0x11, 0x43, 0x7b, 0x76, 0xa8} }  // 4793 - 4889 inclusive
 
	}, {
 
		{ "TRGC.GRF",      {0xed, 0x44, 0x66, 0x37, 0xe0, 0x34, 0x10, 0x4c, 0x55, 0x59, 0xb3, 0x2c, 0x18, 0xaf, 0xe7, 0x8d} },
 
		{ "TRGH.GRF",      {0xee, 0x66, 0x16, 0xfb, 0x0e, 0x6e, 0xf6, 0xb2, 0x48, 0x92, 0xc5, 0x8c, 0x93, 0xd8, 0x6f, 0xc9} },
 
		{ "TRGT.GRF",      {0xfc, 0xde, 0x1d, 0x7e, 0x8a, 0x74, 0x19, 0x7d, 0x72, 0xa6, 0x26, 0x95, 0x88, 0x4b, 0x90, 0x9e} }
 
	},
 
	{ "SAMPLE.CAT",    {0x42, 0x2e, 0xa3, 0xdd, 0x07, 0x4d, 0x28, 0x59, 0xbb, 0x51, 0x63, 0x9a, 0x6e, 0x0e, 0x85, 0xda} },
 
	{ "CHARS.GRF",     {0x5f, 0x2e, 0xbf, 0x05, 0xb6, 0x12, 0x65, 0x81, 0xd2, 0x10, 0xa9, 0x19, 0x62, 0x41, 0x70, 0x64} },
 
	{ "OPENTTDD.GRF",  {0x85, 0x5f, 0x38, 0xa6, 0xb2, 0xc9, 0xd7, 0x51, 0xaa, 0xca, 0x0d, 0xae, 0xd9, 0x8d, 0x71, 0x98} }
 
	{ "OPENTTDD.GRF",  {0x4a, 0x9e, 0x0d, 0x41, 0x9e, 0x66, 0x13, 0x17, 0xb9, 0x61, 0x81, 0xc7, 0xca, 0xef, 0x6b, 0xdc} }
 
};
 

	
 
static FileList files_win = {
 
	{
 
		{ "TRG1R.GRF",     {0xb0, 0x4c, 0xe5, 0x93, 0xd8, 0xc5, 0x01, 0x6e, 0x07, 0x47, 0x3a, 0x74, 0x3d, 0x7d, 0x33, 0x58} }, //    0 - 4792 inclusive
 
		{ "TRGIR.GRF",     {0x0c, 0x24, 0x84, 0xff, 0x6b, 0xe4, 0x9f, 0xc6, 0x3a, 0x83, 0xbe, 0x6a, 0xb5, 0xc3, 0x8f, 0x32} }  // 4793 - 4895 inclusive
 
	}, {
 
		{ "TRGCR.GRF",     {0x36, 0x68, 0xf4, 0x10, 0xc7, 0x61, 0xa0, 0x50, 0xb5, 0xe7, 0x09, 0x5a, 0x2b, 0x14, 0x87, 0x9b} },
 
		{ "TRGHR.GRF",     {0x06, 0xbf, 0x2b, 0x7a, 0x31, 0x76, 0x6f, 0x04, 0x8b, 0xaa, 0xc2, 0xeb, 0xe4, 0x34, 0x57, 0xb1} },
 
		{ "TRGTR.GRF",     {0xde, 0x53, 0x65, 0x05, 0x17, 0xfe, 0x66, 0x1c, 0xea, 0xa3, 0x13, 0x8c, 0x6e, 0xdb, 0x0e, 0xb8} }
 
	},
 
	{ "SAMPLE.CAT",    {0x92, 0x12, 0xe8, 0x1e, 0x72, 0xba, 0xdd, 0x4b, 0xbe, 0x1e, 0xae, 0xae, 0x66, 0x45, 0x8e, 0x10} },
 
	{ "CHARS.GRF",     {0x5f, 0x2e, 0xbf, 0x05, 0xb6, 0x12, 0x65, 0x81, 0xd2, 0x10, 0xa9, 0x19, 0x62, 0x41, 0x70, 0x64} },
 
	{ "OPENTTDW.GRF",  {0x3e, 0xff, 0xe8, 0x43, 0xc9, 0x31, 0xf6, 0x9d, 0x0b, 0x40, 0xb1, 0x64, 0xbf, 0x16, 0xde, 0x5a} }
 
	{ "OPENTTDW.GRF",  {0xe7, 0xe5, 0x4a, 0x12, 0x5c, 0xec, 0x46, 0x53, 0x1d, 0x37, 0x0a, 0xf4, 0x69, 0xf7, 0x4a, 0x9c} }
 
};
src/table/sprites.h
Show inline comments
 
@@ -38,25 +38,25 @@ enum Sprites {
 
	SPR_DOT_SMALL    = 4078,
 
	SPR_WHITE_POINT  = 4079,
 

	
 
	/* ASCII */
 
	SPR_ASCII_SPACE       = 2,
 
	SPR_ASCII_SPACE_SMALL = 226,
 
	SPR_ASCII_SPACE_BIG   = 450,
 

	
 
	SPR_LARGE_SMALL_WINDOW = 682,
 

	
 
	/* Extra graphic spritenumbers */
 
	SPR_OPENTTD_BASE     = 4896,
 
	OPENTTD_SPRITE_COUNT = 134,
 
	OPENTTD_SPRITE_COUNT = 135,
 

	
 
	/* Halftile-selection sprites */
 
	SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE,
 
	SPR_HALFTILE_SELECTION_DOWN = SPR_OPENTTD_BASE + 4,
 
	SPR_HALFTILE_SELECTION_UP   = SPR_OPENTTD_BASE + 8,
 

	
 
	SPR_SQUARE             = SPR_OPENTTD_BASE + 38, // colored square (used for newgrf compatibility)
 
	SPR_BLOT               = SPR_OPENTTD_BASE + 39, // colored circle (mainly used as vehicle profit marker and for server compatibility)
 
	SPR_LOCK               = SPR_OPENTTD_BASE + 40, // lock icon (for password protected servers)
 
	SPR_BOX_EMPTY          = SPR_OPENTTD_BASE + 41,
 
	SPR_BOX_CHECKED        = SPR_OPENTTD_BASE + 42,
 
	SPR_WARNING_SIGN       = SPR_OPENTTD_BASE + 43, // warning sign (shown if there are any newgrf errors)
 
@@ -1229,24 +1229,25 @@ enum Sprites {
 
	SPR_IMG_PLAY_MUSIC    = 712,
 

	
 
	/* road_gui.c */
 
	SPR_IMG_ROAD_Y_DIR    = 1309,
 
	SPR_IMG_ROAD_X_DIR    = 1310,
 
	SPR_IMG_AUTOROAD      = SPR_OPENTTD_BASE + 82,
 
	SPR_IMG_ROAD_DEPOT    = 1295,
 
	SPR_IMG_BUS_STATION   = 749,
 
	SPR_IMG_TRUCK_BAY     = 750,
 
	SPR_IMG_BRIDGE        = 2594,
 
	SPR_IMG_ROAD_TUNNEL   = 2429,
 
	SPR_IMG_REMOVE        = 714,
 
	SPR_IMG_ROAD_ONE_WAY  = SPR_OPENTTD_BASE + 134,
 
	SPR_IMG_TRAMWAY_Y_DIR = SPR_TRAMWAY_BASE + 0,
 
	SPR_IMG_TRAMWAY_X_DIR = SPR_TRAMWAY_BASE + 1,
 
	SPR_IMG_AUTOTRAM      = SPR_OPENTTD_BASE + 84,
 

	
 
	/* rail_gui.c */
 
	SPR_IMG_RAIL_NS    = 1251,
 
	SPR_IMG_RAIL_NE    = 1252,
 
	SPR_IMG_RAIL_EW    = 1253,
 
	SPR_IMG_RAIL_NW    = 1254,
 
	SPR_IMG_AUTORAIL   = SPR_OPENTTD_BASE + 53,
 
	SPR_IMG_AUTOELRAIL = SPR_OPENTTD_BASE + 57,
 
	SPR_IMG_AUTOMONO   = SPR_OPENTTD_BASE + 63,
0 comments (0 inline, 0 general)