diff options
author | zuu <zuu@openttd.org> | 2014-03-10 22:18:53 +0000 |
---|---|---|
committer | zuu <zuu@openttd.org> | 2014-03-10 22:18:53 +0000 |
commit | ae23f519f708d6f963a1223021455440e13fe9aa (patch) | |
tree | 6a17b511109b373a9b15061beaedbf83b6041d3e /src/script/api/script_cargo.cpp | |
parent | 51501be48f3d499fa8db0829ab6aaf19d5dfdc74 (diff) | |
download | openttd-ae23f519f708d6f963a1223021455440e13fe9aa.tar.xz |
(svn r26396) -Add: [script] AI/GS APIs to get cargo waiting from/via other station
Diffstat (limited to 'src/script/api/script_cargo.cpp')
-rw-r--r-- | src/script/api/script_cargo.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/script/api/script_cargo.cpp b/src/script/api/script_cargo.cpp index e8268b6bb..b2459af4e 100644 --- a/src/script/api/script_cargo.cpp +++ b/src/script/api/script_cargo.cpp @@ -13,6 +13,7 @@ #include "script_cargo.hpp" #include "../../economy_func.h" #include "../../core/bitmath_func.hpp" +#include "../../settings_type.h" /* static */ bool ScriptCargo::IsValidCargo(CargoID cargo_type) { @@ -64,3 +65,9 @@ if (!IsValidCargo(cargo_type)) return -1; return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, 255), cargo_type); } + +/* static */ ScriptCargo::DistributionType ScriptCargo::GetDistributionType(CargoID cargo_type) +{ + if (!ScriptCargo::IsValidCargo(cargo_type)) return INVALID_DISTRIBUTION_TYPE; + return (ScriptCargo::DistributionType)_settings_game.linkgraph.GetDistributionType(cargo_type); +}
\ No newline at end of file |