# ai_town.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_town.hpp 17305 2009-08-29 11:18:03Z smatz $ */
    00002
    00005 #ifndef AI_TOWN_HPP
    00006 #define AI_TOWN_HPP
    00007
    00008 #include "ai_object.hpp"
    00009 #include "ai_company.hpp"
    00010
    00014 class AITown : public AIObject {
    00015 public:
    00016   static const char *GetClassName() { return "AITown"; }
    00017
    00021   enum TownAction {
    00022     /* Values are important, as they represent the internal state of the game. */
    00023
    00029     TOWN_ACTION_ADVERTISE_SMALL  = 0,
    00030
    00036     TOWN_ACTION_ADVERTISE_MEDIUM = 1,
    00037
    00043     TOWN_ACTION_ADVERTISE_LARGE  = 2,
    00044
    00048     TOWN_ACTION_ROAD_REBUILD     = 3,
    00049
    00053     TOWN_ACTION_BUILD_STATUE     = 4,
    00054
    00058     TOWN_ACTION_FUND_BUILDINGS   = 5,
    00059
    00063     TOWN_ACTION_BUY_RIGHTS       = 6,
    00064
    00068     TOWN_ACTION_BRIBE            = 7,
    00069   };
    00070
    00074   enum TownRating {
    00075     TOWN_RATING_NONE,
    00076     TOWN_RATING_APPALLING,
    00077     TOWN_RATING_VERY_POOR,
    00078     TOWN_RATING_POOR,
    00079     TOWN_RATING_MEDIOCRE,
    00080     TOWN_RATING_GOOD,
    00081     TOWN_RATING_VERY_GOOD,
    00082     TOWN_RATING_EXCELLENT,
    00083     TOWN_RATING_OUTSTANDING,
    00084     TOWN_RATING_INVALID = -1,
    00085   };
    00086
    00090   enum RoadLayout {
    00091     /* Order IS important, as it matches an in-game value */
    00092     ROAD_LAYOUT_ORIGINAL,
    00093     ROAD_LAYOUT_BETTER_ROADS,
    00094     ROAD_LAYOUT_2x2,
    00095     ROAD_LAYOUT_3x3,
    00096     ROAD_LAYOUT_INVALID = -1,
    00097   };
    00098
    00104   static int32 GetTownCount();
    00105
    00111   static bool IsValidTown(TownID town_id);
    00112
    00119   static char *GetName(TownID town_id);
    00120
    00128   static int32 GetPopulation(TownID town_id);
    00129
    00137   static int32 GetHouseCount(TownID town_id);
    00138
    00145   static TileIndex GetLocation(TownID town_id);
    00146
    00157   static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
    00158
    00169   static int32 GetLastMonthTransported(TownID town_id, CargoID cargo_id);
    00170
    00181   static int32 GetMaxProduction(TownID town_id, CargoID cargo_id);
    00182
    00193   static int32 GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
    00194
    00203   static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
    00204
    00213   static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
    00214
    00223   static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
    00224
    00231   static bool HasStatue(TownID town_id);
    00232
    00240   static int GetRoadReworkDuration(TownID town_id);
    00241
    00250   static AICompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
    00251
    00260   static int32 GetExclusiveRightsDuration(TownID town_id);
    00261
    00269   static bool IsActionAvailable(TownID town_id, TownAction town_action);
    00270
    00279   static bool PerformTownAction(TownID town_id, TownAction town_action);
    00280
    00289   static TownRating GetRating(TownID town_id, AICompany::CompanyID company_id);
    00290
    00297   static int GetAllowedNoise(TownID town_id);
    00298
    00304   static RoadLayout GetRoadLayout(TownID town_id);
    00305 };
    00306
    00307 #endif /* AI_TOWN_HPP */