src/ai/api/ai_industrylist.cpp
author truebrain
Wed, 26 Mar 2008 15:17:40 +0000
branchnoai
changeset 9823 0b7f816cf46f
parent 9820 8c116d4c6033
child 9833 89a64246458f
permissions -rw-r--r--
(svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
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
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
     3
/** @file ai_industrylist.cpp List of industries */
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
}