(svn r12940) -Fix [FS#1974](r12913): [autoreplace] a vehicle backup should include the cargo packets in the vehicle as well

This commit is contained in:
bjarni
2008-05-04 10:05:35 +00:00
parent b35100e2a9
commit 63fea0790b
5 changed files with 105 additions and 30 deletions

View File

@@ -273,3 +273,15 @@ void CargoList::InvalidateCache()
days_in_transit = dit / count;
source = (*packets.begin())->source;
}
/** Restore an array of cargo packets from a backup
* The end of the row should be marked by an invalid packet
*/
void CargoPacket::RestoreBackup() const
{
for (const CargoPacket *cargo = this; cargo->IsValid(); cargo++) {
CargoPacket *dest = GetCargoPacket(cargo->index);
assert(!dest->IsValid());
memcpy(dest, cargo, sizeof(CargoPacket));
}
}