equal
deleted
inserted
replaced
1 /* $Id$ */ |
1 /* $Id$ */ |
2 |
2 |
3 /** @file ai_cargolist.cpp Implementation of AICargoList and friends. */ |
3 /** @file ai_cargolist.cpp Implementation of AICargoList and friends. */ |
4 |
4 |
5 #include "ai_cargolist.hpp" |
5 #include "ai_cargolist.hpp" |
|
6 #include "ai_industry.hpp" |
6 #include "../../openttd.h" |
7 #include "../../openttd.h" |
7 #include "../../cargotype.h" |
8 #include "../../cargotype.h" |
|
9 #include "../../industry.h" |
8 |
10 |
9 AICargoList::AICargoList() |
11 AICargoList::AICargoList() |
10 { |
12 { |
11 for (byte i = 0; i < NUM_CARGO; i++) { |
13 for (byte i = 0; i < NUM_CARGO; i++) { |
12 const CargoSpec *c = ::GetCargo(i); |
14 const CargoSpec *c = ::GetCargo(i); |
14 this->AddItem(i); |
16 this->AddItem(i); |
15 } |
17 } |
16 } |
18 } |
17 } |
19 } |
18 |
20 |
|
21 AICargoList_IndustryAccepting::AICargoList_IndustryAccepting(IndustryID industry_id) |
|
22 { |
|
23 if (!AIIndustry::IsValidIndustry(industry_id)) return; |
|
24 |
|
25 Industry *ind = ::GetIndustry(industry_id); |
|
26 for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) { |
|
27 CargoID cargo_id = ind->accepts_cargo[i]; |
|
28 if (cargo_id != CT_INVALID) { |
|
29 this->AddItem(cargo_id); |
|
30 } |
|
31 } |
|
32 } |
|
33 |
|
34 AICargoList_IndustryProducing::AICargoList_IndustryProducing(IndustryID industry_id) |
|
35 { |
|
36 if (!AIIndustry::IsValidIndustry(industry_id)) return; |
|
37 |
|
38 Industry *ind = ::GetIndustry(industry_id); |
|
39 for (uint i = 0; i < lengthof(ind->produced_cargo); i++) { |
|
40 CargoID cargo_id = ind->produced_cargo[i]; |
|
41 if (cargo_id != CT_INVALID) { |
|
42 this->AddItem(cargo_id); |
|
43 } |
|
44 } |
|
45 } |