From eebb427b4296fd625867b418bbfb0cf17eaa8933 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 15 Mar 2023 18:42:36 +0000 Subject: [PATCH] Fix overbuilding a road stop/waypoint clearing the one-way state --- src/station_cmd.cpp | 8 +++++++- src/waypoint_cmd.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 7483d21362..6f5d0d5044 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2190,7 +2190,13 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin RoadType tram_rt = MayHaveRoad(cur_tile) ? GetRoadType(cur_tile, RTT_TRAM) : INVALID_ROADTYPE; Owner road_owner = road_rt != INVALID_ROADTYPE ? GetRoadOwner(cur_tile, RTT_ROAD) : _current_company; Owner tram_owner = tram_rt != INVALID_ROADTYPE ? GetRoadOwner(cur_tile, RTT_TRAM) : _current_company; - DisallowedRoadDirections drd = IsNormalRoadTile(cur_tile) ? GetDisallowedRoadDirections(cur_tile) : DRD_NONE; + + DisallowedRoadDirections drd = DRD_NONE; + if (IsNormalRoadTile(cur_tile)){ + drd = GetDisallowedRoadDirections(cur_tile); + } else if (IsDriveThroughStopTile(cur_tile)) { + drd = GetDriveThroughStopDisallowedRoadDirections(cur_tile); + } if (IsTileType(cur_tile, MP_STATION) && IsAnyRoadStop(cur_tile)) { RemoveRoadStop(cur_tile, flags, specindex); diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 2e713b9000..f3bc17dad3 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -450,7 +450,13 @@ CommandCost CmdBuildRoadWaypoint(TileIndex start_tile, DoCommandFlag flags, uint RoadType tram_rt = MayHaveRoad(cur_tile) ? GetRoadType(cur_tile, RTT_TRAM) : INVALID_ROADTYPE; Owner road_owner = road_rt != INVALID_ROADTYPE ? GetRoadOwner(cur_tile, RTT_ROAD) : _current_company; Owner tram_owner = tram_rt != INVALID_ROADTYPE ? GetRoadOwner(cur_tile, RTT_TRAM) : _current_company; - DisallowedRoadDirections drd = IsNormalRoadTile(cur_tile) ? GetDisallowedRoadDirections(cur_tile) : DRD_NONE; + + DisallowedRoadDirections drd = DRD_NONE; + if (IsNormalRoadTile(cur_tile)){ + drd = GetDisallowedRoadDirections(cur_tile); + } else if (IsDriveThroughStopTile(cur_tile)) { + drd = GetDriveThroughStopDisallowedRoadDirections(cur_tile); + } extern CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags, int replacement_spec_index); if (IsTileType(cur_tile, MP_STATION) && IsAnyRoadStop(cur_tile)) {