group_sl.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "../stdafx.h"
00013 #include "../group.h"
00014
00015 #include "saveload.h"
00016
00017 static const SaveLoad _group_desc[] = {
00018 SLE_CONDVAR(Group, name, SLE_NAME, 0, 83),
00019 SLE_CONDSTR(Group, name, SLE_STR, 0, 84, SL_MAX_VERSION),
00020 SLE_VAR(Group, num_vehicle, SLE_UINT16),
00021 SLE_VAR(Group, owner, SLE_UINT8),
00022 SLE_VAR(Group, vehicle_type, SLE_UINT8),
00023 SLE_VAR(Group, replace_protection, SLE_BOOL),
00024 SLE_END()
00025 };
00026
00027 static void Save_GRPS()
00028 {
00029 Group *g;
00030
00031 FOR_ALL_GROUPS(g) {
00032 SlSetArrayIndex(g->index);
00033 SlObject(g, _group_desc);
00034 }
00035 }
00036
00037
00038 static void Load_GRPS()
00039 {
00040 int index;
00041
00042 while ((index = SlIterateArray()) != -1) {
00043 Group *g = new (index) Group();
00044 SlObject(g, _group_desc);
00045 }
00046 }
00047
00048 extern const ChunkHandler _group_chunk_handlers[] = {
00049 { 'GRPS', Save_GRPS, Load_GRPS, NULL, CH_ARRAY | CH_LAST},
00050 };