src/cargopacket.cpp
changeset 9980 fb33faca2662
parent 9605 5a1897abd925
child 10067 5fdba79c2cee
equal deleted inserted replaced
9979:4f7d9c57a04e 9980:fb33faca2662
   272 	}
   272 	}
   273 	days_in_transit = dit / count;
   273 	days_in_transit = dit / count;
   274 	source = (*packets.begin())->source;
   274 	source = (*packets.begin())->source;
   275 }
   275 }
   276 
   276 
   277 /** Restore an array of cargo packets  from a backup
       
   278  * The end of the row should be marked by an invalid packet
       
   279  */
       
   280 void CargoPacket::RestoreBackup() const
       
   281 {
       
   282 	for (const CargoPacket *cargo = this; cargo->IsValid(); cargo++) {
       
   283 		CargoPacket *dest = GetCargoPacket(cargo->index);
       
   284 		assert(!dest->IsValid());
       
   285 		memcpy(dest, cargo, sizeof(CargoPacket));
       
   286 	}
       
   287 }