author | rubidium |
Mon, 07 Apr 2008 18:41:49 +0000 | |
branch | noai |
changeset 10090 | d6a6cac2fb25 |
parent 9833 | 89a64246458f |
child 10339 | ce6cd68d9eb8 |
permissions | -rw-r--r-- |
9820
8c116d4c6033
(svn r12423) [NoAI] -Change: bring a little more uniformness into the first few lines of the API related files (add missing /* $Id$ */ and such).
rubidium
parents:
9777
diff
changeset
|
1 |
/* $Id$ */ |
8c116d4c6033
(svn r12423) [NoAI] -Change: bring a little more uniformness into the first few lines of the API related files (add missing /* $Id$ */ and such).
rubidium
parents:
9777
diff
changeset
|
2 |
|
9833
89a64246458f
(svn r12496) [NoAI] -Documentation: give the .cpp files a nice uniform format too
truebrain
parents:
9820
diff
changeset
|
3 |
/** @file ai_industrylist.cpp Implementation of AIIndustryList and friends. */ |
9820
8c116d4c6033
(svn r12423) [NoAI] -Change: bring a little more uniformness into the first few lines of the API related files (add missing /* $Id$ */ and such).
rubidium
parents:
9777
diff
changeset
|
4 |
|
9649
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
5 |
#include "ai_industrylist.hpp" |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
6 |
#include "../../industry.h" |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
7 |
|
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
8 |
AIIndustryList::AIIndustryList() |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
9 |
{ |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
10 |
Industry *i; |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
11 |
FOR_ALL_INDUSTRIES(i) { |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
12 |
this->AddItem(i->index); |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
13 |
} |
bc8c06513f5b
(svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff
changeset
|
14 |
} |
9776
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
15 |
|
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
16 |
AIIndustryList_CargoAccepting::AIIndustryList_CargoAccepting(CargoID cargo_id) |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
17 |
{ |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
18 |
const Industry *i; |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
19 |
const IndustrySpec *indsp; |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
20 |
|
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
21 |
FOR_ALL_INDUSTRIES(i) { |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
22 |
indsp = ::GetIndustrySpec(i->type); |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
23 |
|
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
24 |
for (byte j = 0; j < lengthof(indsp->accepts_cargo); j++) |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
25 |
if (indsp->accepts_cargo[j] == cargo_id) this->AddItem(i->index); |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
26 |
} |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
27 |
} |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
28 |
|
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
29 |
AIIndustryList_CargoProducing::AIIndustryList_CargoProducing(CargoID cargo_id) |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
30 |
{ |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
31 |
const Industry *i; |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
32 |
const IndustrySpec *indsp; |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
33 |
|
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
34 |
FOR_ALL_INDUSTRIES(i) { |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
35 |
indsp = ::GetIndustrySpec(i->type); |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
36 |
|
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
37 |
for (byte j = 0; j < lengthof(indsp->produced_cargo); j++) |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
38 |
if (indsp->produced_cargo[j] == cargo_id) this->AddItem(i->index); |
ee9923d46fba
(svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents:
9649
diff
changeset
|
39 |
} |
9777
053e53a1650e
(svn r12271) [NoAI] -Fix r12270: save before commit
truebrain
parents:
9776
diff
changeset
|
40 |
} |