From 80541a7682a6e47ff39acf3b6b2c826327e115b6 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 7 Sep 2025 14:11:05 +0100 Subject: [PATCH] Fix c02ef3e456: [AI] Incorrect infrastructure cost for road/tram tiles. (#14596) Infrastructure total count should be split between road and tram pieces. --- src/script/api/script_infrastructure.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/script/api/script_infrastructure.cpp b/src/script/api/script_infrastructure.cpp index 523caebe21..17e65e932b 100644 --- a/src/script/api/script_infrastructure.cpp +++ b/src/script/api/script_infrastructure.cpp @@ -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; }