Add road stops flag to disable auto road connections

Bump road stops version
This commit is contained in:
Jonathan G Rennison
2022-08-28 23:53:26 +01:00
parent 2a41854f6b
commit 50965bbce7
5 changed files with 23 additions and 7 deletions

View File

@@ -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(),
};

View File

@@ -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 {

View File

@@ -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<RoadStopClassID, 0, 8>(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));
}
}
}