truelight@9638: /* $Id$ */ truelight@9638: truelight@9638: /** @file ai_station.hpp Everything to query and build stations */ truelight@9638: truelight@9638: #ifndef AI_STATION_HPP truelight@9638: #define AI_STATION_HPP truelight@9638: truelight@9638: #include "ai_object.hpp" truelight@9638: truelight@9638: /** truelight@9638: * Class that handles all station related functions. truelight@9638: */ truelight@9638: class AIStation : public AIObject { truelight@9638: public: truelight@9638: /** truelight@9670: * Type of stations known in the game. truelight@9670: */ truelight@9670: enum StationType { truelight@9670: STATION_ANY = 0x00, truelight@9670: STATION_TRAIN = 0x01, truelight@9670: STATION_TRUCK_STOP = 0x02, truelight@9670: STATION_BUS_STOP = 0x04, truelight@9670: STATION_AIRPORT = 0x08, truelight@9670: STATION_DOCK = 0x10, truelight@9670: }; truelight@9670: truelight@9670: /** truelight@9638: * The name of the class, needed by several sub-processes. truelight@9638: */ truelight@9638: static const char *GetClassName() { return "AIStation"; } truelight@9638: truelight@9638: /** truelight@9638: * Checks whether the given station is valid and owned by you. truelight@9638: * @param station_id the station to check. truelight@9638: * @return true if and only if the station is valid. truelight@9638: */ truelight@9638: static bool IsValidStation(StationID station_id); truelight@9638: truelight@9638: /** truelight@9666: * Get the stationID of a tile, if there is a station. truelight@9666: * @param tile the tile to find the stationID of truelight@9666: * @return StationID of the station. truelight@9666: * @post use IsValidStation to see if the station is valid. truelight@9666: */ truelight@9666: static StationID GetStationID(TileIndex tile); truelight@9666: truelight@9666: /** truelight@9696: * Get the name of a station. truelight@9696: * @param station_id the station to get the name of. truelight@9696: * @pre IsValidStation(station_id). truelight@9696: * @return the name of the station. truelight@9696: */ truelight@9696: static char *GetName(StationID station_id); truelight@9696: truelight@9696: /** truelight@9638: * Get the current location of a station. truelight@9638: * @param station_id the station to get the location of. truelight@9638: * @pre IsValidStation(station_id). truelight@9638: * @return the tile the station is currently on. truelight@9638: */ truelight@9638: static TileIndex GetLocation(StationID station_id); truelight@9638: truelight@9638: /** truelight@9638: * See how much cargo there is waiting on a station. truelight@9638: * @param station_id the station to get the cargo-waiting of. truelight@9638: * @param cargo_id the cargo to get the cargo-waiting of. truelight@9638: * @pre IsValidStation(station_id). truelight@9638: * @pre IsValidCargo(cargo_id). truelight@9638: * @return the amount of units waiting at the station. truelight@9638: */ truelight@9638: static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id); truelight@9648: truelight@9648: /** truelight@9648: * See how high the rating is of a cargo on a station. truelight@9648: * @param station_id the station to get the cargo-rating of. truelight@9648: * @param cargo_id the cargo to get the cargo-rating of. truelight@9648: * @pre IsValidStation(station_id). truelight@9648: * @pre IsValidCargo(cargo_id). truelight@9648: * @return the rating in percent of the cargo on the station. truelight@9648: */ truelight@9648: static int32 GetCargoRating(StationID station_id, CargoID cargo_id); truelight@9670: truelight@9670: /** truelight@9670: * Get the coverage radius of this type of station. truelight@9670: * @param type the type of station. truelight@9670: * @return the radius in tiles. truelight@9670: */ truelight@9670: static int32 GetCoverageRadius(AIStation::StationType type); truelight@9638: }; truelight@9670: DECLARE_ENUM_AS_BIT_SET(AIStation::StationType); truelight@9638: truelight@9638: #endif /* AI_STATION_HPP */