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

« back to all changes in this revision

Viewing changes to src/cargopacket.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: cargopacket.cpp 14271 2008-09-07 22:31:15Z rubidium $ */
 
1
/* $Id: cargopacket.cpp 15299 2009-01-31 20:16:06Z smatz $ */
2
2
 
3
3
/** @file cargopacket.cpp Implementation of the cargo packets */
4
4
 
5
5
#include "stdafx.h"
6
 
#include "openttd.h"
7
 
#include "station.h"
8
 
#include "cargopacket.h"
9
 
#include "saveload.h"
 
6
#include "station_base.h"
 
7
#include "oldpool_func.h"
10
8
 
11
9
/* Initialize the cargopacket-pool */
12
10
DEFINE_OLD_POOL_GENERIC(CargoPacket, CargoPacket)
42
40
        return this->source_xy == cp->source_xy && this->days_in_transit == cp->days_in_transit && this->paid_for == cp->paid_for;
43
41
}
44
42
 
45
 
static const SaveLoad _cargopacket_desc[] = {
46
 
        SLE_VAR(CargoPacket, source,          SLE_UINT16),
47
 
        SLE_VAR(CargoPacket, source_xy,       SLE_UINT32),
48
 
        SLE_VAR(CargoPacket, loaded_at_xy,    SLE_UINT32),
49
 
        SLE_VAR(CargoPacket, count,           SLE_UINT16),
50
 
        SLE_VAR(CargoPacket, days_in_transit, SLE_UINT8),
51
 
        SLE_VAR(CargoPacket, feeder_share,    SLE_INT64),
52
 
        SLE_VAR(CargoPacket, paid_for,        SLE_BOOL),
53
 
 
54
 
        SLE_END()
55
 
};
56
 
 
57
 
static void Save_CAPA()
58
 
{
59
 
        CargoPacket *cp;
60
 
 
61
 
        FOR_ALL_CARGOPACKETS(cp) {
62
 
                SlSetArrayIndex(cp->index);
63
 
                SlObject(cp, _cargopacket_desc);
64
 
        }
65
 
}
66
 
 
67
 
static void Load_CAPA()
68
 
{
69
 
        int index;
70
 
 
71
 
        while ((index = SlIterateArray()) != -1) {
72
 
                CargoPacket *cp = new (index) CargoPacket();
73
 
                SlObject(cp, _cargopacket_desc);
74
 
        }
75
 
}
76
 
 
77
 
extern const ChunkHandler _cargopacket_chunk_handlers[] = {
78
 
        { 'CAPA', Save_CAPA, Load_CAPA, CH_ARRAY | CH_LAST},
79
 
};
80
 
 
81
43
/*
82
44
 *
83
45
 * Cargo list implementation
243
205
 
244
206
        if (mta == MTA_FINAL_DELIVERY && !tmp.Empty()) {
245
207
                /* There are some packets that could not be delivered at the station, put them back */
246
 
                tmp.MoveTo(this, MAX_UVALUE(uint));
 
208
                tmp.MoveTo(this, UINT_MAX);
247
209
                tmp.packets.clear();
248
210
        }
249
211
 
274
236
        days_in_transit = dit / count;
275
237
        source = (*packets.begin())->source;
276
238
}
 
239