diff options
author | yexo <yexo@openttd.org> | 2010-01-29 23:56:42 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-01-29 23:56:42 +0000 |
commit | 15016e3511b075e999cdb0db45936d5e6b223aa4 (patch) | |
tree | d053d2759a7c64b76e429d0367216567ec051534 /src/ai/api/ai_tile.cpp | |
parent | 54f958c8e5c99804d1e46c2fe6b3b5ef5cae3db6 (diff) | |
download | openttd-15016e3511b075e999cdb0db45936d5e6b223aa4.tar.xz |
(svn r18955) -Feature: [NoAI] introduce GetBuildCost functions in several classes to get easier cost estimations before you start building
Diffstat (limited to 'src/ai/api/ai_tile.cpp')
-rw-r--r-- | src/ai/api/ai_tile.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp index 04c977626..a90be1aa1 100644 --- a/src/ai/api/ai_tile.cpp +++ b/src/ai/api/ai_tile.cpp @@ -19,6 +19,7 @@ #include "../../tree_map.h" #include "../../town.h" #include "../../landscape.h" +#include "../../economy_func.h" /* static */ bool AITile::IsBuildable(TileIndex tile) { @@ -271,3 +272,18 @@ return ::ClosestTownFromTile(tile, UINT_MAX)->index; } + +/* static */ Money AITile::GetBuildCost(BuildType build_type) +{ + switch (build_type) { + case BT_FOUNDATION: return ::GetPrice(PR_BUILD_FOUNDATION, 1, NULL); + case BT_TERRAFORM: return ::GetPrice(PR_TERRAFORM, 1, NULL); + case BT_BUILD_TREES: return ::GetPrice(PR_BUILD_TREES, 1, NULL); + case BT_CLEAR_GRASS: return ::GetPrice(PR_CLEAR_GRASS, 1, NULL); + case BT_CLEAR_ROUGH: return ::GetPrice(PR_CLEAR_ROUGH, 1, NULL); + case BT_CLEAR_ROCKY: return ::GetPrice(PR_CLEAR_ROCKS, 1, NULL); + case BT_CLEAR_FIELDS: return ::GetPrice(PR_CLEAR_FIELDS, 1, NULL); + case BT_CLEAR_HOUSE: return ::GetPrice(PR_CLEAR_HOUSE, 1, NULL); + default: return -1; + } +} |