1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-23 20:24:12 +01:00

Fix c02ef3e456: [AI] Incorrect infrastructure cost for road/tram tiles. (#14596)

Infrastructure total count should be split between road and tram pieces.
This commit is contained in:
Peter Nelson
2025-09-07 14:11:05 +01:00
committed by GitHub
parent f82bd95faf
commit 80541a7682

View File

@@ -104,8 +104,9 @@
case INFRASTRUCTURE_ROAD: {
Money cost;
uint32_t road_total = c->infrastructure.GetRoadTotal();
uint32_t tram_total = c->infrastructure.GetTramTotal();
for (::RoadType rt = ::ROADTYPE_BEGIN; rt != ::ROADTYPE_END; rt++) {
cost += RoadMaintenanceCost(rt, c->infrastructure.road[rt], road_total);
cost += RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total);
}
return cost;
}