src/ai/api/ai_industrylist.cpp
author truebrain
Wed, 27 Feb 2008 21:07:31 +0000
branchnoai
changeset 9792 e1222f4674c2
parent 9777 053e53a1650e
child 9820 8c116d4c6033
permissions -rw-r--r--
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     1
#include "ai_industrylist.hpp"
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     2
#include "../../industry.h"
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     3
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     4
AIIndustryList::AIIndustryList()
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     5
{
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     6
	Industry *i;
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     7
	FOR_ALL_INDUSTRIES(i) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents:
diff changeset
     8
		this->AddItem(i->index);
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
}
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
    11
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
    12
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
    13
{
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
    14
	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
    15
	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
    16
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
	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
    18
		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
    19
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
		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
    21
			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
    22
	}
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
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
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
    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
	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
    28
	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
    29
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
	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
    31
		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
    32
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
		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
    34
			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
    35
	}
9777
053e53a1650e (svn r12271) [NoAI] -Fix r12270: save before commit
truebrain
parents: 9776
diff changeset
    36
}