Fix incorrect accounting of rail tunnel/bridge infrastructure counts

Regression from dual rail types change
This commit is contained in:
Jonathan G Rennison 2018-12-22 04:08:20 +00:00
parent d78db1c004
commit 70020e1a5c
2 changed files with 2 additions and 1 deletions

View File

@ -2244,7 +2244,7 @@ void SubtractRoadTunnelBridgeInfrastructure(TileIndex begin, TileIndex end) {
}
static void UpdateRailTunnelBridgeInfrastructure(Company *c, TileIndex begin, TileIndex end, bool add) {
const uint middle_len = 2 * GetTunnelBridgeLength(begin, end) * TUNNELBRIDGE_TRACKBIT_FACTOR;
const uint middle_len = GetTunnelBridgeLength(begin, end) * TUNNELBRIDGE_TRACKBIT_FACTOR;
if (c != NULL) {
uint primary_count = middle_len + GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(begin) + GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(end);

View File

@ -223,6 +223,7 @@ static inline bool HasAcrossTunnelBridgeReservation(TileIndex t)
*/
static inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(TrackBits bits)
{
if (!bits) return 0;
uint pieces = CountBits(bits);
if (TracksOverlap(bits)) pieces *= pieces;
return (TUNNELBRIDGE_TRACKBIT_FACTOR / 2) * (1 + pieces);