00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "../stdafx.h"
00013 #include "../newgrf_storage.h"
00014 #include "saveload.h"
00015
00017 static const SaveLoad _storage_desc[] = {
00018 SLE_CONDVAR(PersistentStorage, grfid, SLE_UINT32, 6, SL_MAX_VERSION),
00019 SLE_CONDARR(PersistentStorage, storage, SLE_UINT32, 16, 161, SL_MAX_VERSION),
00020 SLE_END()
00021 };
00022
00024 static void Load_PSAC()
00025 {
00026 int index;
00027
00028 while ((index = SlIterateArray()) != -1) {
00029 assert(PersistentStorage::CanAllocateItem());
00030 PersistentStorage *ps = new (index) PersistentStorage(0);
00031 SlObject(ps, _storage_desc);
00032 }
00033 }
00034
00036 static void Save_PSAC()
00037 {
00038 PersistentStorage *ps;
00039
00040
00041 FOR_ALL_STORAGES(ps) {
00042 SlSetArrayIndex(ps->index);
00043 SlObject(ps, _storage_desc);
00044 }
00045 }
00046
00048 extern const ChunkHandler _persistent_storage_chunk_handlers[] = {
00049 { 'PSAC', Save_PSAC, Load_PSAC, NULL, NULL, CH_ARRAY | CH_LAST},
00050 };