# ai_town.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_town.hpp 17294 2009-08-27 13:50:07Z smatz $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef AI_TOWN_HPP
    00013 #define AI_TOWN_HPP
    00014
    00015 #include "ai_object.hpp"
    00016 #include "ai_company.hpp"
    00017
    00021 class AITown : public AIObject {
    00022 public:
    00023   static const char *GetClassName() { return "AITown"; }
    00024
    00028   enum TownAction {
    00029     /* Values are important, as they represent the internal state of the game. */
    00030
    00036     TOWN_ACTION_ADVERTISE_SMALL  = 0,
    00037
    00043     TOWN_ACTION_ADVERTISE_MEDIUM = 1,
    00044
    00050     TOWN_ACTION_ADVERTISE_LARGE  = 2,
    00051
    00055     TOWN_ACTION_ROAD_REBUILD     = 3,
    00056
    00060     TOWN_ACTION_BUILD_STATUE     = 4,
    00061
    00065     TOWN_ACTION_FUND_BUILDINGS   = 5,
    00066
    00070     TOWN_ACTION_BUY_RIGHTS       = 6,
    00071
    00075     TOWN_ACTION_BRIBE            = 7,
    00076   };
    00077
    00081   enum TownRating {
    00082     TOWN_RATING_NONE,
    00083     TOWN_RATING_APPALLING,
    00084     TOWN_RATING_VERY_POOR,
    00085     TOWN_RATING_POOR,
    00086     TOWN_RATING_MEDIOCRE,
    00087     TOWN_RATING_GOOD,
    00088     TOWN_RATING_VERY_GOOD,
    00089     TOWN_RATING_EXCELLENT,
    00090     TOWN_RATING_OUTSTANDING,
    00091     TOWN_RATING_INVALID = -1,
    00092   };
    00093
    00097   enum RoadLayout {
    00098     /* Order IS important, as it matches an in-game value */
    00099     ROAD_LAYOUT_ORIGINAL,
    00100     ROAD_LAYOUT_BETTER_ROADS,
    00101     ROAD_LAYOUT_2x2,
    00102     ROAD_LAYOUT_3x3,
    00103     ROAD_LAYOUT_INVALID = -1,
    00104   };
    00105
    00111   static int32 GetTownCount();
    00112
    00118   static bool IsValidTown(TownID town_id);
    00119
    00126   static char *GetName(TownID town_id);
    00127
    00135   static int32 GetPopulation(TownID town_id);
    00136
    00144   static int32 GetHouseCount(TownID town_id);
    00145
    00152   static TileIndex GetLocation(TownID town_id);
    00153
    00164   static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
    00165
    00176   static int32 GetLastMonthTransported(TownID town_id, CargoID cargo_id);
    00177
    00188   static int32 GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
    00189
    00198   static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
    00199
    00208   static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
    00209
    00218   static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
    00219
    00226   static bool HasStatue(TownID town_id);
    00227
    00235   static int GetRoadReworkDuration(TownID town_id);
    00236
    00245   static AICompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
    00246
    00255   static int32 GetExclusiveRightsDuration(TownID town_id);
    00256
    00264   static bool IsActionAvailable(TownID town_id, TownAction town_action);
    00265
    00274   static bool PerformTownAction(TownID town_id, TownAction town_action);
    00275
    00284   static TownRating GetRating(TownID town_id, AICompany::CompanyID company_id);
    00285
    00292   static int GetAllowedNoise(TownID town_id);
    00293
    00299   static RoadLayout GetRoadLayout(TownID town_id);
    00300 };
    00301
    00302 #endif /* AI_TOWN_HPP */