1
/* $Id: signs_sl.cpp 15903 2009-03-30 23:15:05Z rubidium $ */
3
/** @file signs_sl.cpp Code handling saving and loading of economy data */
6
#include "../company_func.h"
7
#include "../signs_base.h"
11
static const SaveLoad _sign_desc[] = {
12
SLE_CONDVAR(Sign, name, SLE_NAME, 0, 83),
13
SLE_CONDSTR(Sign, name, SLE_STR, 0, 84, SL_MAX_VERSION),
14
SLE_CONDVAR(Sign, x, SLE_FILE_I16 | SLE_VAR_I32, 0, 4),
15
SLE_CONDVAR(Sign, y, SLE_FILE_I16 | SLE_VAR_I32, 0, 4),
16
SLE_CONDVAR(Sign, x, SLE_INT32, 5, SL_MAX_VERSION),
17
SLE_CONDVAR(Sign, y, SLE_INT32, 5, SL_MAX_VERSION),
18
SLE_CONDVAR(Sign, owner, SLE_UINT8, 6, SL_MAX_VERSION),
19
SLE_VAR(Sign, z, SLE_UINT8),
24
static void Save_SIGN()
29
SlSetArrayIndex(si->index);
30
SlObject(si, _sign_desc);
35
static void Load_SIGN()
38
while ((index = SlIterateArray()) != -1) {
39
Sign *si = new (index) Sign();
40
SlObject(si, _sign_desc);
41
/* Before version 6.1, signs didn't have owner.
42
* Before version 83, invalid signs were determined by si->str == 0.
43
* Before version 103, owner could be a bankrupted company.
44
* - we can't use IsValidCompany() now, so this is fixed in AfterLoadGame()
45
* All signs that were saved are valid (including those with just 'Sign' and INVALID_OWNER).
46
* - so set owner to OWNER_NONE if needed (signs from pre-version 6.1 would be lost) */
47
if (CheckSavegameVersionOldStyle(6, 1) || (CheckSavegameVersion(83) && si->owner == INVALID_OWNER)) {
48
si->owner = OWNER_NONE;
53
extern const ChunkHandler _sign_chunk_handlers[] = {
54
{ 'SIGN', Save_SIGN, Load_SIGN, CH_ARRAY | CH_LAST},