# ai_town.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_town.hpp 15486 2009-02-14 21:13:15Z yexo $ */
    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
    00105   static int32 GetTownCount();
    00106
    00112   static bool IsValidTown(TownID town_id);
    00113
    00120   static char *GetName(TownID town_id);
    00121
    00129   static int32 GetPopulation(TownID town_id);
    00130
    00138   static int32 GetHouseCount(TownID town_id);
    00139
    00146   static TileIndex GetLocation(TownID town_id);
    00147
    00158   static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
    00159
    00170   static int32 GetLastMonthTransported(TownID town_id, CargoID cargo_id);
    00171
    00182   static int32 GetMaxProduction(TownID town_id, CargoID cargo_id);
    00183
    00192   static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
    00193
    00202   static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
    00203
    00212   static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
    00213
    00220   static bool HasStatue(TownID town_id);
    00221
    00229   static int GetRoadReworkDuration(TownID town_id);
    00230
    00239   static AICompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
    00240
    00249   static int32 GetExclusiveRightsDuration(TownID town_id);
    00250
    00258   static bool IsActionAvailable(TownID town_id, TownAction town_action);
    00259
    00268   static bool PerformTownAction(TownID town_id, TownAction town_action);
    00269
    00278   static TownRating GetRating(TownID town_id, AICompany::CompanyID company_id);
    00279
    00286   static int GetAllowedNoise(TownID town_id);
    00287
    00293   static RoadLayout GetRoadLayout(TownID town_id);
    00294 };
    00295
    00296 #endif /* AI_TOWN_HPP */