(svn r18955) -Feature: [NoAI] introduce GetBuildCost functions in several classes to get easier cost estimations before you start building

This commit is contained in:
yexo
2010-01-29 23:56:42 +00:00
parent 93d93b3121
commit 16659e5516
15 changed files with 239 additions and 0 deletions

View File

@@ -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;
}
}