70 static void ShowBuildTrainDepotPicker(
Window *parent);
71 static void ShowBuildWaypointPicker(
Window *parent);
94 static void GenericPlaceRail(
TileIndex tile,
int cmd)
134 if (result.
Failed())
return;
145 PlaceExtraDepotRail(tile, _place_depot_extra_dir[dir + 4], _place_depot_extra_track[dir + 4]);
146 PlaceExtraDepotRail(tile, _place_depot_extra_dir[dir + 8], _place_depot_extra_track[dir + 8]);
174 if (result.
Failed())
return;
189 VpSetPlaceSizingLimit(-1);
336 VpSetPlaceSizingLimit(-1);
352 static void DoRailroadTrack(
int mode)
361 static void HandleAutodirPlacement()
370 DoRailroadTrack(trackstat);
467 void UpdateRemoveWidgetStatus(
int clicked_widget)
469 switch (clicked_widget) {
502 SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
549 ShowBuildTrainDepotPicker(
this);
558 ShowBuildWaypointPicker(
this);
597 default: NOT_REACHED();
599 this->UpdateRemoveWidgetStatus(widget);
666 default: NOT_REACHED();
681 switch (select_proc) {
682 default: NOT_REACHED();
689 HandleAutodirPlacement();
711 HandleStationPlacement(start_tile, end_tile);
731 virtual void OnPlaceObjectAbort()
733 this->RaiseButtons();
769 extern RailType _last_built_railtype;
777 static Hotkey railtoolbar_hotkeys[] = {
796 static const NWidgetPart _nested_build_rail_widgets[] = {
841 _nested_build_rail_widgets,
lengthof(_nested_build_rail_widgets),
842 &BuildRailToolbarWindow::hotkeys
871 uint numtracks = ta.w;
872 uint platlength = ta.h;
955 if (!newstation || _railstation.
station_class >= (
int)StationClass::GetClassCount()) {
967 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1006 for (uint bits = 0; bits < 7; bits++) {
1008 if (statspec == NULL) {
1041 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1045 size->width =
max(size->width, d.width + padding.width);
1061 StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data;
1066 const StationSpec *statspec = stclass->GetSpec(j);
1067 SetDParam(0, (statspec != NULL && statspec->
name != 0) ? statspec->
name : STR_STATION_CLASS_DFLT);
1071 size->width =
max(size->width, d.width + padding.width);
1097 switch (
GB(widget, 0, 16)) {
1100 if (
FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
1102 _cur_dpi = &tmp_dpi;
1104 int y = r.bottom - r.top -
UnScaleByZoom(31 * 4, ZOOM_LVL_GUI);
1114 if (
FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
1116 _cur_dpi = &tmp_dpi;
1118 int y = r.bottom - r.top -
UnScaleByZoom(31 * 4, ZOOM_LVL_GUI);
1129 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1143 byte type =
GB(widget, 16, 16);
1152 if (
FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
1154 _cur_dpi = &tmp_dpi;
1156 int y = r.bottom - r.top -
UnScaleByZoom(31 * 4, ZOOM_LVL_GUI);
1178 SetDParam(0, (statspec != NULL && statspec->
name != 0) ? statspec->
name : STR_STATION_CLASS_DFLT);
1184 switch (
GB(widget, 0, 16)) {
1213 for (uint i = 0; i < 7; i++) {
1248 for (uint i = 0; i < 7; i++) {
1273 for (uint i = 0; i < 7; i++) {
1282 for (uint i = 0; i < 7; i++) {
1311 if (y >= (
int)StationClass::GetClassCount())
return;
1312 for (uint i = 0; i < StationClass::GetClassCount(); i++) {
1338 int y =
GB(widget, 16, 16);
1364 static const NWidgetPart _nested_station_builder_widgets[] = {
1382 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL),
SetPadding(1, 2, 0, 2),
1385 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BRAS_PLATFORM_DIR_X),
SetMinimalSize(66, 60),
SetFill(0, 0),
SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP),
EndContainer(),
1387 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_BRAS_PLATFORM_DIR_Y),
SetMinimalSize(66, 60),
SetFill(0, 0),
SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP),
EndContainer(),
1390 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN,
WID_BRAS_SHOW_NEWST_TYPE),
SetMinimalSize(144, 11),
SetDataTip(STR_ORANGE_STRING, STR_NULL),
SetPadding(1, 2, 4, 2),
1391 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_NUMBER_OF_TRACKS, STR_NULL),
SetPadding(0, 2, 0, 2),
1403 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_PLATFORM_LENGTH, STR_NULL),
SetPadding(2, 2, 0, 2),
1421 NWidget(
WWT_LABEL, COLOUR_DARK_GREEN),
SetMinimalSize(144, 11),
SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
SetPadding(3, 2, 0, 2),
1425 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
1427 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
1435 NWidget(
NWID_MATRIX, COLOUR_DARK_GREEN,
WID_BRAS_MATRIX),
SetScrollbar(
WID_BRAS_MATRIX_SCROLL),
SetPIP(0, 2, 0),
SetPadding(2, 0, 0, 0),
1459 WDP_AUTO,
"build_station_rail", 350, 0,
1462 _nested_station_builder_widgets,
lengthof(_nested_station_builder_widgets)
1488 const NWidgetBase *widget = this->GetWidget<NWidgetBase>(widget_index);
1489 int x = widget->
pos_x - offset.x +
1490 (widget->
current_x - sprite_size.width + offset.x) / 2;
1520 for (uint lowered = 0; lowered < 2; lowered++) {
1622 if (!gui_scope)
return;
1674 _nested_signal_builder_widgets,
lengthof(_nested_signal_builder_widgets)
1759 _nested_build_depot_widgets,
lengthof(_nested_build_depot_widgets)
1762 static void ShowBuildTrainDepotPicker(
Window *parent)
1786 size->width += resize->width * 2;
1787 size->height += resize->height * 2;
1802 switch (
GB(widget, 0, 16)) {
1804 byte type =
GB(widget, 16, 16);
1817 switch (
GB(widget, 0, 16)) {
1819 byte type =
GB(widget, 16, 16);
1858 _nested_build_waypoint_widgets,
lengthof(_nested_build_waypoint_widgets)
1861 static void ShowBuildWaypointPicker(
Window *parent)
1880 extern RailType _last_built_railtype;
1894 extern RailType _last_built_railtype;
1899 memset(count, 0,
sizeof(count));
1909 if (count[r] >= count[rt]) rt = r;
2004 if (!
HasBit(used_railtypes, rt))
continue;
2008 if (rti->
label == 0)
continue;