From 22b2ce0bc6455f6d119a2ba6778f4b9bc8d3998e Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 9 Sep 2022 20:45:19 +0100 Subject: [PATCH] Fix incorrect infrastructure totals when overbuilding bay road stop With different road/tram type See: https://github.com/OpenTTD/OpenTTD/issues/10011 --- src/station_cmd.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index de9c192c9a..54d6af5d7f 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2229,9 +2229,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin if (road_rt == INVALID_ROADTYPE && RoadTypeIsRoad(rt)) road_rt = rt; if (tram_rt == INVALID_ROADTYPE && RoadTypeIsTram(rt)) tram_rt = rt; - UpdateCompanyRoadInfrastructure(road_rt, road_owner, ROAD_STOP_TRACKBIT_FACTOR); - UpdateCompanyRoadInfrastructure(tram_rt, tram_owner, ROAD_STOP_TRACKBIT_FACTOR); - MakeDriveThroughRoadStop(cur_tile, st->owner, road_owner, tram_owner, st->index, (rs_type == ROADSTOP_BUS ? STATION_BUS : STATION_TRUCK), road_rt, tram_rt, axis); SetDriveThroughStopDisallowedRoadDirections(cur_tile, drd); road_stop->MakeDriveThrough(); @@ -2239,9 +2236,10 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin if (road_rt == INVALID_ROADTYPE && RoadTypeIsRoad(rt)) road_rt = rt; if (tram_rt == INVALID_ROADTYPE && RoadTypeIsTram(rt)) tram_rt = rt; /* Non-drive-through stop never overbuild and always count as two road bits. */ - Company::Get(st->owner)->infrastructure.road[rt] += ROAD_STOP_TRACKBIT_FACTOR; MakeRoadStop(cur_tile, st->owner, st->index, rs_type, road_rt, tram_rt, ddir); } + UpdateCompanyRoadInfrastructure(road_rt, road_owner, ROAD_STOP_TRACKBIT_FACTOR); + UpdateCompanyRoadInfrastructure(tram_rt, tram_owner, ROAD_STOP_TRACKBIT_FACTOR); Company::Get(st->owner)->infrastructure.station++; SetCustomRoadStopSpecIndex(cur_tile, specindex);