src/ai/api/ai_station.hpp
author truelight
Sun, 19 Aug 2007 13:16:06 +0000
branchnoai
changeset 9696 4384ed3de1f0
parent 9670 820b77e19bb3
child 9814 be51ea0adc29
permissions -rw-r--r--
(svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
[NoAI] -Fix: AICompant::GetCompanyName returned \0 for invalid company instead of NULL
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     1
/* $Id$ */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     2
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     3
/** @file ai_station.hpp Everything to query and build stations */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     4
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     5
#ifndef AI_STATION_HPP
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     6
#define AI_STATION_HPP
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     7
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     8
#include "ai_object.hpp"
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
     9
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    10
/**
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    11
 * Class that handles all station related functions.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    12
 */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    13
class AIStation : public AIObject {
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    14
public:
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    15
	/**
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    16
	 * Type of stations known in the game.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    17
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    18
	enum StationType {
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    19
		STATION_ANY        = 0x00,
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    20
		STATION_TRAIN      = 0x01,
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    21
		STATION_TRUCK_STOP = 0x02,
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    22
		STATION_BUS_STOP   = 0x04,
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    23
		STATION_AIRPORT    = 0x08,
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    24
		STATION_DOCK       = 0x10,
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    25
	};
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    26
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    27
	/**
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    28
	 * The name of the class, needed by several sub-processes.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    29
	 */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    30
	static const char *GetClassName() { return "AIStation"; }
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    31
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    32
	/**
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    33
	 * Checks whether the given station is valid and owned by you.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    34
	 * @param station_id the station to check.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    35
	 * @return true if and only if the station is valid.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    36
	 */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    37
	static bool IsValidStation(StationID station_id);
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    38
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    39
	/**
9666
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    40
	 * Get the stationID of a tile, if there is a station.
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    41
	 * @param tile the tile to find the stationID of
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    42
	 * @return StationID of the station.
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    43
	 * @post use IsValidStation to see if the station is valid.
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    44
	 */
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    45
	static StationID GetStationID(TileIndex tile);
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    46
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    47
	/**
9696
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    48
	 * Get the name of a station.
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    49
	 * @param station_id the station to get the name of.
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    50
	 * @pre IsValidStation(station_id).
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    51
	 * @return the name of the station.
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    52
	 */
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    53
	static char *GetName(StationID station_id);
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    54
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    55
	/**
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    56
	 * Get the current location of a station.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    57
	 * @param station_id the station to get the location of.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    58
	 * @pre IsValidStation(station_id).
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    59
	 * @return the tile the station is currently on.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    60
	 */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    61
	static TileIndex GetLocation(StationID station_id);
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    62
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    63
	/**
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    64
	 * See how much cargo there is waiting on a station.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    65
	 * @param station_id the station to get the cargo-waiting of.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    66
	 * @param cargo_id the cargo to get the cargo-waiting of.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    67
	 * @pre IsValidStation(station_id).
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    68
	 * @pre IsValidCargo(cargo_id).
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    69
	 * @return the amount of units waiting at the station.
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    70
	 */
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    71
	static int32 GetCargoWaiting(StationID station_id, CargoID cargo_id);
9648
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    72
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    73
	/**
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    74
	 * See how high the rating is of a cargo on a station.
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    75
	 * @param station_id the station to get the cargo-rating of.
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    76
	 * @param cargo_id the cargo to get the cargo-rating of.
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    77
	 * @pre IsValidStation(station_id).
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    78
	 * @pre IsValidCargo(cargo_id).
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    79
	 * @return the rating in percent of the cargo on the station.
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    80
	 */
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    81
	static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    82
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    83
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    84
	 * Get the coverage radius of this type of station.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    85
	 * @param type the type of station.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    86
	 * @return the radius in tiles.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    87
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    88
	static int32 GetCoverageRadius(AIStation::StationType type);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    89
};
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    90
DECLARE_ENUM_AS_BIT_SET(AIStation::StationType);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    91
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents:
diff changeset
    92
#endif /* AI_STATION_HPP */