summaryrefslogtreecommitdiff
path: root/src/script/api/script_station.hpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-04-06 12:36:33 +0000
committerrubidium <rubidium@openttd.org>2013-04-06 12:36:33 +0000
commit7a3d549f2f2b372fd97fce6795a49b7c49823548 (patch)
tree4201a25b4a42fa803bda5b12a94d8b64dce6ce77 /src/script/api/script_station.hpp
parentb2292122b660372f253a8e0813e24366cbd049dc (diff)
downloadopenttd-7a3d549f2f2b372fd97fce6795a49b7c49823548.tar.xz
(svn r25150) -Fix [FS#5514]: [Script] The was no way to differentiate between a cargo-station combination with or without rating, so introduce [AI|GS]Station::HasRating and let GetRating return -1 when there is no rating
Diffstat (limited to 'src/script/api/script_station.hpp')
-rw-r--r--src/script/api/script_station.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/script/api/script_station.hpp b/src/script/api/script_station.hpp
index bb5d22c1b..7614b516c 100644
--- a/src/script/api/script_station.hpp
+++ b/src/script/api/script_station.hpp
@@ -87,11 +87,22 @@ public:
static int32 GetCargoWaiting(StationID 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.
+ * @pre IsValidStation(station_id).
+ * @pre IsValidCargo(cargo_id).
+ * @return True if the cargo has a rating, otherwise false.
+ */
+ static bool HasCargoRating(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).
+ * @pre HasCargoRating(station_id, cargo_id).
* @return The rating in percent of the cargo on the station.
*/
static int32 GetCargoRating(StationID station_id, CargoID cargo_id);