Fix incorrect accounting of rail tunnel/bridge infrastructure counts
Regression from dual rail types change
This commit is contained in:
@@ -2244,7 +2244,7 @@ void SubtractRoadTunnelBridgeInfrastructure(TileIndex begin, TileIndex end) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateRailTunnelBridgeInfrastructure(Company *c, TileIndex begin, TileIndex end, bool add) {
|
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) {
|
if (c != NULL) {
|
||||||
uint primary_count = middle_len + GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(begin) + GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(end);
|
uint primary_count = middle_len + GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(begin) + GetTunnelBridgeHeadOnlyPrimaryRailInfrastructureCount(end);
|
||||||
|
@@ -223,6 +223,7 @@ static inline bool HasAcrossTunnelBridgeReservation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(TrackBits bits)
|
static inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCountFromTrackBits(TrackBits bits)
|
||||||
{
|
{
|
||||||
|
if (!bits) return 0;
|
||||||
uint pieces = CountBits(bits);
|
uint pieces = CountBits(bits);
|
||||||
if (TracksOverlap(bits)) pieces *= pieces;
|
if (TracksOverlap(bits)) pieces *= pieces;
|
||||||
return (TUNNELBRIDGE_TRACKBIT_FACTOR / 2) * (1 + pieces);
|
return (TUNNELBRIDGE_TRACKBIT_FACTOR / 2) * (1 + pieces);
|
||||||
|
Reference in New Issue
Block a user