1
0
Fork 0

Fix 44984f8410: Changing ownership of a tunnel/bridge did not check for road transport type. (#13963)

Changing ownership changed ownership of road components without checking if the tunnel/bridge is actually a road tunnel/bridge.
pull/13967/head
Peter Nelson 2025-04-04 18:11:19 +01:00 committed by GitHub
parent 4310d7c7f5
commit 68fd949a52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 12 deletions

View File

@ -1795,6 +1795,9 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner
* don't want to update the infrastructure counts twice. */
uint num_pieces = tile < other_end ? (GetTunnelBridgeLength(tile, other_end) + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR : 0;
TransportType tt = GetTunnelBridgeTransportType(tile);
if (tt == TRANSPORT_ROAD) {
for (RoadTramType rtt : _roadtramtypes) {
/* Update all roadtypes, no matter if they are present */
if (GetRoadOwner(tile, rtt) == old_owner) {
@ -1809,12 +1812,12 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner
SetRoadOwner(tile, rtt, new_owner == INVALID_OWNER ? OWNER_NONE : new_owner);
}
}
}
if (!IsTileOwner(tile, old_owner)) return;
/* Update company infrastructure counts for rail and water as well.
* No need to dirty windows here, we'll redraw the whole screen anyway. */
TransportType tt = GetTunnelBridgeTransportType(tile);
Company *old = Company::Get(old_owner);
if (tt == TRANSPORT_RAIL) {
old->infrastructure.rail[GetRailType(tile)] -= num_pieces;