# ai_town.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_town.hpp 15520 2009-02-19 09:01:34Z 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
    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
    00191   static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
    00192
    00201   static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
    00202
    00211   static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
    00212
    00219   static bool HasStatue(TownID town_id);
    00220
    00228   static int GetRoadReworkDuration(TownID town_id);
    00229
    00238   static AICompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
    00239
    00248   static int32 GetExclusiveRightsDuration(TownID town_id);
    00249
    00257   static bool IsActionAvailable(TownID town_id, TownAction town_action);
    00258
    00267   static bool PerformTownAction(TownID town_id, TownAction town_action);
    00268
    00277   static TownRating GetRating(TownID town_id, AICompany::CompanyID company_id);
    00278
    00285   static int GetAllowedNoise(TownID town_id);
    00286
    00292   static RoadLayout GetRoadLayout(TownID town_id);
    00293 };
    00294
    00295 #endif /* AI_TOWN_HPP */