mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
Fix incorrect accounting of rail tunnel/bridge infrastructure counts
Regression from dual rail types change
This commit is contained in:
parent
d78db1c004
commit
70020e1a5c
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user