OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #include "../stdafx.h"
15 #include "../industry.h"
18 #include "../safeguards.h"
22 static const SaveLoad _industry_desc[] = {
86 SlSetArrayIndex(ind->index);
208 extern const ChunkHandlerTable _industry_chunk_handlers(industry_chunk_handlers);
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like INV...
@ SLV_RIFF_TO_ARRAY
294 PR#9375 Changed many CH_RIFF chunks to CH_ARRAY chunks.
@ SL_MIN_VERSION
First savegame version.
const SaveLoadCompat _industry_builder_sl_compat[]
Original field order for _industry_builder_desc.
@ REF_TOWN
Load/save a reference to a town.
IndustryTypeBuildData builddata[NUM_INDUSTRYTYPES]
Industry build data for every industry type.
#define SLE_CONDSSTR(base, variable, type, from, to)
Storage of a std::string in some savegame versions.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
#define SLE_CONDARR(base, variable, type, length, from, to)
Storage of a fixed-size array of SL_VAR elements in some savegame versions.
static const SaveLoad _industrytype_builder_desc[]
Description of the data to save and load in IndustryTypeBuildData.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
#define SLE_STR(base, variable, type, length)
Storage of a string in every savegame version.
@ SLV_SERVE_NEUTRAL_INDUSTRIES
210 PR#7234 Company stations can serve industries with attached neutral stations.
Handlers and description of chunk.
Defines the internal data of a functional industry.
void Load() const override
Load the chunk.
const SaveLoadCompat _industrytype_builder_sl_compat[]
Original field order for _industrytype_builder_desc.
#define SLE_REF(base, variable, type)
Storage of a reference in every version of a savegame.
void SlGlobList(const SaveLoadTable &slt)
Save or Load (a list of) global variables.
@ REF_STATION
Load/save a reference to a station.
@ SLV_EXTEND_INDUSTRY_CARGO_SLOTS
202 PR#6867 Increase industry cargo slots to 16 in, 16 out
@ SLF_ALLOW_CONTROL
Allow control codes in the strings.
void Reset()
Reset the entry.
A trimmed down version of what std::span will be in C++20.
Industry-type build data.
IndustryType type
type of industry.
Class for pooled persistent storage of data.
#define SLEG_VAR(name, variable, type)
Storage of a global variable in every savegame version.
const SaveLoadCompat _industry_sl_compat[]
Original field order for _industry_desc.
static const SaveLoad _industry_builder_desc[]
Description of the data to save and load in IndustryBuildData.
@ REF_STORAGE
Load/save a reference to a persistent storage.
void Save() const override
Save the chunk.
static void ResetIndustryCounts()
Resets industry counts.
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
TYPE storage[SIZE]
Memory to for the storage array.
void Load() const override
Load the chunk.
@ SLV_INDUSTRY_TEXT
289 PR#8576 v1.11.0-RC1 Additional GS text for industries.
@ SL_MAX_VERSION
Highest possible saveload version.
void Save() const override
Save the chunk.
uint32 wanted_inds
Number of wanted industries (bits 31-16), and a fraction (bits 15-0).
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
@ SLV_GS_INDUSTRY_CONTROL
287 PR#7912 and PR#8115 GS industry control.
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
static void IncIndustryTypeCount(IndustryType type)
Increment the count of industries for this type.
#define SLEG_CONDARR(name, variable, type, length, from, to)
Storage of a global fixed-size array of SL_VAR elements in some savegame versions.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
Data for managing the number of industries of a single industry type.
void Save() const override
Save the chunk.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
IndustryBuildData _industry_builder
In-game manager of industries.
void FixPointers() const override
Fix the pointers.
void Load() const override
Load the chunk.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
PersistentStorage * psa
Persistent storage for NewGRF industries.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
Class for persistent storage of data.