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 | |
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')
-rw-r--r-- | src/ai/api/ai_gamesettings.cpp | 1 | ||||
-rw-r--r-- | src/ai/api/ai_marine.cpp | 11 | ||||
-rw-r--r-- | src/ai/api/ai_marine.hpp | 16 | ||||
-rw-r--r-- | src/ai/api/ai_marine.hpp.sq | 6 | ||||
-rw-r--r-- | src/ai/api/ai_rail.cpp | 15 | ||||
-rw-r--r-- | src/ai/api/ai_rail.hpp | 20 | ||||
-rw-r--r-- | src/ai/api/ai_rail.hpp.sq | 8 | ||||
-rw-r--r-- | src/ai/api/ai_road.cpp | 13 | ||||
-rw-r--r-- | src/ai/api/ai_road.hpp | 19 | ||||
-rw-r--r-- | src/ai/api/ai_road.hpp.sq | 7 | ||||
-rw-r--r-- | src/ai/api/ai_tile.cpp | 16 | ||||
-rw-r--r-- | src/ai/api/ai_tile.hpp | 21 | ||||
-rw-r--r-- | src/ai/api/ai_tile.hpp.sq | 11 |
13 files changed, 164 insertions, 0 deletions
diff --git a/src/ai/api/ai_gamesettings.cpp b/src/ai/api/ai_gamesettings.cpp index 7b3d6d01a..8f7c3eaef 100644 --- a/src/ai/api/ai_gamesettings.cpp +++ b/src/ai/api/ai_gamesettings.cpp @@ -11,6 +11,7 @@ #include "ai_gamesettings.hpp" #include "../../settings_internal.h" +#include "../../economy_func.h" /* static */ bool AIGameSettings::IsValid(const char *setting) { diff --git a/src/ai/api/ai_marine.cpp b/src/ai/api/ai_marine.cpp index 8aea6cbd4..07de889da 100644 --- a/src/ai/api/ai_marine.cpp +++ b/src/ai/api/ai_marine.cpp @@ -13,6 +13,7 @@ #include "ai_station.hpp" #include "../../station_base.h" #include "../../tile_cmd.h" +#include "../../economy_func.h" /* static */ bool AIMarine::IsWaterDepotTile(TileIndex tile) @@ -149,3 +150,13 @@ return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR); } + +/* static */ Money AIMarine::GetBuildCost(BuildType build_type) +{ + switch (build_type) { + case BT_DOCK: return ::GetPrice(PR_BUILD_STATION_DOCK, 1, NULL); + case BT_DEPOT: return ::GetPrice(PR_BUILD_DEPOT_SHIP, 1, NULL); + case BT_BUOY: return ::GetPrice(PR_BUILD_WAYPOINT_BUOY, 1, NULL); + default: return -1; + } +} diff --git a/src/ai/api/ai_marine.hpp b/src/ai/api/ai_marine.hpp index 9ea54a784..19bc4b1d9 100644 --- a/src/ai/api/ai_marine.hpp +++ b/src/ai/api/ai_marine.hpp @@ -34,6 +34,15 @@ public: }; /** + * Types of water-related objects in the game. + */ + enum BuildType { + BT_DOCK, //!< Build a dock + BT_DEPOT, //!< Build a ship depot + BT_BUOY, //!< Build a buoy + }; + + /** * Checks whether the given tile is actually a tile with a water depot. * @param tile The tile to check. * @pre AIMap::IsValidTile(tile). @@ -191,6 +200,13 @@ public: * @return Whether the canal has been/can be removed or not. */ static bool RemoveCanal(TileIndex tile); + + /** + * Get the baseprice of building a water-related object. + * @param build_type the type of object to build + * @return The baseprice of building the given object. + */ + static Money GetBuildCost(BuildType build_type); }; #endif /* AI_MARINE_HPP */ diff --git a/src/ai/api/ai_marine.hpp.sq b/src/ai/api/ai_marine.hpp.sq index 5c6b86900..c9ceae755 100644 --- a/src/ai/api/ai_marine.hpp.sq +++ b/src/ai/api/ai_marine.hpp.sq @@ -15,6 +15,8 @@ namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ template <> AIMarine::ErrorMessages GetParam(ForceType<AIMarine::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIMarine::ErrorMessages)tmp; } template <> int Return<AIMarine::ErrorMessages>(HSQUIRRELVM vm, AIMarine::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> AIMarine::BuildType GetParam(ForceType<AIMarine::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIMarine::BuildType)tmp; } + template <> int Return<AIMarine::BuildType>(HSQUIRRELVM vm, AIMarine::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } /* Allow AIMarine to be used as Squirrel parameter */ template <> AIMarine *GetParam(ForceType<AIMarine *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIMarine *)instance; } @@ -32,6 +34,9 @@ void SQAIMarine_Register(Squirrel *engine) SQAIMarine.DefSQConst(engine, AIMarine::ERR_MARINE_BASE, "ERR_MARINE_BASE"); SQAIMarine.DefSQConst(engine, AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER"); + SQAIMarine.DefSQConst(engine, AIMarine::BT_DOCK, "BT_DOCK"); + SQAIMarine.DefSQConst(engine, AIMarine::BT_DEPOT, "BT_DEPOT"); + SQAIMarine.DefSQConst(engine, AIMarine::BT_BUOY, "BT_BUOY"); AIError::RegisterErrorMap(STR_ERROR_MUST_BE_BUILT_ON_WATER, AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER); @@ -53,6 +58,7 @@ void SQAIMarine_Register(Squirrel *engine) SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveBuoy, "RemoveBuoy", 2, ".i"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveLock, "RemoveLock", 2, ".i"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::RemoveCanal, "RemoveCanal", 2, ".i"); + SQAIMarine.DefSQStaticMethod(engine, &AIMarine::GetBuildCost, "GetBuildCost", 2, ".i"); SQAIMarine.PostRegister(engine); } diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp index eb2e01628..9b2974a30 100644 --- a/src/ai/api/ai_rail.cpp +++ b/src/ai/api/ai_rail.cpp @@ -19,6 +19,7 @@ #include "../../newgrf.h" #include "../../newgrf_generic.h" #include "../../newgrf_station.h" +#include "../../economy_func.h" /* static */ bool AIRail::IsRailTile(TileIndex tile) { @@ -454,3 +455,17 @@ static bool IsValidSignalType(int signal_type) return AIObject::DoCommand(tile, track, 0, CMD_REMOVE_SIGNALS); } + +/* static */ Money AIRail::GetBuildCost(RailType railtype, BuildType build_type) +{ + if (!AIRail::IsRailTypeAvailable(railtype)) return -1; + + switch (build_type) { + case BT_TRACK: return ::RailBuildCost((::RailType)railtype); + case BT_SIGNAL: return ::GetPrice(PR_BUILD_SIGNALS, 1, NULL); + case BT_DEPOT: return ::GetPrice(PR_BUILD_DEPOT_TRAIN, 1, NULL); + case BT_STATION: return ::GetPrice(PR_BUILD_STATION_RAIL, 1, NULL) + ::GetPrice(PR_BUILD_STATION_RAIL_LENGTH, 1, NULL); + case BT_WAYPOINT: return ::GetPrice(PR_BUILD_WAYPOINT_RAIL, 1, NULL); + default: return -1; + } +} diff --git a/src/ai/api/ai_rail.hpp b/src/ai/api/ai_rail.hpp index 2b662bc38..7170412ba 100644 --- a/src/ai/api/ai_rail.hpp +++ b/src/ai/api/ai_rail.hpp @@ -82,6 +82,17 @@ public: }; /** + * Types of rail-related objects in the game. + */ + enum BuildType { + BT_TRACK, //!< Build a track + BT_SIGNAL, //!< Build a signal + BT_DEPOT, //!< Build a depot + BT_STATION, //!< Build a station + BT_WAYPOINT, //!< Build a rail waypoint + }; + + /** * Checks whether the given tile is actually a tile with rail that can be * used to traverse a tile. This excludes rail depots but includes * stations and waypoints. @@ -419,6 +430,15 @@ public: * @return Whether the signal has been/can be removed or not. */ static bool RemoveSignal(TileIndex tile, TileIndex front); + + /** + * Get the baseprice of building a rail-related object. + * @param railtype the railtype that is build (on) + * @param build_type the type of object to build + * @pre IsRailTypeAvailable(railtype) + * @return The baseprice of building the given object. + */ + static Money GetBuildCost(RailType railtype, BuildType build_type); }; #endif /* AI_RAIL_HPP */ diff --git a/src/ai/api/ai_rail.hpp.sq b/src/ai/api/ai_rail.hpp.sq index 33d46b8c3..9184cb41c 100644 --- a/src/ai/api/ai_rail.hpp.sq +++ b/src/ai/api/ai_rail.hpp.sq @@ -21,6 +21,8 @@ namespace SQConvert { template <> int Return<AIRail::RailTrack>(HSQUIRRELVM vm, AIRail::RailTrack res) { sq_pushinteger(vm, (int32)res); return 1; } template <> AIRail::SignalType GetParam(ForceType<AIRail::SignalType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::SignalType)tmp; } template <> int Return<AIRail::SignalType>(HSQUIRRELVM vm, AIRail::SignalType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> AIRail::BuildType GetParam(ForceType<AIRail::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRail::BuildType)tmp; } + template <> int Return<AIRail::BuildType>(HSQUIRRELVM vm, AIRail::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } /* Allow AIRail to be used as Squirrel parameter */ template <> AIRail *GetParam(ForceType<AIRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIRail *)instance; } @@ -60,6 +62,11 @@ void SQAIRail_Register(Squirrel *engine) SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT_TWOWAY, "SIGNALTYPE_EXIT_TWOWAY"); SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO_TWOWAY, "SIGNALTYPE_COMBO_TWOWAY"); SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NONE, "SIGNALTYPE_NONE"); + SQAIRail.DefSQConst(engine, AIRail::BT_TRACK, "BT_TRACK"); + SQAIRail.DefSQConst(engine, AIRail::BT_SIGNAL, "BT_SIGNAL"); + SQAIRail.DefSQConst(engine, AIRail::BT_DEPOT, "BT_DEPOT"); + SQAIRail.DefSQConst(engine, AIRail::BT_STATION, "BT_STATION"); + SQAIRail.DefSQConst(engine, AIRail::BT_WAYPOINT, "BT_WAYPOINT"); AIError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD); AIError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, AIRail::ERR_UNSUITABLE_TRACK); @@ -98,6 +105,7 @@ void SQAIRail_Register(Squirrel *engine) SQAIRail.DefSQStaticMethod(engine, &AIRail::GetSignalType, "GetSignalType", 3, ".ii"); SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal, "BuildSignal", 4, ".iii"); SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal, "RemoveSignal", 3, ".ii"); + SQAIRail.DefSQStaticMethod(engine, &AIRail::GetBuildCost, "GetBuildCost", 3, ".ii"); SQAIRail.PostRegister(engine); } 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; + } +} diff --git a/src/ai/api/ai_road.hpp b/src/ai/api/ai_road.hpp index 970b833dd..a0bc131e6 100644 --- a/src/ai/api/ai_road.hpp +++ b/src/ai/api/ai_road.hpp @@ -64,6 +64,16 @@ public: }; /** + * Types of road-related objects in the game. + */ + enum BuildType { + BT_ROAD, //!< Build a piece of road + BT_DEPOT, //!< Build a road depot + BT_BUS_STOP, //!< Build a bus stop + BT_TRUCK_STOP, //!< Build a truck stop + }; + + /** * Determines whether a busstop or a truckstop is needed to transport a certain cargo. * @param cargo_type The cargo to test. * @pre AICargo::IsValidCargo(cargo_type). @@ -451,6 +461,15 @@ public: */ static bool RemoveRoadStation(TileIndex tile); + /** + * Get the baseprice of building a road-related object. + * @param roadtype the roadtype that is build (on) + * @param build_type the type of object to build + * @pre IsRoadTypeAvailable(railtype) + * @return The baseprice of building the given object. + */ + static Money GetBuildCost(RoadType roadtype, BuildType build_type); + private: /** diff --git a/src/ai/api/ai_road.hpp.sq b/src/ai/api/ai_road.hpp.sq index eff30e808..8cde7ed15 100644 --- a/src/ai/api/ai_road.hpp.sq +++ b/src/ai/api/ai_road.hpp.sq @@ -19,6 +19,8 @@ namespace SQConvert { template <> int Return<AIRoad::RoadType>(HSQUIRRELVM vm, AIRoad::RoadType res) { sq_pushinteger(vm, (int32)res); return 1; } template <> AIRoad::RoadVehicleType GetParam(ForceType<AIRoad::RoadVehicleType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRoad::RoadVehicleType)tmp; } template <> int Return<AIRoad::RoadVehicleType>(HSQUIRRELVM vm, AIRoad::RoadVehicleType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> AIRoad::BuildType GetParam(ForceType<AIRoad::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIRoad::BuildType)tmp; } + template <> int Return<AIRoad::BuildType>(HSQUIRRELVM vm, AIRoad::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } /* Allow AIRoad to be used as Squirrel parameter */ template <> AIRoad *GetParam(ForceType<AIRoad *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIRoad *)instance; } @@ -44,6 +46,10 @@ void SQAIRoad_Register(Squirrel *engine) SQAIRoad.DefSQConst(engine, AIRoad::ROADTYPE_INVALID, "ROADTYPE_INVALID"); SQAIRoad.DefSQConst(engine, AIRoad::ROADVEHTYPE_BUS, "ROADVEHTYPE_BUS"); SQAIRoad.DefSQConst(engine, AIRoad::ROADVEHTYPE_TRUCK, "ROADVEHTYPE_TRUCK"); + SQAIRoad.DefSQConst(engine, AIRoad::BT_ROAD, "BT_ROAD"); + SQAIRoad.DefSQConst(engine, AIRoad::BT_DEPOT, "BT_DEPOT"); + SQAIRoad.DefSQConst(engine, AIRoad::BT_BUS_STOP, "BT_BUS_STOP"); + SQAIRoad.DefSQConst(engine, AIRoad::BT_TRUCK_STOP, "BT_TRUCK_STOP"); AIError::RegisterErrorMap(STR_ERROR_ROAD_WORKS_IN_PROGRESS, AIRoad::ERR_ROAD_WORKS_IN_PROGRESS); AIError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_DIRECTION, AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION); @@ -82,6 +88,7 @@ void SQAIRoad_Register(Squirrel *engine) SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoadFull, "RemoveRoadFull", 3, ".ii"); SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoadDepot, "RemoveRoadDepot", 2, ".i"); SQAIRoad.DefSQStaticMethod(engine, &AIRoad::RemoveRoadStation, "RemoveRoadStation", 2, ".i"); + SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetBuildCost, "GetBuildCost", 3, ".ii"); SQAIRoad.PostRegister(engine); } 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; + } +} diff --git a/src/ai/api/ai_tile.hpp b/src/ai/api/ai_tile.hpp index 9ba0df031..be5f8ff7d 100644 --- a/src/ai/api/ai_tile.hpp +++ b/src/ai/api/ai_tile.hpp @@ -104,6 +104,20 @@ public: }; /** + * Get the base cost for building/clearing several things. + */ + enum BuildType { + BT_FOUNDATION, //!< Build a foundation under something + BT_TERRAFORM, //!< Terraform + BT_BUILD_TREES, //!< Build trees + BT_CLEAR_GRASS, //!< Clear a tile with just grass + BT_CLEAR_ROUGH, //!< Clear a rough tile + BT_CLEAR_ROCKY, //!< Clear a tile with rocks + BT_CLEAR_FIELDS, //!< Clear a tile with farm fields + BT_CLEAR_HOUSE, //!< Clear a tile with a house + }; + + /** * Check if this tile is buildable, i.e. no things on it that needs * demolishing. * @param tile The tile to check on. @@ -435,6 +449,13 @@ public: * @return The TownID of the town closest to the tile. */ static TownID GetClosestTown(TileIndex tile); + + /** + * Get the baseprice of building/clearing various tile-related things. + * @param build_type the type to build + * @return The baseprice of building or removing the given object. + */ + static Money GetBuildCost(BuildType build_type); }; #endif /* AI_TILE_HPP */ diff --git a/src/ai/api/ai_tile.hpp.sq b/src/ai/api/ai_tile.hpp.sq index 4abaaeecd..de19a245b 100644 --- a/src/ai/api/ai_tile.hpp.sq +++ b/src/ai/api/ai_tile.hpp.sq @@ -21,6 +21,8 @@ namespace SQConvert { template <> int Return<AITile::Slope>(HSQUIRRELVM vm, AITile::Slope res) { sq_pushinteger(vm, (int32)res); return 1; } template <> AITile::TransportType GetParam(ForceType<AITile::TransportType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::TransportType)tmp; } template <> int Return<AITile::TransportType>(HSQUIRRELVM vm, AITile::TransportType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> AITile::BuildType GetParam(ForceType<AITile::BuildType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::BuildType)tmp; } + template <> int Return<AITile::BuildType>(HSQUIRRELVM vm, AITile::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } /* Allow AITile to be used as Squirrel parameter */ template <> AITile *GetParam(ForceType<AITile *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITile *)instance; } @@ -73,6 +75,14 @@ void SQAITile_Register(Squirrel *engine) SQAITile.DefSQConst(engine, AITile::TRANSPORT_WATER, "TRANSPORT_WATER"); SQAITile.DefSQConst(engine, AITile::TRANSPORT_AIR, "TRANSPORT_AIR"); SQAITile.DefSQConst(engine, AITile::TRANSPORT_INVALID, "TRANSPORT_INVALID"); + SQAITile.DefSQConst(engine, AITile::BT_FOUNDATION, "BT_FOUNDATION"); + SQAITile.DefSQConst(engine, AITile::BT_TERRAFORM, "BT_TERRAFORM"); + SQAITile.DefSQConst(engine, AITile::BT_BUILD_TREES, "BT_BUILD_TREES"); + SQAITile.DefSQConst(engine, AITile::BT_CLEAR_GRASS, "BT_CLEAR_GRASS"); + SQAITile.DefSQConst(engine, AITile::BT_CLEAR_ROUGH, "BT_CLEAR_ROUGH"); + SQAITile.DefSQConst(engine, AITile::BT_CLEAR_ROCKY, "BT_CLEAR_ROCKY"); + SQAITile.DefSQConst(engine, AITile::BT_CLEAR_FIELDS, "BT_CLEAR_FIELDS"); + SQAITile.DefSQConst(engine, AITile::BT_CLEAR_HOUSE, "BT_CLEAR_HOUSE"); AIError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_HIGH); AIError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_LOW); @@ -116,6 +126,7 @@ void SQAITile_Register(Squirrel *engine) SQAITile.DefSQStaticMethod(engine, &AITile::PlantTreeRectangle, "PlantTreeRectangle", 4, ".iii"); SQAITile.DefSQStaticMethod(engine, &AITile::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii"); SQAITile.DefSQStaticMethod(engine, &AITile::GetClosestTown, "GetClosestTown", 2, ".i"); + SQAITile.DefSQStaticMethod(engine, &AITile::GetBuildCost, "GetBuildCost", 2, ".i"); SQAITile.PostRegister(engine); } |