~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/ai/api/ai_cargolist.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: ai_cargolist.cpp 15299 2009-01-31 20:16:06Z smatz $ */
 
2
 
 
3
/** @file ai_cargolist.cpp Implementation of AICargoList and friends. */
 
4
 
 
5
#include "ai_cargolist.hpp"
 
6
#include "ai_industry.hpp"
 
7
#include "../../cargotype.h"
 
8
#include "../../tile_type.h"
 
9
#include "../../industry.h"
 
10
 
 
11
AICargoList::AICargoList()
 
12
{
 
13
        for (byte i = 0; i < NUM_CARGO; i++) {
 
14
                const CargoSpec *c = ::GetCargo(i);
 
15
                if (c->IsValid()) {
 
16
                        this->AddItem(i);
 
17
                }
 
18
        }
 
19
}
 
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
}