# ai_station.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_station.hpp 17080 2009-08-05 23:57:41Z rubidium $ */
    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
    00056   enum SpecialStationIDs {
    00057     STATION_NEW = 0xFFFD,
    00058     STATION_JOIN_ADJACENT = 0xFFFE,
    00059     STATION_INVALID = 0xFFFF,
    00060   };
    00061
    00067   static bool IsValidStation(StationID station_id);
    00068
    00075   static StationID GetStationID(TileIndex tile);
    00076
    00083   static char *GetName(StationID station_id);
    00084
    00095   static bool SetName(StationID station_id, const char *name);
    00096
    00103   static TileIndex GetLocation(StationID station_id);
    00104
    00110   static int32 GetConstructionDate(StationID station_id);
    00111
    00120   static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id);
    00121
    00130   static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
    00131
    00137   static int32 GetCoverageRadius(AIStation::StationType station_type);
    00138
    00147   static int32 GetDistanceManhattanToTile(StationID station_id, TileIndex tile);
    00148
    00157   static int32 GetDistanceSquareToTile(StationID station_id, TileIndex tile);
    00158
    00166   static bool IsWithinTownInfluence(StationID station_id, TownID town_id);
    00167
    00175   static bool HasStationType(StationID station_id, StationType station_type);
    00176
    00184   static bool HasRoadType(StationID station_id, AIRoad::RoadType road_type);
    00185
    00196   static TownID GetNearestTown(StationID station_id);
    00197 };
    00198
    00199 DECLARE_ENUM_AS_BIT_SET(AIStation::StationType);
    00200
    00201 #endif /* AI_STATION_HPP */