MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / IsCargoAccepted

Method IsCargoAccepted

src/script/api/script_industry.cpp:69–81  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

67}
68
69/* static */ ScriptIndustry::CargoAcceptState ScriptIndustry::IsCargoAccepted(IndustryID industry_id, CargoType cargo_type)
70{
71 if (!IsValidIndustry(industry_id)) return CAS_NOT_ACCEPTED;
72 if (!ScriptCargo::IsValidCargo(cargo_type)) return CAS_NOT_ACCEPTED;
73
74 /* Not const because IndustryTemporarilyRefusesCargo tests a callback which needs a non-const object. */
75 Industry *i = ::Industry::Get(industry_id);
76
77 if (!i->IsCargoAccepted(cargo_type)) return CAS_NOT_ACCEPTED;
78 if (IndustryTemporarilyRefusesCargo(i, cargo_type)) return CAS_TEMP_REFUSED;
79
80 return CAS_ACCEPTED;
81}
82
83/* static */ SQInteger ScriptIndustry::GetStockpiledCargo(IndustryID industry_id, CargoType cargo_type)
84{

Calls 1

Tested by

no test coverage detected