diff --git a/docs/newgrf-roadstops-nml.html b/docs/newgrf-roadstops-nml.html index 076a3673d8..bbcdbaf97c 100644 --- a/docs/newgrf-roadstops-nml.html +++ b/docs/newgrf-roadstops-nml.html @@ -82,6 +82,8 @@ Do not show catenary graphics. (This only takes effect from road_stops version 2).

RST_GENERAL_FLAG_DRIVE_THROUGH_ONLY
Only allow drive-through stops (not bay stops). (This only takes effect from road_stops version 2).

+

RST_GENERAL_FLAG_NO_AUTO_ROAD_CONNECTION
+ Do not automatically build connecting road pieces. (This only takes effect from road_stops version 3).

minimum_bridge_heightArray of 6 items [0..255, ...]Minimum clearances required for a bridge for each of the 6 views/rotations (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px). disallowed_bridge_pillarsArray of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...] diff --git a/docs/newgrf-roadstops.html b/docs/newgrf-roadstops.html index 19ef09e14c..e94a970b9b 100644 --- a/docs/newgrf-roadstops.html +++ b/docs/newgrf-roadstops.html @@ -150,8 +150,9 @@ BitValueMeaning 01Callback 141 needs random bits in variable 10 12Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50. - 24Do not catenary graphics.
This requires road_stops, version 2. + 24Do not show catenary graphics.
This requires road_stops, version 2. 38Only allow drive-through stops (not bay stops).
This requires road_stops, version 2. + 410Do not automatically build connecting road pieces.
This requires road_stops, version 3. The default value is 0 (no flags enabled).

diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp index e3674a41e2..52af6db64d 100644 --- a/src/newgrf_extension.cpp +++ b/src/newgrf_extension.cpp @@ -54,7 +54,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = { GRFFeatureInfo("action0_object_edge_foundation_mode", 2), GRFFeatureInfo("action0_object_flood_resistant", 1), GRFFeatureInfo("action0_object_viewport_map_tile_type", 1), - GRFFeatureInfo("road_stops", 2), + GRFFeatureInfo("road_stops", 3), GRFFeatureInfo("new_landscape", 1), GRFFeatureInfo(), }; diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h index a7caa9feb3..f5c126f2a5 100644 --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -68,6 +68,7 @@ enum RoadStopSpecFlags { RSF_NO_ONE_WAY_OVERLAY, ///< Do not show one-way road overlays. RSF_NO_CATENARY, ///< Do not show catenary. RSF_DRIVE_THROUGH_ONLY, ///< Stop is drive-through only. + RSF_NO_AUTO_ROAD_CONNECTION, ///< No auto road connection. }; enum RoadStopSpecIntlFlags { diff --git a/src/road_gui.cpp b/src/road_gui.cpp index d28a7141ce..2b40630563 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -199,11 +199,23 @@ void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, DiagDirection dir = (DiagDirection)GB(p2, 3, 2); if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); - TileArea roadstop_area(tile, GB(p1, 0, 8), GB(p1, 8, 8)); - for (TileIndex cur_tile : roadstop_area) { - ConnectRoadToStructure(cur_tile, dir); - /* For a drive-through road stop build connecting road for other entrance. */ - if (HasBit(p2, 1)) ConnectRoadToStructure(cur_tile, ReverseDiagDir(dir)); + + bool connect_to_road = true; + + RoadStopClassID spec_class = Extract(p3); + byte spec_index = GB(p3, 8, 8); + if ((uint)spec_class < RoadStopClass::GetClassCount() && spec_index < RoadStopClass::Get(spec_class)->GetSpecCount()) { + const RoadStopSpec *roadstopspec = RoadStopClass::Get(spec_class)->GetSpec(spec_index); + if (roadstopspec != nullptr && HasBit(roadstopspec->flags, RSF_NO_AUTO_ROAD_CONNECTION)) connect_to_road = false; + } + + if (connect_to_road) { + TileArea roadstop_area(tile, GB(p1, 0, 8), GB(p1, 8, 8)); + for (TileIndex cur_tile : roadstop_area) { + ConnectRoadToStructure(cur_tile, dir); + /* For a drive-through road stop build connecting road for other entrance. */ + if (HasBit(p2, 1)) ConnectRoadToStructure(cur_tile, ReverseDiagDir(dir)); + } } }