(svn r23559) -Codechange: Document and name consistently road build widgets

This commit is contained in:
planetmaker 2011-12-16 18:52:15 +00:00
parent ff4bfded7a
commit 6bbae674b8
2 changed files with 189 additions and 189 deletions

View File

@ -278,9 +278,9 @@ typedef void OnButtonClick(Window *w);
*/ */
static void ToggleRoadButton_Remove(Window *w) static void ToggleRoadButton_Remove(Window *w)
{ {
w->ToggleWidgetLoweredState(ROTW_REMOVE); w->ToggleWidgetLoweredState(WID_ROT_REMOVE);
w->SetWidgetDirty(ROTW_REMOVE); w->SetWidgetDirty(WID_ROT_REMOVE);
_remove_button_clicked = w->IsWidgetLowered(ROTW_REMOVE); _remove_button_clicked = w->IsWidgetLowered(WID_ROT_REMOVE);
SetSelectionRed(_remove_button_clicked); SetSelectionRed(_remove_button_clicked);
} }
@ -291,10 +291,10 @@ static void ToggleRoadButton_Remove(Window *w)
*/ */
static bool RoadToolbar_CtrlChanged(Window *w) static bool RoadToolbar_CtrlChanged(Window *w)
{ {
if (w->IsWidgetDisabled(ROTW_REMOVE)) return false; if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
/* allow ctrl to switch remove mode only for these widgets */ /* allow ctrl to switch remove mode only for these widgets */
for (uint i = ROTW_ROAD_X; i <= ROTW_AUTOROAD; i++) { for (uint i = WID_ROT_ROAD_X; i <= WID_ROT_AUTOROAD; i++) {
if (w->IsWidgetLowered(i)) { if (w->IsWidgetLowered(i)) {
ToggleRoadButton_Remove(w); ToggleRoadButton_Remove(w);
return true; return true;
@ -312,8 +312,8 @@ struct BuildRoadToolbarWindow : Window {
{ {
this->InitNested(desc, window_number); this->InitNested(desc, window_number);
this->SetWidgetsDisabledState(true, this->SetWidgetsDisabledState(true,
ROTW_REMOVE, WID_ROT_REMOVE,
ROTW_ONE_WAY, WID_ROT_ONE_WAY,
WIDGET_LIST_END); WIDGET_LIST_END);
this->OnInvalidateData(); this->OnInvalidateData();
@ -336,9 +336,9 @@ struct BuildRoadToolbarWindow : Window {
{ {
if (!gui_scope) return; if (!gui_scope) return;
this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD), this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
ROTW_DEPOT, WID_ROT_DEPOT,
ROTW_BUS_STATION, WID_ROT_BUS_STATION,
ROTW_TRUCK_STATION, WID_ROT_TRUCK_STATION,
WIDGET_LIST_END); WIDGET_LIST_END);
} }
@ -353,28 +353,28 @@ struct BuildRoadToolbarWindow : Window {
* by the other buttons so they don't act on themselfs. * by the other buttons so they don't act on themselfs.
* Both are only valid if they are able to apply as options. */ * Both are only valid if they are able to apply as options. */
switch (clicked_widget) { switch (clicked_widget) {
case ROTW_REMOVE: case WID_ROT_REMOVE:
this->RaiseWidget(ROTW_ONE_WAY); this->RaiseWidget(WID_ROT_ONE_WAY);
this->SetWidgetDirty(ROTW_ONE_WAY); this->SetWidgetDirty(WID_ROT_ONE_WAY);
break; break;
case ROTW_ONE_WAY: case WID_ROT_ONE_WAY:
this->RaiseWidget(ROTW_REMOVE); this->RaiseWidget(WID_ROT_REMOVE);
this->SetWidgetDirty(ROTW_REMOVE); this->SetWidgetDirty(WID_ROT_REMOVE);
break; break;
case ROTW_BUS_STATION: case WID_ROT_BUS_STATION:
case ROTW_TRUCK_STATION: case WID_ROT_TRUCK_STATION:
this->DisableWidget(ROTW_ONE_WAY); this->DisableWidget(WID_ROT_ONE_WAY);
this->SetWidgetDisabledState(ROTW_REMOVE, !this->IsWidgetLowered(clicked_widget)); this->SetWidgetDisabledState(WID_ROT_REMOVE, !this->IsWidgetLowered(clicked_widget));
break; break;
case ROTW_ROAD_X: case WID_ROT_ROAD_X:
case ROTW_ROAD_Y: case WID_ROT_ROAD_Y:
case ROTW_AUTOROAD: case WID_ROT_AUTOROAD:
this->SetWidgetsDisabledState(!this->IsWidgetLowered(clicked_widget), this->SetWidgetsDisabledState(!this->IsWidgetLowered(clicked_widget),
ROTW_REMOVE, WID_ROT_REMOVE,
ROTW_ONE_WAY, WID_ROT_ONE_WAY,
WIDGET_LIST_END); WIDGET_LIST_END);
break; break;
@ -382,12 +382,12 @@ struct BuildRoadToolbarWindow : Window {
/* When any other buttons than road/station, raise and /* When any other buttons than road/station, raise and
* disable the removal button */ * disable the removal button */
this->SetWidgetsDisabledState(true, this->SetWidgetsDisabledState(true,
ROTW_REMOVE, WID_ROT_REMOVE,
ROTW_ONE_WAY, WID_ROT_ONE_WAY,
WIDGET_LIST_END); WIDGET_LIST_END);
this->SetWidgetsLoweredState(false, this->SetWidgetsLoweredState(false,
ROTW_REMOVE, WID_ROT_REMOVE,
ROTW_ONE_WAY, WID_ROT_ONE_WAY,
WIDGET_LIST_END); WIDGET_LIST_END);
break; break;
} }
@ -398,69 +398,69 @@ struct BuildRoadToolbarWindow : Window {
_remove_button_clicked = false; _remove_button_clicked = false;
_one_way_button_clicked = false; _one_way_button_clicked = false;
switch (widget) { switch (widget) {
case ROTW_ROAD_X: case WID_ROT_ROAD_X:
HandlePlacePushButton(this, ROTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT); HandlePlacePushButton(this, WID_ROT_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT);
this->last_started_action = widget; this->last_started_action = widget;
break; break;
case ROTW_ROAD_Y: case WID_ROT_ROAD_Y:
HandlePlacePushButton(this, ROTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT); HandlePlacePushButton(this, WID_ROT_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT);
this->last_started_action = widget; this->last_started_action = widget;
break; break;
case ROTW_AUTOROAD: case WID_ROT_AUTOROAD:
HandlePlacePushButton(this, ROTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT); HandlePlacePushButton(this, WID_ROT_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT);
this->last_started_action = widget; this->last_started_action = widget;
break; break;
case ROTW_DEMOLISH: case WID_ROT_DEMOLISH:
HandlePlacePushButton(this, ROTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); HandlePlacePushButton(this, WID_ROT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
this->last_started_action = widget; this->last_started_action = widget;
break; break;
case ROTW_DEPOT: case WID_ROT_DEPOT:
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(this, ROTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT)) { if (HandlePlacePushButton(this, WID_ROT_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT)) {
ShowRoadDepotPicker(this); ShowRoadDepotPicker(this);
this->last_started_action = widget; this->last_started_action = widget;
} }
break; break;
case ROTW_BUS_STATION: case WID_ROT_BUS_STATION:
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(this, ROTW_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) { if (HandlePlacePushButton(this, WID_ROT_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) {
ShowRVStationPicker(this, ROADSTOP_BUS); ShowRVStationPicker(this, ROADSTOP_BUS);
this->last_started_action = widget; this->last_started_action = widget;
} }
break; break;
case ROTW_TRUCK_STATION: case WID_ROT_TRUCK_STATION:
if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(this, ROTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) { if (HandlePlacePushButton(this, WID_ROT_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) {
ShowRVStationPicker(this, ROADSTOP_TRUCK); ShowRVStationPicker(this, ROADSTOP_TRUCK);
this->last_started_action = widget; this->last_started_action = widget;
} }
break; break;
case ROTW_ONE_WAY: case WID_ROT_ONE_WAY:
if (this->IsWidgetDisabled(ROTW_ONE_WAY)) return; if (this->IsWidgetDisabled(WID_ROT_ONE_WAY)) return;
this->SetDirty(); this->SetDirty();
this->ToggleWidgetLoweredState(ROTW_ONE_WAY); this->ToggleWidgetLoweredState(WID_ROT_ONE_WAY);
SetSelectionRed(false); SetSelectionRed(false);
break; break;
case ROTW_BUILD_BRIDGE: case WID_ROT_BUILD_BRIDGE:
HandlePlacePushButton(this, ROTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT); HandlePlacePushButton(this, WID_ROT_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT);
this->last_started_action = widget; this->last_started_action = widget;
break; break;
case ROTW_BUILD_TUNNEL: case WID_ROT_BUILD_TUNNEL:
HandlePlacePushButton(this, ROTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL); HandlePlacePushButton(this, WID_ROT_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL);
this->last_started_action = widget; this->last_started_action = widget;
break; break;
case ROTW_REMOVE: case WID_ROT_REMOVE:
if (this->IsWidgetDisabled(ROTW_REMOVE)) return; if (this->IsWidgetDisabled(WID_ROT_REMOVE)) return;
DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowById(WC_SELECT_STATION, 0);
ToggleRoadButton_Remove(this); ToggleRoadButton_Remove(this);
@ -484,50 +484,50 @@ struct BuildRoadToolbarWindow : Window {
virtual void OnPlaceObject(Point pt, TileIndex tile) virtual void OnPlaceObject(Point pt, TileIndex tile)
{ {
_remove_button_clicked = this->IsWidgetLowered(ROTW_REMOVE); _remove_button_clicked = this->IsWidgetLowered(WID_ROT_REMOVE);
_one_way_button_clicked = this->IsWidgetLowered(ROTW_ONE_WAY); _one_way_button_clicked = this->IsWidgetLowered(WID_ROT_ONE_WAY);
switch (this->last_started_action) { switch (this->last_started_action) {
case ROTW_ROAD_X: case WID_ROT_ROAD_X:
_place_road_flag = RF_DIR_X; _place_road_flag = RF_DIR_X;
if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X; if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X;
VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_X_DIR); VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_X_DIR);
break; break;
case ROTW_ROAD_Y: case WID_ROT_ROAD_Y:
_place_road_flag = RF_DIR_Y; _place_road_flag = RF_DIR_Y;
if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y; if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_Y_DIR); VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_Y_DIR);
break; break;
case ROTW_AUTOROAD: case WID_ROT_AUTOROAD:
_place_road_flag = RF_NONE; _place_road_flag = RF_NONE;
if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X; 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; if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y;
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD); VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD);
break; break;
case ROTW_DEMOLISH: case WID_ROT_DEMOLISH:
PlaceProc_DemolishArea(tile); PlaceProc_DemolishArea(tile);
break; break;
case ROTW_DEPOT: case WID_ROT_DEPOT:
DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0, DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0,
CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot); CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot);
break; break;
case ROTW_BUS_STATION: case WID_ROT_BUS_STATION:
PlaceRoad_BusStation(tile); PlaceRoad_BusStation(tile);
break; break;
case ROTW_TRUCK_STATION: case WID_ROT_TRUCK_STATION:
PlaceRoad_TruckStation(tile); PlaceRoad_TruckStation(tile);
break; break;
case ROTW_BUILD_BRIDGE: case WID_ROT_BUILD_BRIDGE:
PlaceRoad_Bridge(tile, this); PlaceRoad_Bridge(tile, this);
break; break;
case ROTW_BUILD_TUNNEL: case WID_ROT_BUILD_TUNNEL:
DoCommandP(tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, DoCommandP(tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0,
CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel); CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel);
break; break;
@ -540,11 +540,11 @@ struct BuildRoadToolbarWindow : Window {
{ {
this->RaiseButtons(); this->RaiseButtons();
this->SetWidgetsDisabledState(true, this->SetWidgetsDisabledState(true,
ROTW_REMOVE, WID_ROT_REMOVE,
ROTW_ONE_WAY, WID_ROT_ONE_WAY,
WIDGET_LIST_END); WIDGET_LIST_END);
this->SetWidgetDirty(ROTW_REMOVE); this->SetWidgetDirty(WID_ROT_REMOVE);
this->SetWidgetDirty(ROTW_ONE_WAY); this->SetWidgetDirty(WID_ROT_ONE_WAY);
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
@ -664,17 +664,17 @@ struct BuildRoadToolbarWindow : Window {
}; };
Hotkey<BuildRoadToolbarWindow> BuildRoadToolbarWindow::roadtoolbar_hotkeys[] = { Hotkey<BuildRoadToolbarWindow> BuildRoadToolbarWindow::roadtoolbar_hotkeys[] = {
Hotkey<BuildRoadToolbarWindow>('1', "build_x", ROTW_ROAD_X), Hotkey<BuildRoadToolbarWindow>('1', "build_x", WID_ROT_ROAD_X),
Hotkey<BuildRoadToolbarWindow>('2', "build_y", ROTW_ROAD_Y), Hotkey<BuildRoadToolbarWindow>('2', "build_y", WID_ROT_ROAD_Y),
Hotkey<BuildRoadToolbarWindow>('3', "autoroad", ROTW_AUTOROAD), Hotkey<BuildRoadToolbarWindow>('3', "autoroad", WID_ROT_AUTOROAD),
Hotkey<BuildRoadToolbarWindow>('4', "demolish", ROTW_DEMOLISH), Hotkey<BuildRoadToolbarWindow>('4', "demolish", WID_ROT_DEMOLISH),
Hotkey<BuildRoadToolbarWindow>('5', "depot", ROTW_DEPOT), Hotkey<BuildRoadToolbarWindow>('5', "depot", WID_ROT_DEPOT),
Hotkey<BuildRoadToolbarWindow>('6', "bus_station", ROTW_BUS_STATION), Hotkey<BuildRoadToolbarWindow>('6', "bus_station", WID_ROT_BUS_STATION),
Hotkey<BuildRoadToolbarWindow>('7', "truck_station", ROTW_TRUCK_STATION), Hotkey<BuildRoadToolbarWindow>('7', "truck_station", WID_ROT_TRUCK_STATION),
Hotkey<BuildRoadToolbarWindow>('8', "oneway", ROTW_ONE_WAY), Hotkey<BuildRoadToolbarWindow>('8', "oneway", WID_ROT_ONE_WAY),
Hotkey<BuildRoadToolbarWindow>('B', "bridge", ROTW_BUILD_BRIDGE), Hotkey<BuildRoadToolbarWindow>('B', "bridge", WID_ROT_BUILD_BRIDGE),
Hotkey<BuildRoadToolbarWindow>('T', "tunnel", ROTW_BUILD_TUNNEL), Hotkey<BuildRoadToolbarWindow>('T', "tunnel", WID_ROT_BUILD_TUNNEL),
Hotkey<BuildRoadToolbarWindow>('R', "remove", ROTW_REMOVE), Hotkey<BuildRoadToolbarWindow>('R', "remove", WID_ROT_REMOVE),
HOTKEY_LIST_END(BuildRoadToolbarWindow) HOTKEY_LIST_END(BuildRoadToolbarWindow)
}; };
Hotkey<BuildRoadToolbarWindow> *_roadtoolbar_hotkeys = BuildRoadToolbarWindow::roadtoolbar_hotkeys; Hotkey<BuildRoadToolbarWindow> *_roadtoolbar_hotkeys = BuildRoadToolbarWindow::roadtoolbar_hotkeys;
@ -687,28 +687,28 @@ static const NWidgetPart _nested_build_road_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(), EndContainer(),
NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_X), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_X),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_Y), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_Y),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_AUTOROAD), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_AUTOROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEMOLISH), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEMOLISH),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEPOT), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEPOT),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_DEPOT, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_DEPOT, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUS_STATION), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUS_STATION),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUS_STATION, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUS_STATION, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_TRUCK_STATION), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_TRUCK_STATION),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCK_BAY, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCK_BAY, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ONE_WAY), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ONE_WAY),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_BRIDGE), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_BRIDGE),
SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE), SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_TUNNEL), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_TUNNEL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_REMOVE), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_REMOVE),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD),
EndContainer(), EndContainer(),
}; };
@ -727,27 +727,27 @@ static const NWidgetPart _nested_build_tramway_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(), EndContainer(),
NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_X), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_X),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_Y), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_Y),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_AUTOROAD), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_AUTOROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOTRAM, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOTRAM), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOTRAM, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOTRAM),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEMOLISH), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEMOLISH),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEPOT), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEPOT),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_DEPOT, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_DEPOT, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUS_STATION), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUS_STATION),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUS_STATION, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUS_STATION, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_TRUCK_STATION), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_TRUCK_STATION),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCK_BAY, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCK_BAY, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(),
NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, ROTW_ONE_WAY), SetMinimalSize(0, 0), NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_ROT_ONE_WAY), SetMinimalSize(0, 0),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_BRIDGE), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_BRIDGE),
SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_BRIDGE), SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_BRIDGE),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_TUNNEL), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_TUNNEL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_TUNNEL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_TUNNEL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_REMOVE), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_REMOVE),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS),
EndContainer(), EndContainer(),
}; };
@ -792,22 +792,22 @@ static const NWidgetPart _nested_build_road_scen_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(), EndContainer(),
NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_X), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_X),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_Y), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ROAD_Y),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_AUTOROAD), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_AUTOROAD),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEMOLISH), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEMOLISH),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ONE_WAY), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_ONE_WAY),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_BRIDGE), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_BRIDGE),
SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE), SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_TUNNEL), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_BUILD_TUNNEL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_REMOVE), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_REMOVE),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD),
EndContainer(), EndContainer(),
}; };
@ -843,10 +843,10 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
{ {
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->LowerWidget(_road_depot_orientation + BRODW_DEPOT_NE); this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE);
if ( _cur_roadtype == ROADTYPE_TRAM) { if ( _cur_roadtype == ROADTYPE_TRAM) {
this->GetWidget<NWidgetCore>(BRODW_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION; this->GetWidget<NWidgetCore>(WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION;
for (int i = BRODW_DEPOT_NE; i <= BRODW_DEPOT_NW; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP; for (int i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_NW; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP;
} }
this->FinishInitNested(desc, TRANSPORT_ROAD); this->FinishInitNested(desc, TRANSPORT_ROAD);
@ -854,21 +854,21 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
virtual void DrawWidget(const Rect &r, int widget) const virtual void DrawWidget(const Rect &r, int widget) const
{ {
if (!IsInsideMM(widget, BRODW_DEPOT_NE, BRODW_DEPOT_NW + 1)) return; if (!IsInsideMM(widget, WID_BROD_DEPOT_NE, WID_BROD_DEPOT_NW + 1)) return;
DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - BRODW_DEPOT_NE + DIAGDIR_NE), _cur_roadtype); DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - WID_BROD_DEPOT_NE + DIAGDIR_NE), _cur_roadtype);
} }
virtual void OnClick(Point pt, int widget, int click_count) virtual void OnClick(Point pt, int widget, int click_count)
{ {
switch (widget) { switch (widget) {
case BRODW_DEPOT_NW: case WID_BROD_DEPOT_NW:
case BRODW_DEPOT_NE: case WID_BROD_DEPOT_NE:
case BRODW_DEPOT_SW: case WID_BROD_DEPOT_SW:
case BRODW_DEPOT_SE: case WID_BROD_DEPOT_SE:
this->RaiseWidget(_road_depot_orientation + BRODW_DEPOT_NE); this->RaiseWidget(_road_depot_orientation + WID_BROD_DEPOT_NE);
_road_depot_orientation = (DiagDirection)(widget - BRODW_DEPOT_NE); _road_depot_orientation = (DiagDirection)(widget - WID_BROD_DEPOT_NE);
this->LowerWidget(_road_depot_orientation + BRODW_DEPOT_NE); this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
this->SetDirty(); this->SetDirty();
break; break;
@ -882,25 +882,25 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
static const NWidgetPart _nested_build_road_depot_widgets[] = { static const NWidgetPart _nested_build_road_depot_widgets[] = {
NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRODW_CAPTION), SetDataTip(STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROD_CAPTION), SetDataTip(STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(), EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
NWidget(NWID_SPACER), SetMinimalSize(0, 3), NWidget(NWID_SPACER), SetMinimalSize(0, 3),
NWidget(NWID_HORIZONTAL_LTR), NWidget(NWID_HORIZONTAL_LTR),
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
NWidget(NWID_VERTICAL), NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_SPACER), SetMinimalSize(0, 2),
NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(), EndContainer(),
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(2, 0), NWidget(NWID_SPACER), SetMinimalSize(2, 0),
NWidget(NWID_VERTICAL), NWidget(NWID_VERTICAL),
NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_SPACER), SetMinimalSize(0, 2),
NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROD_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP),
EndContainer(), EndContainer(),
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
@ -931,17 +931,17 @@ struct BuildRoadStationWindow : public PickerWindowBase {
_road_station_picker_orientation = DIAGDIR_END; _road_station_picker_orientation = DIAGDIR_END;
} }
this->SetWidgetsDisabledState(_cur_roadtype == ROADTYPE_TRAM, this->SetWidgetsDisabledState(_cur_roadtype == ROADTYPE_TRAM,
BRSW_STATION_NE, WID_BROS_STATION_NE,
BRSW_STATION_SE, WID_BROS_STATION_SE,
BRSW_STATION_SW, WID_BROS_STATION_SW,
BRSW_STATION_NW, WID_BROS_STATION_NW,
WIDGET_LIST_END); WIDGET_LIST_END);
this->GetWidget<NWidgetCore>(BRSW_CAPTION)->widget_data = _road_type_infos[_cur_roadtype].picker_title[rs]; this->GetWidget<NWidgetCore>(WID_BROS_CAPTION)->widget_data = _road_type_infos[_cur_roadtype].picker_title[rs];
for (uint i = BRSW_STATION_NE; i < BRSW_LT_OFF; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = _road_type_infos[_cur_roadtype].picker_tooltip[rs]; for (uint i = WID_BROS_STATION_NE; i < WID_BROS_LT_OFF; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = _road_type_infos[_cur_roadtype].picker_tooltip[rs];
this->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
this->LowerWidget(_settings_client.gui.station_show_coverage + BRSW_LT_OFF); this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF);
this->FinishInitNested(desc, TRANSPORT_ROAD); this->FinishInitNested(desc, TRANSPORT_ROAD);
@ -966,8 +966,8 @@ struct BuildRoadStationWindow : public PickerWindowBase {
/* 'Accepts' and 'Supplies' texts. */ /* 'Accepts' and 'Supplies' texts. */
StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY; StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY;
int top = this->GetWidget<NWidgetBase>(BRSW_LT_ON)->pos_y + this->GetWidget<NWidgetBase>(BRSW_LT_ON)->current_y + WD_PAR_VSEP_NORMAL; int top = this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->pos_y + this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->current_y + WD_PAR_VSEP_NORMAL;
NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(BRSW_BACKGROUND); NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(WID_BROS_BACKGROUND);
int right = back_nwi->pos_x + back_nwi->current_x; int right = back_nwi->pos_x + back_nwi->current_x;
int bottom = back_nwi->pos_y + back_nwi->current_y; int bottom = back_nwi->pos_y + back_nwi->current_y;
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL;
@ -980,34 +980,34 @@ struct BuildRoadStationWindow : public PickerWindowBase {
virtual void DrawWidget(const Rect &r, int widget) const virtual void DrawWidget(const Rect &r, int widget) const
{ {
if (!IsInsideMM(widget, BRSW_STATION_NE, BRSW_STATION_Y + 1)) return; if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return;
StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK; StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < BRSW_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - BRSW_STATION_NE); StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE);
} }
virtual void OnClick(Point pt, int widget, int click_count) virtual void OnClick(Point pt, int widget, int click_count)
{ {
switch (widget) { switch (widget) {
case BRSW_STATION_NE: case WID_BROS_STATION_NE:
case BRSW_STATION_SE: case WID_BROS_STATION_SE:
case BRSW_STATION_SW: case WID_BROS_STATION_SW:
case BRSW_STATION_NW: case WID_BROS_STATION_NW:
case BRSW_STATION_X: case WID_BROS_STATION_X:
case BRSW_STATION_Y: case WID_BROS_STATION_Y:
this->RaiseWidget(_road_station_picker_orientation + BRSW_STATION_NE); this->RaiseWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
_road_station_picker_orientation = (DiagDirection)(widget - BRSW_STATION_NE); _road_station_picker_orientation = (DiagDirection)(widget - WID_BROS_STATION_NE);
this->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
this->SetDirty(); this->SetDirty();
DeleteWindowById(WC_SELECT_STATION, 0); DeleteWindowById(WC_SELECT_STATION, 0);
break; break;
case BRSW_LT_OFF: case WID_BROS_LT_OFF:
case BRSW_LT_ON: case WID_BROS_LT_ON:
this->RaiseWidget(_settings_client.gui.station_show_coverage + BRSW_LT_OFF); this->RaiseWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF);
_settings_client.gui.station_show_coverage = (widget != BRSW_LT_OFF); _settings_client.gui.station_show_coverage = (widget != WID_BROS_LT_OFF);
this->LowerWidget(_settings_client.gui.station_show_coverage + BRSW_LT_OFF); this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF);
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
this->SetDirty(); this->SetDirty();
break; break;
@ -1027,35 +1027,35 @@ struct BuildRoadStationWindow : public PickerWindowBase {
static const NWidgetPart _nested_rv_station_picker_widgets[] = { static const NWidgetPart _nested_rv_station_picker_widgets[] = {
NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRSW_CAPTION), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROS_CAPTION),
EndContainer(), EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRSW_BACKGROUND), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BROS_BACKGROUND),
NWidget(NWID_SPACER), SetMinimalSize(0, 3), NWidget(NWID_SPACER), SetMinimalSize(0, 3),
NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
NWidget(WWT_PANEL, COLOUR_GREY, BRSW_STATION_NW), SetMinimalSize(66, 50), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NW), SetMinimalSize(66, 50), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, BRSW_STATION_NE), SetMinimalSize(66, 50), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_NE), SetMinimalSize(66, 50), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, BRSW_STATION_X), SetMinimalSize(66, 50), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_X), SetMinimalSize(66, 50), EndContainer(),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_SPACER), SetMinimalSize(0, 2),
NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
NWidget(WWT_PANEL, COLOUR_GREY, BRSW_STATION_SW), SetMinimalSize(66, 50), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SW), SetMinimalSize(66, 50), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, BRSW_STATION_SE), SetMinimalSize(66, 50), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_SE), SetMinimalSize(66, 50), EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, BRSW_STATION_Y), SetMinimalSize(66, 50), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_BROS_STATION_Y), SetMinimalSize(66, 50), EndContainer(),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 1), NWidget(NWID_SPACER), SetMinimalSize(0, 1),
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BRSW_INFO), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetMinimalSize(140, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(), EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_LT_OFF), SetMinimalSize(60, 12), NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_OFF), SetMinimalSize(60, 12),
SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_LT_ON), SetMinimalSize(60, 12), NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_LT_ON), SetMinimalSize(60, 12),
SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(), EndContainer(),

View File

@ -15,42 +15,42 @@
/** Widgets of the WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR (WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR is also used in others). */ /** Widgets of the WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR (WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR is also used in others). */
enum RoadToolbarWidgets { enum RoadToolbarWidgets {
/* Name starts with RO instead of R, because of collision with RailToolbarWidgets */ /* Name starts with RO instead of R, because of collision with RailToolbarWidgets */
ROTW_ROAD_X, WID_ROT_ROAD_X, ///< Build road in x-direction.
ROTW_ROAD_Y, WID_ROT_ROAD_Y, ///< Build road in y-direction.
ROTW_AUTOROAD, WID_ROT_AUTOROAD, ///< Autorail.
ROTW_DEMOLISH, WID_ROT_DEMOLISH, ///< Demolish.
ROTW_DEPOT, WID_ROT_DEPOT, ///< Build depot.
ROTW_BUS_STATION, WID_ROT_BUS_STATION, ///< Build bus station.
ROTW_TRUCK_STATION, WID_ROT_TRUCK_STATION, ///< Build truck station.
ROTW_ONE_WAY, WID_ROT_ONE_WAY, ///< Build one-way road.
ROTW_BUILD_BRIDGE, WID_ROT_BUILD_BRIDGE, ///< Build bridge.
ROTW_BUILD_TUNNEL, WID_ROT_BUILD_TUNNEL, ///< Build tunnel.
ROTW_REMOVE, WID_ROT_REMOVE, ///< Remove road.
}; };
/** Widgets of the WC_BUILD_DEPOT (WC_BUILD_DEPOT is also used in others). */ /** Widgets of the WC_BUILD_DEPOT (WC_BUILD_DEPOT is also used in others). */
enum BuildRoadDepotWidgets { enum BuildRoadDepotWidgets {
/* Name starts with BRO instead of BR, because of collision with BuildRailDepotWidgets */ /* Name starts with BRO instead of BR, because of collision with BuildRailDepotWidgets */
BRODW_CAPTION, WID_BROD_CAPTION, ///< Window caption.
BRODW_DEPOT_NE, WID_BROD_DEPOT_NE, ///< Depot with NE entry.
BRODW_DEPOT_SE, WID_BROD_DEPOT_SE, ///< Depot with SE entry.
BRODW_DEPOT_SW, WID_BROD_DEPOT_SW, ///< Depot with SW entry.
BRODW_DEPOT_NW, WID_BROD_DEPOT_NW, ///< Depot with NW entry.
}; };
/** Widgets of the WC_BUS_STATION / WC_TRUCK_STATION. */ /** Widgets of the WC_BUS_STATION / WC_TRUCK_STATION. */
enum BuildRoadStationWidgets { enum BuildRoadStationWidgets {
BRSW_CAPTION, WID_BROS_CAPTION, ///< Window caption.
BRSW_BACKGROUND, WID_BROS_BACKGROUND, ///< Window background.
BRSW_STATION_NE, WID_BROS_STATION_NE, ///< Terminal station with NE entry.
BRSW_STATION_SE, WID_BROS_STATION_SE, ///< Terminal station with SE entry.
BRSW_STATION_SW, WID_BROS_STATION_SW, ///< Terminal station with SW entry.
BRSW_STATION_NW, WID_BROS_STATION_NW, ///< Terminal station with NW entry.
BRSW_STATION_X, WID_BROS_STATION_X, ///< Drive-through station in x-direction.
BRSW_STATION_Y, WID_BROS_STATION_Y, ///< Drive-through station in y-direction.
BRSW_LT_OFF, WID_BROS_LT_OFF, ///< Turn off area highlight.
BRSW_LT_ON, WID_BROS_LT_ON, ///< Turn on area highlight.
BRSW_INFO, WID_BROS_INFO, ///< Station acceptance info.
}; };
#endif /* WIDGETS_ROAD_WIDGET_H */ #endif /* WIDGETS_ROAD_WIDGET_H */