Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "../stdafx.h"
00013 #include "../goal_base.h"
00014
00015 #include "saveload.h"
00016
00017 static const SaveLoad _goals_desc[] = {
00018 SLE_VAR(Goal, company, SLE_FILE_U16 | SLE_VAR_U8),
00019 SLE_VAR(Goal, type, SLE_FILE_U16 | SLE_VAR_U8),
00020 SLE_VAR(Goal, dst, SLE_UINT32),
00021 SLE_STR(Goal, text, SLE_STR | SLF_ALLOW_CONTROL, 0),
00022 SLE_CONDSTR(Goal, progress, SLE_STR | SLF_ALLOW_CONTROL, 0, 182, SL_MAX_VERSION),
00023 SLE_CONDVAR(Goal, completed, SLE_BOOL, 182, SL_MAX_VERSION),
00024 SLE_END()
00025 };
00026
00027 static void Save_GOAL()
00028 {
00029 Goal *s;
00030 FOR_ALL_GOALS(s) {
00031 SlSetArrayIndex(s->index);
00032 SlObject(s, _goals_desc);
00033 }
00034 }
00035
00036 static void Load_GOAL()
00037 {
00038 int index;
00039 while ((index = SlIterateArray()) != -1) {
00040 Goal *s = new (index) Goal();
00041 SlObject(s, _goals_desc);
00042 }
00043 }
00044
00045 extern const ChunkHandler _goal_chunk_handlers[] = {
00046 { 'GOAL', Save_GOAL, Load_GOAL, NULL, NULL, CH_ARRAY | CH_LAST},
00047 };