12 #include "../stdafx.h" 13 #include "../industry.h" 18 #include "../safeguards.h" 22 static const SaveLoad _industry_desc[] = {
68 static void Save_INDY()
73 FOR_ALL_INDUSTRIES(ind) {
74 SlSetArrayIndex(ind->
index);
79 static void Save_IIDS()
84 static void Save_TIDS()
89 static void Load_INDY()
110 static void Load_IIDS()
115 static void Load_TIDS()
120 static void Ptrs_INDY()
124 FOR_ALL_INDUSTRIES(i) {
168 if ((uint)index >= NUM_INDUSTRYTYPES)
SlErrorCorrupt(
"Too many industry builder datas");
173 extern const ChunkHandler _industry_chunk_handlers[] = {
174 {
'INDY', Save_INDY, Load_INDY, Ptrs_INDY, NULL, CH_ARRAY},
175 {
'IIDS', Save_IIDS, Load_IIDS, NULL, NULL, CH_ARRAY},
176 {
'TIDS', Save_TIDS, Load_TIDS, NULL, NULL, CH_ARRAY},
static void ResetIndustryCounts()
Resets industry counts.
#define SLE_CONDNULL(length, from, to)
Empty space in some savegame versions.
Code handling saving and loading of NewGRF mappings.
IndustryBuildData _industry_builder
In-game manager of industries.
#define SLEG_END()
End marker of global variables save or load.
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
static void Load_ITBL()
Load industry-type build data.
#define SLE_REF(base, variable, type)
Storage of a reference in every version of a savegame.
#define SLE_ARR(base, variable, type, length)
Storage of an array in every version of a savegame.
Defines the internal data of a functional industry.
Tindex index
Index of this pool item.
Load/save a reference to a town.
static void Save_ITBL()
Save industry-type build data.
#define SLEG_VAR(variable, type)
Storage of a global variable in every savegame version.
#define SLEG_CONDARR(variable, type, length, from, to)
Storage of a global array in some savegame versions.
Functions/types related to saving and loading games.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
PersistentStorage * psa
Persistent storage for NewGRF industries.
IndustryType type
type of industry.
TYPE storage[SIZE]
Memory to for the storage array.
Class for pooled persistent storage of data.
static void LoadSave_IBLD()
Load/save industry builder.
#define SL_MAX_VERSION
Highest possible savegame version.
static bool IsSavegameVersionBefore(uint16 major, byte minor=0)
Checks whether the savegame is below major.
Data for managing the number of industries of a single industry type.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Handlers and description of chunk.
static void IncIndustryTypeCount(IndustryType type)
Increment the count of industries for this type.
void Reset()
Reset the entry.
static const SaveLoad _industrytype_builder_desc[]
Description of the data to save and load in IndustryTypeBuildData.
void Load_NewGRFMapping(OverrideManagerBase &mapping)
Load a GRF ID + local id -> OpenTTD's id mapping.
#define SLE_END()
End marker of a struct/class save or load.
#define SLE_CONDARR(base, variable, type, length, from, to)
Storage of an array in some savegame versions.
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like INV...
void SlObject(void *object, const SaveLoad *sld)
Main SaveLoad function.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() ...
static const SaveLoad _industry_builder_desc[]
Description of the data to save and load in IndustryBuildData.
uint32 wanted_inds
Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
void SlGlobList(const SaveLoadGlobVarList *sldg)
Save or Load (a list of) global variables.
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
IndustryTypeBuildData builddata[NUM_INDUSTRYTYPES]
Industry build data for every industry type.
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
Save a GRF ID + local id -> OpenTTD's id mapping.
Last chunk in this array.
Load/save a reference to a persistent storage.