# depot_sl.cpp

Go to the documentation of this file.

    00001 /* $Id: depot_sl.cpp 15903 2009-03-30 23:15:05Z rubidium $ */
    00002
    00005 #include "../stdafx.h"
    00006 #include "../depot_base.h"
    00007
    00008 #include "saveload.h"
    00009
    00010 static const SaveLoad _depot_desc[] = {
    00011   SLE_CONDVAR(Depot, xy,         SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
    00012   SLE_CONDVAR(Depot, xy,         SLE_UINT32,                 6, SL_MAX_VERSION),
    00013       SLE_VAR(Depot, town_index, SLE_UINT16),
    00014   SLE_END()
    00015 };
    00016
    00017 static void Save_DEPT()
    00018 {
    00019   Depot *depot;
    00020
    00021   FOR_ALL_DEPOTS(depot) {
    00022     SlSetArrayIndex(depot->index);
    00023     SlObject(depot, _depot_desc);
    00024   }
    00025 }
    00026
    00027 static void Load_DEPT()
    00028 {
    00029   int index;
    00030
    00031   while ((index = SlIterateArray()) != -1) {
    00032     Depot *depot = new (index) Depot();
    00033     SlObject(depot, _depot_desc);
    00034   }
    00035 }
    00036
    00037 extern const ChunkHandler _depot_chunk_handlers[] = {
    00038   { 'DEPT', Save_DEPT, Load_DEPT, CH_ARRAY | CH_LAST},
    00039 };