equal
deleted
inserted
replaced
14 void InitializeCargoPackets() |
14 void InitializeCargoPackets() |
15 { |
15 { |
16 /* Clean the cargo packet pool and create 1 block in it */ |
16 /* Clean the cargo packet pool and create 1 block in it */ |
17 _CargoPacket_pool.CleanPool(); |
17 _CargoPacket_pool.CleanPool(); |
18 _CargoPacket_pool.AddBlockToPool(); |
18 _CargoPacket_pool.AddBlockToPool(); |
19 |
|
20 /* Check whether our &cargolist == &cargolist.packets "hack" works */ |
|
21 CargoList::AssertOnWrongPacketOffset(); |
|
22 } |
19 } |
23 |
20 |
24 CargoPacket::CargoPacket(StationID source, uint16 count) |
21 CargoPacket::CargoPacket(StationID source, uint16 count) |
25 { |
22 { |
26 if (source != INVALID_STATION) assert(count != 0); |
23 if (source != INVALID_STATION) assert(count != 0); |
84 /* |
81 /* |
85 * |
82 * |
86 * Cargo list implementation |
83 * Cargo list implementation |
87 * |
84 * |
88 */ |
85 */ |
89 |
|
90 /* static */ void CargoList::AssertOnWrongPacketOffset() |
|
91 { |
|
92 CargoList cl; |
|
93 if ((void*)&cl != (void*)cl.Packets()) NOT_REACHED(); |
|
94 } |
|
95 |
|
96 |
86 |
97 CargoList::~CargoList() |
87 CargoList::~CargoList() |
98 { |
88 { |
99 while (!packets.empty()) { |
89 while (!packets.empty()) { |
100 delete packets.front(); |
90 delete packets.front(); |