Index: src/tunnelbridge_cmd.cpp =================================================================== --- src/tunnelbridge_cmd.cpp (wersja 25228) +++ src/tunnelbridge_cmd.cpp (kopia robocza) @@ -295,6 +295,7 @@ CommandCost cost(EXPENSES_CONSTRUCTION); Owner owner; + bool is_new_owner; if (IsBridgeTile(tile_start) && IsBridgeTile(tile_end) && GetOtherBridgeEnd(tile_start) == tile_end && GetTunnelBridgeTransportType(tile_start) == transport_type) { @@ -333,7 +334,8 @@ owner = GetTileOwner(tile_start); /* If bridge belonged to bankrupt company, it has a new owner now */ - if (owner == OWNER_NONE) owner = company; + is_new_owner = (owner == OWNER_NONE); + if (is_new_owner) owner = company; switch (transport_type) { case TRANSPORT_RAIL: @@ -441,6 +443,7 @@ } owner = company; + is_new_owner = true; } /* do the drill? */ @@ -450,8 +453,8 @@ Company *c = Company::GetIfValid(owner); switch (transport_type) { case TRANSPORT_RAIL: - /* Add to company infrastructure count if building a new bridge. */ - if (!IsBridgeTile(tile_start) && c != NULL) c->infrastructure.rail[railtype] += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; + /* Add to company infrastructure count if required. */ + if (is_new_owner && c != NULL) c->infrastructure.rail[railtype] += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; MakeRailBridgeRamp(tile_start, owner, bridge_type, dir, railtype); MakeRailBridgeRamp(tile_end, owner, bridge_type, ReverseDiagDir(dir), railtype); SetTunnelBridgeReservation(tile_start, pbs_reservation); @@ -463,7 +466,7 @@ if (c != NULL) { /* Add all new road types to the company infrastructure counter. */ RoadType new_rt; - FOR_EACH_SET_ROADTYPE(new_rt, roadtypes ^ prev_roadtypes) { + FOR_EACH_SET_ROADTYPE(new_rt, is_new_owner ? roadtypes | prev_roadtypes : roadtypes ^ prev_roadtypes) { /* A full diagonal road tile has two road bits. */ Company::Get(owner)->infrastructure.road[new_rt] += (bridge_len + 2) * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR; } @@ -478,7 +481,7 @@ } case TRANSPORT_WATER: - if (!IsBridgeTile(tile_start) && c != NULL) c->infrastructure.water += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; + if (is_new_owner && c != NULL) c->infrastructure.water += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; MakeAqueductBridgeRamp(tile_start, owner, dir); MakeAqueductBridgeRamp(tile_end, owner, ReverseDiagDir(dir)); break;