The previous fix 887e9481ff0e70df6bf93ce15a3899a03f124c50 only worked for roads and failed to consider a multiplier used for the infrastructure totals for tunnels/bridges. Also, depots and bus/truck stops are counted as 2 road pieces on creation but were only counted as 1 road piece on conversion because the function DiagDirToRoadBits() was used, which only ever returns single-piece road segments. Co-authored-by: A. S <admin-git@sotai.tk>
This commit is contained in:
@@ -1933,8 +1933,8 @@ 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, 2);
|
||||
UpdateCompanyRoadInfrastructure(tram_rt, tram_owner, 2);
|
||||
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, road_rt, tram_rt, axis);
|
||||
road_stop->MakeDriveThrough();
|
||||
@@ -1942,7 +1942,7 @@ 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] += 2;
|
||||
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);
|
||||
}
|
||||
Company::Get(st->owner)->infrastructure.station++;
|
||||
@@ -2031,7 +2031,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
||||
/* Update company infrastructure counts. */
|
||||
FOR_ALL_ROADTRAMTYPES(rtt) {
|
||||
RoadType rt = GetRoadType(tile, rtt);
|
||||
UpdateCompanyRoadInfrastructure(rt, GetRoadOwner(tile, rtt), -2);
|
||||
UpdateCompanyRoadInfrastructure(rt, GetRoadOwner(tile, rtt), -ROAD_STOP_TRACKBIT_FACTOR);
|
||||
}
|
||||
|
||||
Company::Get(st->owner)->infrastructure.station--;
|
||||
|
Reference in New Issue
Block a user