From 15016e3511b075e999cdb0db45936d5e6b223aa4 Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 29 Jan 2010 23:56:42 +0000 Subject: (svn r18955) -Feature: [NoAI] introduce GetBuildCost functions in several classes to get easier cost estimations before you start building --- src/ai/api/ai_road.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ai/api/ai_road.cpp') diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp index 1621e03ec..27694ac10 100644 --- a/src/ai/api/ai_road.cpp +++ b/src/ai/api/ai_road.cpp @@ -579,3 +579,16 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia return AIObject::DoCommand(tile, 0, GetRoadStopType(tile), CMD_REMOVE_ROAD_STOP); } + +/* static */ Money AIRoad::GetBuildCost(RoadType roadtype, BuildType build_type) +{ + if (!AIRoad::IsRoadTypeAvailable(roadtype)) return -1; + + switch (build_type) { + case BT_ROAD: return ::GetPrice(PR_BUILD_ROAD, 1, NULL); + case BT_DEPOT: return ::GetPrice(PR_BUILD_DEPOT_ROAD, 1, NULL); + case BT_BUS_STOP: return ::GetPrice(PR_BUILD_STATION_BUS, 1, NULL); + case BT_TRUCK_STOP: return ::GetPrice(PR_BUILD_STATION_TRUCK, 1, NULL); + default: return -1; + } +} -- cgit v1.2.3-54-g00ecf