ai_station.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 AI_STATION_HPP
00013 #define AI_STATION_HPP
00014 
00015 #include "ai_road.hpp"
00016 #include "ai_basestation.hpp"
00017 
00021 class AIStation : public AIBaseStation {
00022 public:
00024   static const char *GetClassName() { return "AIStation"; }
00025 
00029   enum ErrorMessages {
00031     ERR_STATION_BASE = AIError::ERR_CAT_STATION << AIError::ERR_CAT_BIT_SIZE,
00032 
00034     ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK]
00035 
00037     ERR_STATION_TOO_MANY_STATIONS,            // [STR_ERROR_TOO_MANY_STATIONS_LOADING, STR_ERROR_TOO_MANY_TRUCK_STOPS, STR_ERROR_TOO_MANY_BUS_STOPS]
00038 
00040     ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    // [STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT]
00041   };
00042 
00046   enum StationType {
00047     /* Values are important, as they represent the internal state of the game. */
00048     STATION_TRAIN      = 0x01, 
00049     STATION_TRUCK_STOP = 0x02, 
00050     STATION_BUS_STOP   = 0x04, 
00051     STATION_AIRPORT    = 0x08, 
00052     STATION_DOCK       = 0x10, 
00053     STATION_ANY        = 0x1F, 
00054   };
00055 
00061   static bool IsValidStation(StationID station_id);
00062 
00069   static StationID GetStationID(TileIndex tile);
00070 
00079   static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id);
00080 
00089   static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
00090 
00096   static int32 GetCoverageRadius(AIStation::StationType station_type);
00097 
00106   static int32 GetDistanceManhattanToTile(StationID station_id, TileIndex tile);
00107 
00116   static int32 GetDistanceSquareToTile(StationID station_id, TileIndex tile);
00117 
00125   static bool IsWithinTownInfluence(StationID station_id, TownID town_id);
00126 
00134   static bool HasStationType(StationID station_id, StationType station_type);
00135 
00143   static bool HasRoadType(StationID station_id, AIRoad::RoadType road_type);
00144 
00155   static TownID GetNearestTown(StationID station_id);
00156 };
00157 
00158 DECLARE_ENUM_AS_BIT_SET(AIStation::StationType)
00159 
00160 #endif /* AI_STATION_HPP */

Generated on Sun Jun 5 04:19:53 2011 for OpenTTD by  doxygen 1.6.1