rubidium@9820: /* $Id$ */ rubidium@9820: truebrain@9833: /** @file ai_industrylist.cpp Implementation of AIIndustryList and friends. */ rubidium@9820: truelight@9649: #include "ai_industrylist.hpp" truebrain@10339: #include "../../openttd.h" truelight@9649: #include "../../industry.h" truelight@9649: truelight@9649: AIIndustryList::AIIndustryList() truelight@9649: { truelight@9649: Industry *i; truelight@9649: FOR_ALL_INDUSTRIES(i) { truelight@9649: this->AddItem(i->index); truelight@9649: } truelight@9649: } truebrain@9776: truebrain@9776: AIIndustryList_CargoAccepting::AIIndustryList_CargoAccepting(CargoID cargo_id) truebrain@9776: { truebrain@9776: const Industry *i; truebrain@9776: const IndustrySpec *indsp; truebrain@9776: truebrain@9776: FOR_ALL_INDUSTRIES(i) { truebrain@9776: indsp = ::GetIndustrySpec(i->type); truebrain@9776: truebrain@9776: for (byte j = 0; j < lengthof(indsp->accepts_cargo); j++) truebrain@9776: if (indsp->accepts_cargo[j] == cargo_id) this->AddItem(i->index); truebrain@9776: } truebrain@9776: } truebrain@9776: truebrain@9776: AIIndustryList_CargoProducing::AIIndustryList_CargoProducing(CargoID cargo_id) truebrain@9776: { truebrain@9776: const Industry *i; truebrain@9776: const IndustrySpec *indsp; truebrain@9776: truebrain@9776: FOR_ALL_INDUSTRIES(i) { truebrain@9776: indsp = ::GetIndustrySpec(i->type); truebrain@9776: truebrain@9776: for (byte j = 0; j < lengthof(indsp->produced_cargo); j++) truebrain@9776: if (indsp->produced_cargo[j] == cargo_id) this->AddItem(i->index); truebrain@9776: } truebrain@9777: }