# cargopacket_sl.cpp

Go to the documentation of this file.

    00001 /* $Id: cargopacket_sl.cpp 15299 2009-01-31 20:16:06Z smatz $ */
    00002
    00005 #include "../stdafx.h"
    00006 #include "../cargopacket.h"
    00007
    00008 #include "saveload.h"
    00009
    00010 static const SaveLoad _cargopacket_desc[] = {
    00011   SLE_VAR(CargoPacket, source,          SLE_UINT16),
    00012   SLE_VAR(CargoPacket, source_xy,       SLE_UINT32),
    00013   SLE_VAR(CargoPacket, loaded_at_xy,    SLE_UINT32),
    00014   SLE_VAR(CargoPacket, count,           SLE_UINT16),
    00015   SLE_VAR(CargoPacket, days_in_transit, SLE_UINT8),
    00016   SLE_VAR(CargoPacket, feeder_share,    SLE_INT64),
    00017   SLE_VAR(CargoPacket, paid_for,        SLE_BOOL),
    00018
    00019   SLE_END()
    00020 };
    00021
    00022 static void Save_CAPA()
    00023 {
    00024   CargoPacket *cp;
    00025
    00026   FOR_ALL_CARGOPACKETS(cp) {
    00027     SlSetArrayIndex(cp->index);
    00028     SlObject(cp, _cargopacket_desc);
    00029   }
    00030 }
    00031
    00032 static void Load_CAPA()
    00033 {
    00034   int index;
    00035
    00036   while ((index = SlIterateArray()) != -1) {
    00037     CargoPacket *cp = new (index) CargoPacket();
    00038     SlObject(cp, _cargopacket_desc);
    00039   }
    00040 }
    00041
    00042 extern const ChunkHandler _cargopacket_chunk_handlers[] = {
    00043   { 'CAPA', Save_CAPA, Load_CAPA, CH_ARRAY | CH_LAST},
    00044 };