src/ai/api/ai_station.hpp
author truebrain
Sat, 23 Feb 2008 16:21:10 +0000
branchnoai
changeset 9746 e4ab7ea8d897
parent 9696 4384ed3de1f0
child 9814 be51ea0adc29
permissions -rw-r--r--
(svn r12226) [NoAI] -Fix: remove the dep for AIStationList_Vehicle on AIStationList, as Squirrel doesn't like it
/* $Id$ */

/** @file ai_station.hpp Everything to query and build stations */

#ifndef AI_STATION_HPP
#define AI_STATION_HPP

#include "ai_object.hpp"

/**
 * Class that handles all station related functions.
 */
class AIStation : public AIObject {
public:
	/**
	 * Type of stations known in the game.
	 */
	enum StationType {
		STATION_ANY        = 0x00,
		STATION_TRAIN      = 0x01,
		STATION_TRUCK_STOP = 0x02,
		STATION_BUS_STOP   = 0x04,
		STATION_AIRPORT    = 0x08,
		STATION_DOCK       = 0x10,
	};

	/**
	 * The name of the class, needed by several sub-processes.
	 */
	static const char *GetClassName() { return "AIStation"; }

	/**
	 * Checks whether the given station is valid and owned by you.
	 * @param station_id the station to check.
	 * @return true if and only if the station is valid.
	 */
	static bool IsValidStation(StationID station_id);

	/**
	 * Get the stationID of a tile, if there is a station.
	 * @param tile the tile to find the stationID of
	 * @return StationID of the station.
	 * @post use IsValidStation to see if the station is valid.
	 */
	static StationID GetStationID(TileIndex tile);

	/**
	 * Get the name of a station.
	 * @param station_id the station to get the name of.
	 * @pre IsValidStation(station_id).
	 * @return the name of the station.
	 */
	static char *GetName(StationID station_id);

	/**
	 * Get the current location of a station.
	 * @param station_id the station to get the location of.
	 * @pre IsValidStation(station_id).
	 * @return the tile the station is currently on.
	 */
	static TileIndex GetLocation(StationID station_id);

	/**
	 * See how much cargo there is waiting on a station.
	 * @param station_id the station to get the cargo-waiting of.
	 * @param cargo_id the cargo to get the cargo-waiting of.
	 * @pre IsValidStation(station_id).
	 * @pre IsValidCargo(cargo_id).
	 * @return the amount of units waiting at the station.
	 */
	static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id);

	/**
	 * See how high the rating is of a cargo on a station.
	 * @param station_id the station to get the cargo-rating of.
	 * @param cargo_id the cargo to get the cargo-rating of.
	 * @pre IsValidStation(station_id).
	 * @pre IsValidCargo(cargo_id).
	 * @return the rating in percent of the cargo on the station.
	 */
	static int32 GetCargoRating(StationID station_id, CargoID cargo_id);

	/**
	 * Get the coverage radius of this type of station.
	 * @param type the type of station.
	 * @return the radius in tiles.
	 */
	static int32 GetCoverageRadius(AIStation::StationType type);
};
DECLARE_ENUM_AS_BIT_SET(AIStation::StationType);

#endif /* AI_STATION_HPP */