(svn r26396) -Add: [script] AI/GS APIs to get cargo waiting from/via other station

This commit is contained in:
zuu
2014-03-10 22:18:53 +00:00
parent 23441b37cb
commit ad639258f8
11 changed files with 156 additions and 50 deletions

View File

@@ -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);
}