ai_town.hpp

Go to the documentation of this file.
00001 /* $Id: ai_town.hpp 21654 2010-12-29 12:19:33Z yexo $ */
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:
00024   static const char *GetClassName() { return "AITown"; }
00025 
00029   enum TownAction {
00030     /* Values are important, as they represent the internal state of the game. */
00031 
00037     TOWN_ACTION_ADVERTISE_SMALL  = 0,
00038 
00044     TOWN_ACTION_ADVERTISE_MEDIUM = 1,
00045 
00051     TOWN_ACTION_ADVERTISE_LARGE  = 2,
00052 
00056     TOWN_ACTION_ROAD_REBUILD     = 3,
00057 
00061     TOWN_ACTION_BUILD_STATUE     = 4,
00062 
00066     TOWN_ACTION_FUND_BUILDINGS   = 5,
00067 
00071     TOWN_ACTION_BUY_RIGHTS       = 6,
00072 
00076     TOWN_ACTION_BRIBE            = 7,
00077   };
00078 
00082   enum TownRating {
00083     TOWN_RATING_NONE,         
00084     TOWN_RATING_APPALLING,    
00085     TOWN_RATING_VERY_POOR,    
00086     TOWN_RATING_POOR,         
00087     TOWN_RATING_MEDIOCRE,     
00088     TOWN_RATING_GOOD,         
00089     TOWN_RATING_VERY_GOOD,    
00090     TOWN_RATING_EXCELLENT,    
00091     TOWN_RATING_OUTSTANDING,  
00092     TOWN_RATING_INVALID = -1, 
00093   };
00094 
00098   enum RoadLayout {
00099     /* Order IS important, as it matches an in-game value */
00100     ROAD_LAYOUT_ORIGINAL,     
00101     ROAD_LAYOUT_BETTER_ROADS, 
00102     ROAD_LAYOUT_2x2,          
00103     ROAD_LAYOUT_3x3,          
00104     ROAD_LAYOUT_INVALID = -1, 
00105   };
00106 
00112   static int32 GetTownCount();
00113 
00119   static bool IsValidTown(TownID town_id);
00120 
00127   static char *GetName(TownID town_id);
00128 
00136   static int32 GetPopulation(TownID town_id);
00137 
00145   static int32 GetHouseCount(TownID town_id);
00146 
00153   static TileIndex GetLocation(TownID town_id);
00154 
00165   static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
00166 
00177   static int32 GetLastMonthTransported(TownID town_id, CargoID cargo_id);
00178 
00189   static int32 GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
00190 
00199   static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
00200 
00209   static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
00210 
00219   static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
00220 
00227   static bool HasStatue(TownID town_id);
00228 
00235   static bool IsCity(TownID town_id);
00236 
00244   static int GetRoadReworkDuration(TownID town_id);
00245 
00254   static AICompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
00255 
00264   static int32 GetExclusiveRightsDuration(TownID town_id);
00265 
00273   static bool IsActionAvailable(TownID town_id, TownAction town_action);
00274 
00283   static bool PerformTownAction(TownID town_id, TownAction town_action);
00284 
00293   static TownRating GetRating(TownID town_id, AICompany::CompanyID company_id);
00294 
00301   static int GetAllowedNoise(TownID town_id);
00302 
00308   static RoadLayout GetRoadLayout(TownID town_id);
00309 };
00310 
00311 #endif /* AI_TOWN_HPP */

Generated on Sun Jan 9 16:01:51 2011 for OpenTTD by  doxygen 1.6.1