Index: src/airport_gui.cpp =================================================================== --- src/airport_gui.cpp (revision 26400) +++ src/airport_gui.cpp (working copy) @@ -224,6 +224,8 @@ this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(WID_AP_BTN_DONTJOIN, !_settings_client.gui.station_prefer_join); + this->SetWidgetLoweredState(WID_AP_BTN_DOJOIN, _settings_client.gui.station_prefer_join); this->OnInvalidateData(); this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount()); @@ -365,7 +367,7 @@ { this->DrawWidgets(); - uint16 top = this->GetWidget(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL; + uint16 top = this->GetWidget(WID_AP_BTN_DOJOIN)->pos_y + this->GetWidget(WID_AP_BTN_DOJOIN)->current_y + WD_PAR_VSEP_NORMAL; NWidgetBase *panel_nwi = this->GetWidget(WID_AP_BOTTOMPANEL); int right = panel_nwi->pos_x + panel_nwi->current_x; @@ -444,7 +446,8 @@ break; } - case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT: + case WID_AP_BTN_DONTHILIGHT: + case WID_AP_BTN_DOHILIGHT: _settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT); this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); @@ -453,6 +456,15 @@ this->UpdateSelectSize(); break; + case WID_AP_BTN_DOJOIN: + case WID_AP_BTN_DONTJOIN: + this->RaiseWidget(_settings_client.gui.station_prefer_join + WID_AP_BTN_DONTJOIN); + _settings_client.gui.station_prefer_join = (widget != WID_AP_BTN_DONTJOIN); + this->LowerWidget(_settings_client.gui.station_prefer_join + WID_AP_BTN_DONTJOIN); + if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + this->SetDirty(); + break; + case WID_AP_LAYOUT_DECREASE: _selected_airport_layout--; this->UpdateSelectSize(); @@ -536,7 +548,7 @@ EndContainer(), NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0), EndContainer(), - /* Bottom panel. */ + /* Coverage area panel. */ NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2), NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0), NWidget(NWID_HORIZONTAL), @@ -547,8 +559,19 @@ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP), EndContainer(), - NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0), + NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0), EndContainer(), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_PREFER_JOIN_TITLE, STR_NULL), SetFill(1, 0), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(16, 0), SetFill(1, 0), + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTJOIN), SetMinimalSize(60, 12), SetFill(1, 0), + SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_PREFER_JOIN_OFF_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOJOIN), SetMinimalSize(60, 12), SetFill(1, 0), + SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_PREFER_JOIN_ON_TOOLTIP), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0), + EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0), EndContainer(), }; Index: src/dock_gui.cpp =================================================================== --- src/dock_gui.cpp (revision 26400) +++ src/dock_gui.cpp (working copy) @@ -386,6 +386,9 @@ BDSW_LT_OFF, ///< 'Off' button of coverage high light. BDSW_LT_ON, ///< 'On' button of coverage high light. BDSW_INFO, ///< 'Coverage highlight' label. + BDSW_JOIN_INFO, ///< 'Join adjacent station' title. + BDSW_JOIN_OFF, ///< 'Join adjacent station' on. + BDSW_JOIN_ON ///< 'Join adjacent station' off. }; struct BuildDocksStationWindow : public PickerWindowBase { @@ -394,6 +397,7 @@ { this->InitNested(TRANSPORT_WATER); this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF); + this->LowerWidget(_settings_client.gui.station_prefer_join + BDSW_JOIN_OFF); } virtual ~BuildDocksStationWindow() @@ -414,7 +418,7 @@ } /* strings such as 'Size' and 'Coverage Area' */ - int top = this->GetWidget(BDSW_LT_OFF)->pos_y + this->GetWidget(BDSW_LT_OFF)->current_y + WD_PAR_VSEP_NORMAL; + int top = this->GetWidget(BDSW_JOIN_OFF)->pos_y + this->GetWidget(BDSW_JOIN_OFF)->current_y + WD_PAR_VSEP_NORMAL; NWidgetBase *back_nwi = this->GetWidget(BDSW_BACKGROUND); int right = back_nwi->pos_x + back_nwi->current_x; int bottom = back_nwi->pos_y + back_nwi->current_y; @@ -439,6 +443,14 @@ if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); break; + case BDSW_JOIN_OFF: + case BDSW_JOIN_ON: + this->RaiseWidget(_settings_client.gui.station_prefer_join + BDSW_JOIN_OFF); + _settings_client.gui.station_prefer_join = (widget != BDSW_JOIN_OFF); + this->LowerWidget(_settings_client.gui.station_prefer_join + BDSW_JOIN_OFF); + if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + this->SetDirty(); + break; } } @@ -461,6 +473,12 @@ NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_OFF), SetMinimalSize(40, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP), NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_ON), SetMinimalSize(40, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP), EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetResize(0, 1), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BDSW_JOIN_INFO), SetMinimalSize(200, 14), SetDataTip(STR_STATION_PREFER_JOIN_TITLE, STR_NULL), + NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_JOIN_OFF), SetMinimalSize(40, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_PREFER_JOIN_OFF_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_JOIN_ON), SetMinimalSize(40, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_PREFER_JOIN_ON_TOOLTIP), + EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 20), SetResize(0, 1), EndContainer(), }; Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 26400) +++ src/lang/english.txt (working copy) @@ -2256,6 +2260,12 @@ STR_STATION_BUILD_COVERAGE_ON :{BLACK}On STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP :{BLACK}Don't highlight coverage area of proposed site STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP :{BLACK}Highlight coverage area of proposed site +STR_STATION_PREFER_JOIN_TITLE :{BLACK}Join with adjacent stations +STR_STATION_PREFER_JOIN_OFF :{BLACK}Off +STR_STATION_PREFER_JOIN_ON :{BLACK}On +STR_STATION_PREFER_JOIN_OFF_TOOLTIP :{BLACK}Don't join with adjacent stations (you can temporarily invert this mode with CTRL) +STR_STATION_PREFER_JOIN_ON_TOOLTIP :{BLACK}Join with adjacent stations (you can temporarily invert this mode with CTRL) + STR_STATION_BUILD_ACCEPTS_CARGO :{BLACK}Accepts: {GOLD}{CARGO_LIST} STR_STATION_BUILD_SUPPLIES_CARGO :{BLACK}Supplies: {GOLD}{CARGO_LIST} Index: src/rail_gui.cpp =================================================================== --- src/rail_gui.cpp (revision 26400) +++ src/rail_gui.cpp (working copy) @@ -950,6 +950,9 @@ this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage); this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(WID_BRAS_JOIN_OFF, !_settings_client.gui.station_prefer_join); + this->SetWidgetLoweredState(WID_BRAS_JOIN_ON, _settings_client.gui.station_prefer_join); + if (!newstation || _railstation.station_class >= (int)StationClass::GetClassCount()) { /* New stations are not available or changed, so ensure the default station * type is 'selected'. */ @@ -1292,6 +1295,16 @@ this->SetDirty(); break; + case WID_BRAS_JOIN_OFF: + case WID_BRAS_JOIN_ON: + _settings_client.gui.station_prefer_join = (widget != WID_BRAS_JOIN_OFF); + + this->SetWidgetLoweredState(WID_BRAS_JOIN_OFF, !_settings_client.gui.station_prefer_join); + this->SetWidgetLoweredState(WID_BRAS_JOIN_ON, _settings_client.gui.station_prefer_join); + if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + this->SetDirty(); + break; + case WID_BRAS_NEWST_LIST: { int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BRAS_NEWST_LIST, 0, this->line_height); if (y >= (int)StationClass::GetClassCount()) return; @@ -1413,6 +1426,15 @@ SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0), EndContainer(), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(143, 11), SetDataTip(STR_STATION_PREFER_JOIN_TITLE, STR_NULL), SetPadding(3, 2, 0, 2), + NWidget(NWID_HORIZONTAL), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BRAS_JOIN_OFF), SetMinimalSize(60, 12), + SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_PREFER_JOIN_OFF_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BRAS_JOIN_ON), SetMinimalSize(60, 12), + SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_PREFER_JOIN_ON_TOOLTIP), + NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0), + EndContainer(), EndContainer(), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BRAS_SHOW_NEWST_MATRIX), /* We need an additional background for the matrix, as the matrix cannot handle the scrollbar due to not being an NWidgetCore. */ Index: src/road_gui.cpp =================================================================== --- src/road_gui.cpp (revision 26400) +++ src/road_gui.cpp (working copy) @@ -950,6 +950,7 @@ this->LowerWidget(_road_station_picker_orientation + WID_BROS_STATION_NE); this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF); + this->LowerWidget(_settings_client.gui.station_prefer_join + WID_BROS_JOIN_OFF); this->FinishInitNested(TRANSPORT_ROAD); @@ -974,7 +975,7 @@ /* 'Accepts' and 'Supplies' texts. */ StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY; - int top = this->GetWidget(WID_BROS_LT_ON)->pos_y + this->GetWidget(WID_BROS_LT_ON)->current_y + WD_PAR_VSEP_NORMAL; + int top = this->GetWidget(WID_BROS_JOIN_ON)->pos_y + this->GetWidget(WID_BROS_JOIN_ON)->current_y + WD_PAR_VSEP_NORMAL; NWidgetBase *back_nwi = this->GetWidget(WID_BROS_BACKGROUND); int right = back_nwi->pos_x + back_nwi->current_x; int bottom = back_nwi->pos_y + back_nwi->current_y; @@ -1021,6 +1022,14 @@ if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); break; + case WID_BROS_JOIN_OFF: + case WID_BROS_JOIN_ON: + this->RaiseWidget(_settings_client.gui.station_prefer_join + WID_BROS_JOIN_OFF); + _settings_client.gui.station_prefer_join = (widget != WID_BROS_JOIN_OFF); + this->LowerWidget(_settings_client.gui.station_prefer_join + WID_BROS_JOIN_OFF); + if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + this->SetDirty(); + break; default: break; @@ -1068,7 +1077,20 @@ 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), NWidget(NWID_SPACER), SetFill(1, 0), + EndContainer(), + NWidget(NWID_SPACER), SetMinimalSize(0, 1), + NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN, WID_BROS_INFO), SetMinimalSize(200, 14), SetDataTip(STR_STATION_PREFER_JOIN_TITLE, STR_NULL), + NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), + NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), + NWidget(NWID_SPACER), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_JOIN_OFF), SetMinimalSize(60, 12), + SetDataTip(STR_STATION_PREFER_JOIN_OFF, STR_STATION_PREFER_JOIN_OFF_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BROS_JOIN_ON), SetMinimalSize(60, 12), + SetDataTip(STR_STATION_PREFER_JOIN_ON, STR_STATION_PREFER_JOIN_ON_TOOLTIP), + NWidget(NWID_SPACER), SetFill(1, 0), + EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), EndContainer(), }; Index: src/settings_type.h =================================================================== --- src/settings_type.h (revision 26400) +++ src/settings_type.h (working copy) @@ -130,6 +130,7 @@ byte station_platlength; ///< the platform length, in tiles, for rail stations bool station_dragdrop; ///< whether drag and drop is enabled for stations bool station_show_coverage; ///< whether to highlight coverage area + bool station_prefer_join; ///< whether to prefer join to other stations without CTRL bool persistent_buildingtools; ///< keep the building tools active after usage bool expenses_layout; ///< layout of expenses window uint32 last_newgrf_count; ///< the numbers of NewGRFs we found during the last scan Index: src/station_gui.cpp =================================================================== --- src/station_gui.cpp (revision 26400) +++ src/station_gui.cpp (working copy) @@ -2365,8 +2365,8 @@ UpdateTileSelection(); } - /* only show the popup, if we press ctrl */ - if (!_ctrl_pressed) return false; + /* only show the popup, if we press ctrl AND prefer join button is not enabled (and vice versa) */ + if (_ctrl_pressed == _settings_client.gui.station_prefer_join) return false; /* Now check if we could build there */ if (DoCommand(&cmd, CommandFlagsToDCFlags(GetCommandFlags(cmd.cmd))).Failed()) return false; Index: src/table/settings.ini =================================================================== --- src/table/settings.ini (revision 26400) +++ src/table/settings.ini (working copy) @@ -3026,6 +3035,12 @@ cat = SC_BASIC [SDTC_BOOL] +var = gui.station_prefer_join +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = false +cat = SC_BASIC + +[SDTC_BOOL] var = gui.persistent_buildingtools flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC def = true Index: src/widgets/airport_widget.h =================================================================== --- src/widgets/airport_widget.h (revision 26400) +++ src/widgets/airport_widget.h (working copy) @@ -32,6 +32,8 @@ WID_AP_COVERAGE_LABEL, ///< Label if you want to see the coverage. WID_AP_BTN_DONTHILIGHT, ///< Don't show the coverage button. WID_AP_BTN_DOHILIGHT, ///< Show the coverage button. + WID_AP_BTN_DONTJOIN, ///< Don't join with adjacent stations. + WID_AP_BTN_DOJOIN, ///< Join with adjacent stations. }; #endif /* WIDGETS_AIRPORT_WIDGET_H */ Index: src/widgets/rail_widget.h =================================================================== --- src/widgets/rail_widget.h (revision 26400) +++ src/widgets/rail_widget.h (working copy) @@ -58,6 +58,8 @@ WID_BRAS_HIGHLIGHT_OFF, ///< Button for turning coverage highlighting off. WID_BRAS_HIGHLIGHT_ON, ///< Button for turning coverage highlighting on. + WID_BRAS_JOIN_OFF, ///< Button for turning distant join off. + WID_BRAS_JOIN_ON, ///< Button for turning distant join on. WID_BRAS_COVERAGE_TEXTS, ///< Empty space for the coverage texts. WID_BRAS_MATRIX, ///< Matrix widget displaying the available stations. Index: src/widgets/road_widget.h =================================================================== --- src/widgets/road_widget.h (revision 26400) +++ src/widgets/road_widget.h (working copy) @@ -51,6 +51,8 @@ WID_BROS_STATION_Y, ///< Drive-through station in y-direction. WID_BROS_LT_OFF, ///< Turn off area highlight. WID_BROS_LT_ON, ///< Turn on area highlight. + WID_BROS_JOIN_OFF, ///< Turn off distant join. + WID_BROS_JOIN_ON, ///< Turn on distant join. WID_BROS_INFO, ///< Station acceptance info. };