Files @ r10585:02717b4646db
Branch filter:

Location: cpp/openttd-patchpack/source/src/saveload/subsidy_sl.cpp

translators
(svn r14848) -Update: WebTranslator2 update to 2009-01-05 18:44:14
afrikaans - 11 fixed by Alrich (11)
arabic_egypt - 19 fixed, 21 changed by khaloofah (40)
danish - 40 fixed, 1 changed by ThomasA (41)
dutch - 2 fixed, 25 changed by Excel20 (27)
hebrew - 8 fixed by EScake (8)
hungarian - 18 fixed by alyr (18)
italian - 18 fixed by lorenzodv (18)
norwegian_bokmal - 3 fixed, 11 changed by khh (14)
norwegian_nynorsk - 8 fixed by Grilldyret (8)
polish - 3 fixed by xaxa (3)
portuguese - 7 fixed by SnowFlake (7)
urdu - 9 fixed by yasirniazkhan (9)
/* $Id$ */

/** @file subsidy_sl.cpp Code handling saving and loading of subsidies */

#include "../stdafx.h"
#include "../economy_func.h"

#include "saveload.h"

static const SaveLoad _subsidies_desc[] = {
	    SLE_VAR(Subsidy, cargo_type, SLE_UINT8),
	    SLE_VAR(Subsidy, age,        SLE_UINT8),
	SLE_CONDVAR(Subsidy, from,       SLE_FILE_U8 | SLE_VAR_U16, 0, 4),
	SLE_CONDVAR(Subsidy, from,       SLE_UINT16,                5, SL_MAX_VERSION),
	SLE_CONDVAR(Subsidy, to,         SLE_FILE_U8 | SLE_VAR_U16, 0, 4),
	SLE_CONDVAR(Subsidy, to,         SLE_UINT16,                5, SL_MAX_VERSION),
	SLE_END()
};

void Save_SUBS()
{
	int i;
	Subsidy *s;

	for (i = 0; i != lengthof(_subsidies); i++) {
		s = &_subsidies[i];
		if (s->cargo_type != CT_INVALID) {
			SlSetArrayIndex(i);
			SlObject(s, _subsidies_desc);
		}
	}
}

void Load_SUBS()
{
	int index;
	while ((index = SlIterateArray()) != -1)
		SlObject(&_subsidies[index], _subsidies_desc);
}

extern const ChunkHandler _subsidy_chunk_handlers[] = {
	{ 'SUBS', Save_SUBS,     Load_SUBS,     CH_ARRAY | CH_LAST},
};