diff options
author | fonsinchen <fonsinchen@openttd.org> | 2014-05-04 13:57:48 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2014-05-04 13:57:48 +0000 |
commit | bb269661d499352754d254c45bc3ef75a1fac370 (patch) | |
tree | 816020d8d1ed92923dd106b48c3b7f8b4df64e08 /src/script/api/script_station.hpp | |
parent | d2357ec435afc6f09ae7a98a42b389efa62e29f0 (diff) | |
download | openttd-bb269661d499352754d254c45bc3ef75a1fac370.tar.xz |
(svn r26557) -Fix: clean up, test (somewhat), and complete the API for waiting cargo
Diffstat (limited to 'src/script/api/script_station.hpp')
-rw-r--r-- | src/script/api/script_station.hpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/script/api/script_station.hpp b/src/script/api/script_station.hpp index 8108b8370..26fc28042 100644 --- a/src/script/api/script_station.hpp +++ b/src/script/api/script_station.hpp @@ -89,6 +89,7 @@ public: /** * See how much cargo with a specific source station there is waiting on a station. * @param station_id The station to get the cargo-waiting of. + * @param from_station_id The source station of the cargo. Pass STATION_INVALID to get cargo of which the source has been deleted. * @param cargo_id The cargo to get the cargo-waiting of. * @pre IsValidStation(station_id). * @pre IsValidStation(from_station_id) || from_station_id == STATION_INVALID. @@ -100,18 +101,33 @@ public: /** * See how much cargo with a specific via-station there is waiting on a station. - * @param station_id The station to get the cargo-waiting of, or pass STATION_INVALID to get waiting cargo for "via any station". + * @param station_id The station to get the cargo-waiting of. + * @param via_station_id The next station the cargo is going to. Pass STATION_INVALID to get waiting cargo for "via any station". * @param cargo_id The cargo to get the cargo-waiting of. * @pre IsValidStation(station_id). * @pre IsValidStation(via_station_id) || via_station_id == STATION_INVALID. * @pre IsValidCargo(cargo_id). * @return The amount of units waiting at the station with via_station_id as next hop. * @note if ScriptCargo.GetCargoDistributionType(cargo_id) == ScriptCargo.DT_MANUAL, then all waiting cargo will have STATION_INVALID as next hop. - */ static int32 GetCargoWaitingVia(StationID station_id, StationID via_station_id, CargoID cargo_id); /** + * See how much cargo with a specific via-station and source station there is waiting on a station. + * @param station_id The station to get the cargo-waiting of. + * @param from_station_id The source station of the cargo. Pass STATION_INVALID to get cargo of which the source has been deleted. + * @param via_station_id The next station the cargo is going to. Pass STATION_INVALID to get waiting cargo for "via any station". + * @param cargo_id The cargo to get the cargo-waiting of. + * @pre IsValidStation(station_id). + * @pre IsValidStation(from_station_id) || from_station_id == STATION_INVALID. + * @pre IsValidStation(via_station_id) || via_station_id == STATION_INVALID. + * @pre IsValidCargo(cargo_id). + * @return The amount of units waiting at the station with from_station_id as source and via_station_id as next hop. + * @note if ScriptCargo.GetCargoDistributionType(cargo_id) == ScriptCargo.DT_MANUAL, then all waiting cargo will have STATION_INVALID as next hop. + */ + static int32 GetCargoWaitingFromVia(StationID station_id, StationID from_station_id, StationID via_station_id, CargoID cargo_id); + + /** * Check whether the given cargo at the given station a rating. * @param station_id The station to get the cargo-rating state of. * @param cargo_id The cargo to get the cargo-rating state of. @@ -226,6 +242,12 @@ public: * @return True if the state could be toggled. */ static bool OpenCloseAirport(StationID station_id); + +private: + template<bool Tfrom, bool Tvia> + static int32 CountCargoWaiting(StationID station_id, StationID from_station_id, + StationID via_station_id, CargoID cargo_id); + }; DECLARE_ENUM_AS_BIT_SET(ScriptStation::StationType) |