ai_station.hpp

Go to the documentation of this file.
00001 /* $Id: ai_station.hpp 15488 2009-02-14 21:15:23Z yexo $ */
00002 
00005 #ifndef AI_STATION_HPP
00006 #define AI_STATION_HPP
00007 
00008 #include "ai_object.hpp"
00009 #include "ai_error.hpp"
00010 #include "ai_road.hpp"
00011 
00015 class AIStation : public AIObject {
00016 public:
00017   static const char *GetClassName() { return "AIStation"; }
00018 
00022   enum ErrorMessages {
00024     ERR_STATION_BASE = AIError::ERR_CAT_STATION << AIError::ERR_CAT_BIT_SIZE,
00025 
00027     ERR_STATION_TOO_LARGE,                    // [STR_306C_STATION_TOO_SPREAD_OUT]
00028 
00030     ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_300D_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_3009_TOO_CLOSE_TO_ANOTHER_STATION, STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK]
00031 
00033     ERR_STATION_TOO_MANY_STATIONS,            // [STR_3008_TOO_MANY_STATIONS_LOADING, STR_TOO_MANY_TRUCK_STOPS, STR_TOO_MANY_BUS_STOPS]
00034 
00036     ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    // [STR_3007_TOO_MANY_STATIONS_LOADING]
00037   };
00038 
00042   enum StationType {
00043     /* Values are important, as they represent the internal state of the game. */
00044     STATION_TRAIN      = 0x01, 
00045     STATION_TRUCK_STOP = 0x02, 
00046     STATION_BUS_STOP   = 0x04, 
00047     STATION_AIRPORT    = 0x08, 
00048     STATION_DOCK       = 0x10, 
00049     STATION_ANY        = 0x1F, 
00050   };
00051 
00052   enum SpecialStationIDs {
00053     STATION_NEW = 0xFFFD,           
00054     STATION_JOIN_ADJACENT = 0xFFFE, 
00055     STATION_INVALID = 0xFFFF,       
00056   };
00057 
00063   static bool IsValidStation(StationID station_id);
00064 
00071   static StationID GetStationID(TileIndex tile);
00072 
00079   static char *GetName(StationID station_id);
00080 
00091   static bool SetName(StationID station_id, const char *name);
00092 
00099   static TileIndex GetLocation(StationID station_id);
00100 
00109   static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id);
00110 
00119   static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
00120 
00126   static int32 GetCoverageRadius(AIStation::StationType station_type);
00127 
00136   static int32 GetDistanceManhattanToTile(StationID station_id, TileIndex tile);
00137 
00146   static int32 GetDistanceSquareToTile(StationID station_id, TileIndex tile);
00147 
00155   static bool IsWithinTownInfluence(StationID station_id, TownID town_id);
00156 
00164   static bool HasStationType(StationID station_id, StationType station_type);
00165 
00173   static bool HasRoadType(StationID station_id, AIRoad::RoadType road_type);
00174 
00185   static TownID GetNearestTown(StationID station_id);
00186 };
00187 
00188 DECLARE_ENUM_AS_BIT_SET(AIStation::StationType);
00189 
00190 #endif /* AI_STATION_HPP */

Generated on Wed Apr 1 14:38:04 2009 for OpenTTD by  doxygen 1.5.6