diff -r 196a08fbfeb6 -r ba44f8c1fd52 src/ai/api/ai_industry.cpp --- a/src/ai/api/ai_industry.cpp Wed Oct 17 23:45:22 2007 +0000 +++ b/src/ai/api/ai_industry.cpp Fri Oct 19 09:36:27 2007 +0000 @@ -49,6 +49,21 @@ return -1; } +/* static */ bool AIIndustry::IsCargoAccepted(IndustryID industry_id, CargoID cargo_id) +{ + if (!AIIndustry::IsValidIndustry(industry_id)) return false; + if (!AICargo::IsValidCargo(cargo_id)) return false; + + const Industry *i = ::GetIndustry(industry_id); + const IndustrySpec *indsp = GetIndustrySpec(i->type); + + if (indsp->accepts_cargo[0] == cargo_id) return true; + if (indsp->accepts_cargo[1] == cargo_id) return true; + if (indsp->accepts_cargo[2] == cargo_id) return true; + + return false; +} + /* static */ TileIndex AIIndustry::GetLocation(IndustryID industry_id) { if (!AIIndustry::IsValidIndustry(industry_id)) return INVALID_TILE;