src/ai/api/ai_station.hpp
author rubidium
Thu, 03 Apr 2008 23:01:54 +0000
branchnoai
changeset 9865 f241472f09dc
parent 9838 0839682a601b
child 9866 efc38e1f559a
permissions -rw-r--r--
(svn r12555) [NoAI] -Add: support for GetLastError for AICompany.
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
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9814
diff changeset
     3
/** @file ai_station.hpp Everything to query and build stations. */
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
     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"
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents: 9829
diff changeset
     9
#include "../../station_type.h"
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
    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
/**
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
 * 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
    13
 */
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
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
    15
public:
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9814
diff changeset
    16
	static const char *GetClassName() { return "AIStation"; }
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9814
diff changeset
    17
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
    18
	/**
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    19
	 * Type of stations known in the game.
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    20
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    21
	enum StationType {
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    22
		STATION_ANY        = 0x00, //!< All station types
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    23
		STATION_TRAIN      = 0x01, //!< Train station
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    24
		STATION_TRUCK_STOP = 0x02, //!< Truck station
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    25
		STATION_BUS_STOP   = 0x04, //!< Bus station
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    26
		STATION_AIRPORT    = 0x08, //!< Airport
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    27
		STATION_DOCK       = 0x10, //!< Dock
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    28
	};
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    29
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    30
	/**
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
    31
	 * Checks whether the given station is valid and owned by you.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    32
	 * @param station_id The station to check.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    33
	 * @return True if and only if the station is valid.
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
    34
	 */
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
	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
    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
	/**
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    38
	 * Get the StationID of a tile, if there is a station.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    39
	 * @param tile The tile to find the stationID of
9666
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    40
	 * @return StationID of the station.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    41
	 * @post Use IsValidStation() to see if the station is valid.
9666
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    42
	 */
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    43
	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
    44
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9648
diff changeset
    45
	/**
9696
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    46
	 * Get the name of a station.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    47
	 * @param station_id The station to get the name of.
9696
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    48
	 * @pre IsValidStation(station_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    49
	 * @return The name of the station.
9696
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    50
	 */
4384ed3de1f0 (svn r10937) [NoAI] -Add: added AIStation::GetName on request by Nickman
truelight
parents: 9670
diff changeset
    51
	static char *GetName(StationID station_id);
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
	/**
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
    54
	 * Get the current location of a station.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    55
	 * @param station_id The station to get the location of.
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
	 * @pre IsValidStation(station_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    57
	 * @return The tile the station is currently on.
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
    58
	 */
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
	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
    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
	/**
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
	 * See how much cargo there is waiting on a station.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    63
	 * @param station_id The station to get the cargo-waiting of.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    64
	 * @param cargo_id The cargo to get the cargo-waiting of.
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
    65
	 * @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
    66
	 * @pre IsValidCargo(cargo_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    67
	 * @return The amount of units waiting at the station.
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
    68
	 */
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
	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
    70
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    71
	/**
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    72
	 * See how high the rating is of a cargo on a station.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    73
	 * @param station_id The station to get the cargo-rating of.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    74
	 * @param cargo_id The cargo to get the cargo-rating of.
9648
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    75
	 * @pre IsValidStation(station_id).
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    76
	 * @pre IsValidCargo(cargo_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    77
	 * @return The rating in percent of the cargo on the station.
9648
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    78
	 */
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9638
diff changeset
    79
	static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    80
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    81
	/**
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    82
	 * Get the coverage radius of this type of station.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    83
	 * @param type The type of station.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
    84
	 * @return The radius in tiles.
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    85
	 */
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
    86
	static int32 GetCoverageRadius(AIStation::StationType type);
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    87
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    88
	/**
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    89
	 * Get the manhattan distance from the tile to the AIStation::GetLocation()
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    90
	 *  of the station.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    91
	 * @param station_id The station to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    92
	 * @param tile The tile to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    93
	 * @return The distance between station and tile.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    94
	 */
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    95
	static int32 GetDistanceManhattanToTile(StationID station_id, TileIndex tile);
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    96
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    97
	/**
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    98
	 * Get the square distance from the tile to the AIStation::GetLocation()
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
    99
	 *  of the station.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
   100
	 * @param station_id The station to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
   101
	 * @param tile The tile to get the distance to.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
   102
	 * @return The distance between station and tile.
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
   103
	 */
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9696
diff changeset
   104
	static int32 GetDistanceSquareToTile(StationID station_id, TileIndex tile);
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
   105
};
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9837
diff changeset
   106
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9666
diff changeset
   107
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
   108
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
   109
#endif /* AI_STATION_HPP */