script_town.hpp

Go to the documentation of this file.
00001 /* $Id$ */
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 SCRIPT_TOWN_HPP
00013 #define SCRIPT_TOWN_HPP
00014 
00015 #include "script_cargo.hpp"
00016 #include "script_company.hpp"
00017 
00022 class ScriptTown : public ScriptObject {
00023 public:
00027   enum TownAction {
00028     /* Values are important, as they represent the internal state of the game. */
00029 
00035     TOWN_ACTION_ADVERTISE_SMALL  = 0,
00036 
00042     TOWN_ACTION_ADVERTISE_MEDIUM = 1,
00043 
00049     TOWN_ACTION_ADVERTISE_LARGE  = 2,
00050 
00054     TOWN_ACTION_ROAD_REBUILD     = 3,
00055 
00059     TOWN_ACTION_BUILD_STATUE     = 4,
00060 
00064     TOWN_ACTION_FUND_BUILDINGS   = 5,
00065 
00069     TOWN_ACTION_BUY_RIGHTS       = 6,
00070 
00074     TOWN_ACTION_BRIBE            = 7,
00075   };
00076 
00080   enum TownRating {
00081     TOWN_RATING_NONE,         
00082     TOWN_RATING_APPALLING,    
00083     TOWN_RATING_VERY_POOR,    
00084     TOWN_RATING_POOR,         
00085     TOWN_RATING_MEDIOCRE,     
00086     TOWN_RATING_GOOD,         
00087     TOWN_RATING_VERY_GOOD,    
00088     TOWN_RATING_EXCELLENT,    
00089     TOWN_RATING_OUTSTANDING,  
00090     TOWN_RATING_INVALID = -1, 
00091   };
00092 
00096   enum RoadLayout {
00097     /* Order IS important, as it matches an in-game value */
00098     ROAD_LAYOUT_ORIGINAL,     
00099     ROAD_LAYOUT_BETTER_ROADS, 
00100     ROAD_LAYOUT_2x2,          
00101     ROAD_LAYOUT_3x3,          
00102     ROAD_LAYOUT_INVALID = -1, 
00103   };
00104 
00109   static int32 GetTownCount();
00110 
00116   static bool IsValidTown(TownID town_id);
00117 
00124   static char *GetName(TownID town_id);
00125 
00132   static int32 GetPopulation(TownID town_id);
00133 
00140   static int32 GetHouseCount(TownID town_id);
00141 
00148   static TileIndex GetLocation(TownID town_id);
00149 
00158   static int32 GetLastMonthProduction(TownID town_id, CargoID cargo_id);
00159 
00168   static int32 GetLastMonthSupplied(TownID town_id, CargoID cargo_id);
00169 
00178   static int32 GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id);
00179 
00188   static int32 GetLastMonthReceived(TownID town_id, ScriptCargo::TownEffect towneffect_id);
00189 
00201   static uint32 GetCargoGoal(TownID town_id, ScriptCargo::TownEffect towneffect_id);
00202 
00210   static int32 GetGrowthRate(TownID town_id);
00211 
00220   static int32 GetDistanceManhattanToTile(TownID town_id, TileIndex tile);
00221 
00230   static int32 GetDistanceSquareToTile(TownID town_id, TileIndex tile);
00231 
00241   static bool IsWithinTownInfluence(TownID town_id, TileIndex tile);
00242 
00249   static bool HasStatue(TownID town_id);
00250 
00257   static bool IsCity(TownID town_id);
00258 
00266   static int GetRoadReworkDuration(TownID town_id);
00267 
00276   static ScriptCompany::CompanyID GetExclusiveRightsCompany(TownID town_id);
00277 
00286   static int32 GetExclusiveRightsDuration(TownID town_id);
00287 
00295   static bool IsActionAvailable(TownID town_id, TownAction town_action);
00296 
00305   static bool PerformTownAction(TownID town_id, TownAction town_action);
00306 
00315   static TownRating GetRating(TownID town_id, ScriptCompany::CompanyID company_id);
00316 
00323   static int GetAllowedNoise(TownID town_id);
00324 
00330   static RoadLayout GetRoadLayout(TownID town_id);
00331 };
00332 
00333 #endif /* SCRIPT_TOWN_HPP */