src/cargopacket.cpp
branchNewGRF_ports
changeset 10724 68a692eacf22
parent 10184 fcf5fb2548eb
equal deleted inserted replaced
10349:ff900a23e102 10724:68a692eacf22
   271 		feeder_share += (*it)->feeder_share;
   271 		feeder_share += (*it)->feeder_share;
   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 
       
   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 }