ai_station.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef AI_STATION_HPP
00013 #define AI_STATION_HPP
00014
00015 #include "ai_object.hpp"
00016 #include "ai_error.hpp"
00017 #include "ai_road.hpp"
00018 #include "ai_basestation.hpp"
00019
00023 class AIStation : public AIBaseStation {
00024 public:
00025 static const char *GetClassName() { return "AIStation"; }
00026
00030 enum ErrorMessages {
00032 ERR_STATION_BASE = AIError::ERR_CAT_STATION << AIError::ERR_CAT_BIT_SIZE,
00033
00035 ERR_STATION_TOO_LARGE,
00036
00038 ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION,
00039
00041 ERR_STATION_TOO_MANY_STATIONS,
00042
00044 ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,
00045 };
00046
00050 enum StationType {
00051
00052 STATION_TRAIN = 0x01,
00053 STATION_TRUCK_STOP = 0x02,
00054 STATION_BUS_STOP = 0x04,
00055 STATION_AIRPORT = 0x08,
00056 STATION_DOCK = 0x10,
00057 STATION_ANY = 0x1F,
00058 };
00059
00065 static bool IsValidStation(StationID station_id);
00066
00073 static StationID GetStationID(TileIndex tile);
00074
00083 static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id);
00084
00093 static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
00094
00100 static int32 GetCoverageRadius(AIStation::StationType station_type);
00101
00110 static int32 GetDistanceManhattanToTile(StationID station_id, TileIndex tile);
00111
00120 static int32 GetDistanceSquareToTile(StationID station_id, TileIndex tile);
00121
00129 static bool IsWithinTownInfluence(StationID station_id, TownID town_id);
00130
00138 static bool HasStationType(StationID station_id, StationType station_type);
00139
00147 static bool HasRoadType(StationID station_id, AIRoad::RoadType road_type);
00148
00159 static TownID GetNearestTown(StationID station_id);
00160 };
00161
00162 DECLARE_ENUM_AS_BIT_SET(AIStation::StationType);
00163
00164 #endif