mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Convert saveload numbers to enum values.
(This was mostly achieved with a few in-place regexes)
This commit is contained in:
parent
ea4ea62816
commit
9de12521ec
File diff suppressed because it is too large
Load Diff
|
@ -30,8 +30,8 @@ static bool _ai_saveload_is_random;
|
|||
static const SaveLoad _ai_company[] = {
|
||||
SLEG_STR(_ai_saveload_name, SLE_STRB),
|
||||
SLEG_STR(_ai_saveload_settings, SLE_STRB),
|
||||
SLEG_CONDVAR(_ai_saveload_version, SLE_UINT32, 108, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_ai_saveload_is_random, SLE_BOOL, 136, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_ai_saveload_version, SLE_UINT32, SLV_108, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_ai_saveload_is_random, SLE_BOOL, SLV_136, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
|
|
@ -35,10 +35,10 @@ static void Save_ANIT()
|
|||
static void Load_ANIT()
|
||||
{
|
||||
/* Before version 80 we did NOT have a variable length animated tile table */
|
||||
if (IsSavegameVersionBefore(80)) {
|
||||
if (IsSavegameVersionBefore(SLV_80)) {
|
||||
/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
|
||||
TileIndex anim_list[256];
|
||||
SlArray(anim_list, 256, IsSavegameVersionBefore(6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);
|
||||
SlArray(anim_list, 256, IsSavegameVersionBefore(SLV_6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (anim_list[i] == 0) break;
|
||||
|
|
|
@ -21,8 +21,8 @@ static const SaveLoad _engine_renew_desc[] = {
|
|||
SLE_VAR(EngineRenew, to, SLE_UINT16),
|
||||
|
||||
SLE_REF(EngineRenew, next, REF_ENGINE_RENEWS),
|
||||
SLE_CONDVAR(EngineRenew, group_id, SLE_UINT16, 60, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(EngineRenew, replace_when_old, SLE_BOOL, 175, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(EngineRenew, group_id, SLE_UINT16, SLV_60, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(EngineRenew, replace_when_old, SLE_BOOL, SLV_175, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -45,9 +45,9 @@ static void Load_ERNW()
|
|||
SlObject(er, _engine_renew_desc);
|
||||
|
||||
/* Advanced vehicle lists, ungrouped vehicles got added */
|
||||
if (IsSavegameVersionBefore(60)) {
|
||||
if (IsSavegameVersionBefore(SLV_60)) {
|
||||
er->group_id = ALL_GROUP;
|
||||
} else if (IsSavegameVersionBefore(71)) {
|
||||
} else if (IsSavegameVersionBefore(SLV_71)) {
|
||||
if (er->group_id == DEFAULT_GROUP) er->group_id = ALL_GROUP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
/* static */ void CargoPacket::AfterLoad()
|
||||
{
|
||||
if (IsSavegameVersionBefore(44)) {
|
||||
if (IsSavegameVersionBefore(SLV_44)) {
|
||||
Vehicle *v;
|
||||
/* If we remove a station while cargo from it is still en route, payment calculation will assume
|
||||
* 0, 0 to be the source of the cargo, resulting in very high payments usually. v->source_xy
|
||||
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(120)) {
|
||||
if (IsSavegameVersionBefore(SLV_120)) {
|
||||
/* CargoPacket's source should be either INVALID_STATION or a valid station */
|
||||
CargoPacket *cp;
|
||||
FOR_ALL_CARGOPACKETS(cp) {
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!IsSavegameVersionBefore(68)) {
|
||||
if (!IsSavegameVersionBefore(SLV_68)) {
|
||||
/* Only since version 68 we have cargo packets. Savegames from before used
|
||||
* 'new CargoPacket' + cargolist.Append so their caches are already
|
||||
* correct and do not need rebuilding. */
|
||||
|
@ -80,7 +80,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(181)) {
|
||||
if (IsSavegameVersionBefore(SLV_181)) {
|
||||
Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) v->cargo.KeepAll();
|
||||
}
|
||||
|
@ -100,11 +100,11 @@ const SaveLoad *GetCargoPacketDesc()
|
|||
SLE_VAR(CargoPacket, count, SLE_UINT16),
|
||||
SLE_VAR(CargoPacket, days_in_transit, SLE_UINT8),
|
||||
SLE_VAR(CargoPacket, feeder_share, SLE_INT64),
|
||||
SLE_CONDVAR(CargoPacket, source_type, SLE_UINT8, 125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CargoPacket, source_id, SLE_UINT16, 125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CargoPacket, source_type, SLE_UINT8, SLV_125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CargoPacket, source_id, SLE_UINT16, SLV_125, SL_MAX_VERSION),
|
||||
|
||||
/* Used to be paid_for, but that got changed. */
|
||||
SLE_CONDNULL(1, 0, 121),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_121),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
|
|
@ -242,116 +242,116 @@ void AfterLoadCompanyStats()
|
|||
static const SaveLoad _company_desc[] = {
|
||||
SLE_VAR(CompanyProperties, name_2, SLE_UINT32),
|
||||
SLE_VAR(CompanyProperties, name_1, SLE_STRINGID),
|
||||
SLE_CONDSTR(CompanyProperties, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(CompanyProperties, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(CompanyProperties, president_name_1, SLE_STRINGID),
|
||||
SLE_VAR(CompanyProperties, president_name_2, SLE_UINT32),
|
||||
SLE_CONDSTR(CompanyProperties, president_name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(CompanyProperties, president_name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(CompanyProperties, face, SLE_UINT32),
|
||||
|
||||
/* money was changed to a 64 bit field in savegame version 1. */
|
||||
SLE_CONDVAR(CompanyProperties, money, SLE_VAR_I64 | SLE_FILE_I32, 0, 1),
|
||||
SLE_CONDVAR(CompanyProperties, money, SLE_INT64, 1, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, money, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_1),
|
||||
SLE_CONDVAR(CompanyProperties, money, SLE_INT64, SLV_1, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(CompanyProperties, current_loan, SLE_VAR_I64 | SLE_FILE_I32, 0, 65),
|
||||
SLE_CONDVAR(CompanyProperties, current_loan, SLE_INT64, 65, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, current_loan, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(CompanyProperties, current_loan, SLE_INT64, SLV_65, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(CompanyProperties, colour, SLE_UINT8),
|
||||
SLE_VAR(CompanyProperties, money_fraction, SLE_UINT8),
|
||||
SLE_CONDNULL(1, 0, 58), ///< avail_railtypes
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_58), ///< avail_railtypes
|
||||
SLE_VAR(CompanyProperties, block_preview, SLE_UINT8),
|
||||
|
||||
SLE_CONDNULL(2, 0, 94), ///< cargo_types
|
||||
SLE_CONDNULL(4, 94, 170), ///< cargo_types
|
||||
SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_94), ///< cargo_types
|
||||
SLE_CONDNULL(4, SLV_94, SLV_170), ///< cargo_types
|
||||
SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(CompanyProperties, location_of_HQ, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(CompanyProperties, last_build_coordinate, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(CompanyProperties, inaugurated_year, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
|
||||
SLE_ARR(CompanyProperties, share_owners, SLE_UINT8, 4),
|
||||
|
||||
SLE_VAR(CompanyProperties, num_valid_stat_ent, SLE_UINT8),
|
||||
|
||||
SLE_VAR(CompanyProperties, months_of_bankruptcy, SLE_UINT8),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_FILE_U8 | SLE_VAR_U16, 0, 104),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_UINT16, 104, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_asked, SLE_UINT16, SLV_104, SL_MAX_VERSION),
|
||||
SLE_VAR(CompanyProperties, bankrupt_timeout, SLE_INT16),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_VAR_I64 | SLE_FILE_I32, 0, 65),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_INT64, 65, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_VAR_I64 | SLE_FILE_I32, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(CompanyProperties, bankrupt_value, SLE_INT64, SLV_65, SL_MAX_VERSION),
|
||||
|
||||
/* yearly expenses was changed to 64-bit in savegame version 2. */
|
||||
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, 0, 2),
|
||||
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, 2, SL_MAX_VERSION),
|
||||
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, SL_MIN_VERSION, SLV_2),
|
||||
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(CompanyProperties, is_ai, SLE_BOOL, 2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, 107, 112), ///< is_noai
|
||||
SLE_CONDNULL(1, 4, 100),
|
||||
SLE_CONDVAR(CompanyProperties, is_ai, SLE_BOOL, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, SLV_107, SLV_112), ///< is_noai
|
||||
SLE_CONDNULL(1, SLV_4, SLV_100),
|
||||
|
||||
SLE_CONDVAR(CompanyProperties, terraform_limit, SLE_UINT32, 156, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, clear_limit, SLE_UINT32, 156, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, tree_limit, SLE_UINT32, 175, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, terraform_limit, SLE_UINT32, SLV_156, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, clear_limit, SLE_UINT32, SLV_156, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyProperties, tree_limit, SLE_UINT32, SLV_175, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _company_settings_desc[] = {
|
||||
/* Engine renewal settings */
|
||||
SLE_CONDNULL(512, 16, 19),
|
||||
SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, 19, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.engine_renew, SLE_BOOL, 16, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.engine_renew_months, SLE_INT16, 16, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.engine_renew_money, SLE_UINT32, 16, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.renew_keep_length, SLE_BOOL, 2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(512, SLV_16, SLV_19),
|
||||
SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, SLV_19, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.engine_renew, SLE_BOOL, SLV_16, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.engine_renew_months, SLE_INT16, SLV_16, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.engine_renew_money, SLE_UINT32, SLV_16, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.renew_keep_length, SLE_BOOL, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
/* Default vehicle settings */
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_ispercent, SLE_BOOL, 120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_trains, SLE_UINT16, 120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_roadveh, SLE_UINT16, 120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_aircraft, SLE_UINT16, 120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_ships, SLE_UINT16, 120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_ispercent, SLE_BOOL, SLV_120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_trains, SLE_UINT16, SLV_120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_roadveh, SLE_UINT16, SLV_120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_aircraft, SLE_UINT16, SLV_120, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Company, settings.vehicle.servint_ships, SLE_UINT16, SLV_120, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(63, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(63, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _company_settings_skip_desc[] = {
|
||||
/* Engine renewal settings */
|
||||
SLE_CONDNULL(512, 16, 19),
|
||||
SLE_CONDNULL(2, 19, 69), // engine_renew_list
|
||||
SLE_CONDNULL(4, 69, SL_MAX_VERSION), // engine_renew_list
|
||||
SLE_CONDNULL(1, 16, SL_MAX_VERSION), // settings.engine_renew
|
||||
SLE_CONDNULL(2, 16, SL_MAX_VERSION), // settings.engine_renew_months
|
||||
SLE_CONDNULL(4, 16, SL_MAX_VERSION), // settings.engine_renew_money
|
||||
SLE_CONDNULL(1, 2, SL_MAX_VERSION), // settings.renew_keep_length
|
||||
SLE_CONDNULL(512, SLV_16, SLV_19),
|
||||
SLE_CONDNULL(2, SLV_19, SLV_69), // engine_renew_list
|
||||
SLE_CONDNULL(4, SLV_69, SL_MAX_VERSION), // engine_renew_list
|
||||
SLE_CONDNULL(1, SLV_16, SL_MAX_VERSION), // settings.engine_renew
|
||||
SLE_CONDNULL(2, SLV_16, SL_MAX_VERSION), // settings.engine_renew_months
|
||||
SLE_CONDNULL(4, SLV_16, SL_MAX_VERSION), // settings.engine_renew_money
|
||||
SLE_CONDNULL(1, SLV_2, SL_MAX_VERSION), // settings.renew_keep_length
|
||||
|
||||
/* Default vehicle settings */
|
||||
SLE_CONDNULL(1, 120, SL_MAX_VERSION), // settings.vehicle.servint_ispercent
|
||||
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_trains
|
||||
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_roadveh
|
||||
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_aircraft
|
||||
SLE_CONDNULL(2, 120, SL_MAX_VERSION), // settings.vehicle.servint_ships
|
||||
SLE_CONDNULL(1, SLV_120, SL_MAX_VERSION), // settings.vehicle.servint_ispercent
|
||||
SLE_CONDNULL(2, SLV_120, SL_MAX_VERSION), // settings.vehicle.servint_trains
|
||||
SLE_CONDNULL(2, SLV_120, SL_MAX_VERSION), // settings.vehicle.servint_roadveh
|
||||
SLE_CONDNULL(2, SLV_120, SL_MAX_VERSION), // settings.vehicle.servint_aircraft
|
||||
SLE_CONDNULL(2, SLV_120, SL_MAX_VERSION), // settings.vehicle.servint_ships
|
||||
|
||||
SLE_CONDNULL(63, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(63, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _company_economy_desc[] = {
|
||||
/* these were changed to 64-bit in savegame format 2 */
|
||||
SLE_CONDVAR(CompanyEconomyEntry, income, SLE_FILE_I32 | SLE_VAR_I64, 0, 2),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, income, SLE_INT64, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_FILE_I32 | SLE_VAR_I64, 0, 2),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_INT64, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_FILE_I32 | SLE_VAR_I64, 0, 2),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_INT64, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, income, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, income, SLE_INT64, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_INT64, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_2),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_INT64, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(CompanyEconomyEntry, delivered_cargo[NUM_CARGO - 1], SLE_INT32, 0, 170),
|
||||
SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, 32, 170, 199),
|
||||
SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, NUM_CARGO, 199, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CompanyEconomyEntry, delivered_cargo[NUM_CARGO - 1], SLE_INT32, SL_MIN_VERSION, SLV_170),
|
||||
SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, 32, SLV_170, SLV_199),
|
||||
SLE_CONDARR(CompanyEconomyEntry, delivered_cargo, SLE_UINT32, NUM_CARGO, SLV_199, SL_MAX_VERSION),
|
||||
SLE_VAR(CompanyEconomyEntry, performance_history, SLE_INT32),
|
||||
|
||||
SLE_END()
|
||||
|
@ -363,49 +363,49 @@ struct CompanyOldAI {
|
|||
};
|
||||
|
||||
static const SaveLoad _company_ai_desc[] = {
|
||||
SLE_CONDNULL(2, 0, 107),
|
||||
SLE_CONDNULL(2, 0, 13),
|
||||
SLE_CONDNULL(4, 13, 107),
|
||||
SLE_CONDNULL(8, 0, 107),
|
||||
SLE_CONDVAR(CompanyOldAI, num_build_rec, SLE_UINT8, 0, 107),
|
||||
SLE_CONDNULL(3, 0, 107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_13),
|
||||
SLE_CONDNULL(4, SLV_13, SLV_107),
|
||||
SLE_CONDNULL(8, SL_MIN_VERSION, SLV_107),
|
||||
SLE_CONDVAR(CompanyOldAI, num_build_rec, SLE_UINT8, SL_MIN_VERSION, SLV_107),
|
||||
SLE_CONDNULL(3, SL_MIN_VERSION, SLV_107),
|
||||
|
||||
SLE_CONDNULL(2, 0, 6),
|
||||
SLE_CONDNULL(4, 6, 107),
|
||||
SLE_CONDNULL(2, 0, 6),
|
||||
SLE_CONDNULL(4, 6, 107),
|
||||
SLE_CONDNULL(2, 0, 107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_107),
|
||||
|
||||
SLE_CONDNULL(2, 0, 6),
|
||||
SLE_CONDNULL(4, 6, 107),
|
||||
SLE_CONDNULL(2, 0, 6),
|
||||
SLE_CONDNULL(4, 6, 107),
|
||||
SLE_CONDNULL(2, 0, 107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_107),
|
||||
|
||||
SLE_CONDNULL(2, 0, 69),
|
||||
SLE_CONDNULL(4, 69, 107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_69),
|
||||
SLE_CONDNULL(4, SLV_69, SLV_107),
|
||||
|
||||
SLE_CONDNULL(18, 0, 107),
|
||||
SLE_CONDNULL(20, 0, 107),
|
||||
SLE_CONDNULL(32, 0, 107),
|
||||
SLE_CONDNULL(18, SL_MIN_VERSION, SLV_107),
|
||||
SLE_CONDNULL(20, SL_MIN_VERSION, SLV_107),
|
||||
SLE_CONDNULL(32, SL_MIN_VERSION, SLV_107),
|
||||
|
||||
SLE_CONDNULL(64, 2, 107),
|
||||
SLE_CONDNULL(64, SLV_2, SLV_107),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _company_ai_build_rec_desc[] = {
|
||||
SLE_CONDNULL(2, 0, 6),
|
||||
SLE_CONDNULL(4, 6, 107),
|
||||
SLE_CONDNULL(2, 0, 6),
|
||||
SLE_CONDNULL(4, 6, 107),
|
||||
SLE_CONDNULL(8, 0, 107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_107),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDNULL(4, SLV_6, SLV_107),
|
||||
SLE_CONDNULL(8, SL_MIN_VERSION, SLV_107),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _company_livery_desc[] = {
|
||||
SLE_CONDVAR(Livery, in_use, SLE_UINT8, 34, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Livery, colour1, SLE_UINT8, 34, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Livery, colour2, SLE_UINT8, 34, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Livery, in_use, SLE_UINT8, SLV_34, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Livery, colour1, SLE_UINT8, SLV_34, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Livery, colour2, SLE_UINT8, SLV_34, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -422,7 +422,7 @@ static void SaveLoad_PLYR_common(Company *c, CompanyProperties *cprops)
|
|||
}
|
||||
|
||||
/* Keep backwards compatible for savegames, so load the old AI block */
|
||||
if (IsSavegameVersionBefore(107) && cprops->is_ai) {
|
||||
if (IsSavegameVersionBefore(SLV_107) && cprops->is_ai) {
|
||||
CompanyOldAI old_ai;
|
||||
char nothing;
|
||||
|
||||
|
@ -442,8 +442,8 @@ static void SaveLoad_PLYR_common(Company *c, CompanyProperties *cprops)
|
|||
}
|
||||
|
||||
/* Write each livery entry. */
|
||||
int num_liveries = IsSavegameVersionBefore(63) ? LS_END - 4 : (IsSavegameVersionBefore(85) ? LS_END - 2: LS_END);
|
||||
bool update_in_use = IsSavegameVersionBefore(205);
|
||||
int num_liveries = IsSavegameVersionBefore(SLV_63) ? LS_END - 4 : (IsSavegameVersionBefore(SLV_85) ? LS_END - 2: LS_END);
|
||||
bool update_in_use = IsSavegameVersionBefore(SLV_205);
|
||||
if (c != NULL) {
|
||||
for (i = 0; i < num_liveries; i++) {
|
||||
SlObject(&c->livery[i], _company_livery_desc);
|
||||
|
@ -510,7 +510,7 @@ static void Check_PLYR()
|
|||
SaveLoad_PLYR_common(NULL, cprops);
|
||||
|
||||
/* We do not load old custom names */
|
||||
if (IsSavegameVersionBefore(84)) {
|
||||
if (IsSavegameVersionBefore(SLV_84)) {
|
||||
if (GetStringTab(cprops->name_1) == TEXT_TAB_OLD_CUSTOM) {
|
||||
cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
static TownID _town_index;
|
||||
|
||||
static const SaveLoad _depot_desc[] = {
|
||||
SLE_CONDVAR(Depot, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Depot, xy, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_town_index, SLE_UINT16, 0, 141),
|
||||
SLE_CONDREF(Depot, town, REF_TOWN, 141, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Depot, town_cn, SLE_UINT16, 141, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Depot, name, SLE_STR, 0, 141, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Depot, build_date, SLE_INT32, 142, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Depot, xy, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Depot, xy, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_town_index, SLE_UINT16, SL_MIN_VERSION, SLV_141),
|
||||
SLE_CONDREF(Depot, town, REF_TOWN, SLV_141, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Depot, town_cn, SLE_UINT16, SLV_141, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Depot, name, SLE_STR, 0, SLV_141, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Depot, build_date, SLE_INT32, SLV_142, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ static void Load_DEPT()
|
|||
SlObject(depot, _depot_desc);
|
||||
|
||||
/* Set the town 'pointer' so we can restore it later. */
|
||||
if (IsSavegameVersionBefore(141)) depot->town = (Town *)(size_t)_town_index;
|
||||
if (IsSavegameVersionBefore(SLV_141)) depot->town = (Town *)(size_t)_town_index;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ static void Ptrs_DEPT()
|
|||
|
||||
FOR_ALL_DEPOTS(depot) {
|
||||
SlObject(depot, _depot_desc);
|
||||
if (IsSavegameVersionBefore(141)) depot->town = Town::Get((size_t)depot->town);
|
||||
if (IsSavegameVersionBefore(SLV_141)) depot->town = Town::Get((size_t)depot->town);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
static void Load_PRIC()
|
||||
{
|
||||
/* Old games store 49 base prices, very old games store them as int32 */
|
||||
int vt = IsSavegameVersionBefore(65) ? SLE_FILE_I32 : SLE_FILE_I64;
|
||||
int vt = IsSavegameVersionBefore(SLV_65) ? SLE_FILE_I32 : SLE_FILE_I64;
|
||||
SlArray(NULL, 49, vt | SLE_VAR_NULL);
|
||||
SlArray(NULL, 49, SLE_FILE_U16 | SLE_VAR_NULL);
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ static void Load_PRIC()
|
|||
/** Cargo payment rates in pre 126 savegames */
|
||||
static void Load_CAPR()
|
||||
{
|
||||
uint num_cargo = IsSavegameVersionBefore(55) ? 12 : IsSavegameVersionBefore(199) ? 32 : NUM_CARGO;
|
||||
int vt = IsSavegameVersionBefore(65) ? SLE_FILE_I32 : SLE_FILE_I64;
|
||||
uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
|
||||
int vt = IsSavegameVersionBefore(SLV_65) ? SLE_FILE_I32 : SLE_FILE_I64;
|
||||
SlArray(NULL, num_cargo, vt | SLE_VAR_NULL);
|
||||
SlArray(NULL, num_cargo, SLE_FILE_U16 | SLE_VAR_NULL);
|
||||
}
|
||||
|
||||
static const SaveLoad _economy_desc[] = {
|
||||
SLE_CONDNULL(4, 0, 65), // max_loan
|
||||
SLE_CONDNULL(8, 65, 144), // max_loan
|
||||
SLE_CONDVAR(Economy, old_max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, 0, 65),
|
||||
SLE_CONDVAR(Economy, old_max_loan_unround, SLE_INT64, 65, 126),
|
||||
SLE_CONDVAR(Economy, old_max_loan_unround_fract, SLE_UINT16, 70, 126),
|
||||
SLE_CONDVAR(Economy, inflation_prices, SLE_UINT64, 126, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Economy, inflation_payment, SLE_UINT64, 126, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, SL_MIN_VERSION, SLV_65), // max_loan
|
||||
SLE_CONDNULL(8, SLV_65, SLV_144), // max_loan
|
||||
SLE_CONDVAR(Economy, old_max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(Economy, old_max_loan_unround, SLE_INT64, SLV_65, SLV_126),
|
||||
SLE_CONDVAR(Economy, old_max_loan_unround_fract, SLE_UINT16, SLV_70, SLV_126),
|
||||
SLE_CONDVAR(Economy, inflation_prices, SLE_UINT64, SLV_126, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Economy, inflation_payment, SLE_UINT64, SLV_126, SL_MAX_VERSION),
|
||||
SLE_VAR(Economy, fluct, SLE_INT16),
|
||||
SLE_VAR(Economy, interest_rate, SLE_UINT8),
|
||||
SLE_VAR(Economy, infl_amount, SLE_UINT8),
|
||||
SLE_VAR(Economy, infl_amount_pr, SLE_UINT8),
|
||||
SLE_CONDVAR(Economy, industry_daily_change_counter, SLE_UINT32, 102, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Economy, industry_daily_change_counter, SLE_UINT32, SLV_102, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -61,14 +61,14 @@ static void Save_ECMY()
|
|||
static void Load_ECMY()
|
||||
{
|
||||
SlObject(&_economy, _economy_desc);
|
||||
StartupIndustryDailyChanges(IsSavegameVersionBefore(102)); // old savegames will need to be initialized
|
||||
StartupIndustryDailyChanges(IsSavegameVersionBefore(SLV_102)); // old savegames will need to be initialized
|
||||
}
|
||||
|
||||
static const SaveLoad _cargopayment_desc[] = {
|
||||
SLE_REF(CargoPayment, front, REF_VEHICLE),
|
||||
SLE_VAR(CargoPayment, route_profit, SLE_INT64),
|
||||
SLE_VAR(CargoPayment, visual_profit, SLE_INT64),
|
||||
SLE_CONDVAR(CargoPayment, visual_transfer, SLE_INT64, 181, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CargoPayment, visual_transfer, SLE_INT64, SLV_181, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
#include "../safeguards.h"
|
||||
|
||||
static const SaveLoad _engine_desc[] = {
|
||||
SLE_CONDVAR(Engine, intro_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Engine, intro_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, age, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Engine, age, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, intro_date, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Engine, intro_date, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Engine, age, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_VAR(Engine, reliability, SLE_UINT16),
|
||||
SLE_VAR(Engine, reliability_spd_dec, SLE_UINT16),
|
||||
SLE_VAR(Engine, reliability_start, SLE_UINT16),
|
||||
|
@ -31,19 +31,19 @@ static const SaveLoad _engine_desc[] = {
|
|||
SLE_VAR(Engine, duration_phase_2, SLE_UINT16),
|
||||
SLE_VAR(Engine, duration_phase_3, SLE_UINT16),
|
||||
|
||||
SLE_CONDNULL(1, 0, 121),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_121),
|
||||
SLE_VAR(Engine, flags, SLE_UINT8),
|
||||
SLE_CONDNULL(1, 0, 179), // old preview_company_rank
|
||||
SLE_CONDVAR(Engine, preview_asked, SLE_UINT16, 179, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, preview_company, SLE_UINT8, 179, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_179), // old preview_company_rank
|
||||
SLE_CONDVAR(Engine, preview_asked, SLE_UINT16, SLV_179, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, preview_company, SLE_UINT8, SLV_179, SL_MAX_VERSION),
|
||||
SLE_VAR(Engine, preview_wait, SLE_UINT8),
|
||||
SLE_CONDNULL(1, 0, 45),
|
||||
SLE_CONDVAR(Engine, company_avail, SLE_FILE_U8 | SLE_VAR_U16, 0, 104),
|
||||
SLE_CONDVAR(Engine, company_avail, SLE_UINT16, 104, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, company_hidden, SLE_UINT16, 193, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Engine, name, SLE_STR, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_45),
|
||||
SLE_CONDVAR(Engine, company_avail, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
|
||||
SLE_CONDVAR(Engine, company_avail, SLE_UINT16, SLV_104, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Engine, company_hidden, SLE_UINT16, SLV_193, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Engine, name, SLE_STR, 0, SLV_84, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(16, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -105,7 +105,7 @@ static void Load_ENGN()
|
|||
Engine *e = GetTempDataEngine(index);
|
||||
SlObject(e, _engine_desc);
|
||||
|
||||
if (IsSavegameVersionBefore(179)) {
|
||||
if (IsSavegameVersionBefore(SLV_179)) {
|
||||
/* preview_company_rank was replaced with preview_company and preview_asked.
|
||||
* Just cancel any previews. */
|
||||
e->flags &= ~4; // ENGINE_OFFER_WINDOW_OPEN
|
||||
|
|
|
@ -21,8 +21,8 @@ static const SaveLoad _goals_desc[] = {
|
|||
SLE_VAR(Goal, type, SLE_FILE_U16 | SLE_VAR_U8),
|
||||
SLE_VAR(Goal, dst, SLE_UINT32),
|
||||
SLE_STR(Goal, text, SLE_STR | SLF_ALLOW_CONTROL, 0),
|
||||
SLE_CONDSTR(Goal, progress, SLE_STR | SLF_ALLOW_CONTROL, 0, 182, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Goal, completed, SLE_BOOL, 182, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Goal, progress, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_182, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Goal, completed, SLE_BOOL, SLV_182, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
#include "../safeguards.h"
|
||||
|
||||
static const SaveLoad _group_desc[] = {
|
||||
SLE_CONDVAR(Group, name, SLE_NAME, 0, 84),
|
||||
SLE_CONDSTR(Group, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, 0, 164), // num_vehicle
|
||||
SLE_CONDVAR(Group, name, SLE_NAME, SL_MIN_VERSION, SLV_84),
|
||||
SLE_CONDSTR(Group, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_164), // num_vehicle
|
||||
SLE_VAR(Group, owner, SLE_UINT8),
|
||||
SLE_VAR(Group, vehicle_type, SLE_UINT8),
|
||||
SLE_VAR(Group, replace_protection, SLE_BOOL),
|
||||
SLE_CONDVAR(Group, livery.in_use, SLE_UINT8, 205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.colour1, SLE_UINT8, 205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.colour2, SLE_UINT8, 205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, parent, SLE_UINT16, 189, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.in_use, SLE_UINT8, SLV_205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.colour1, SLE_UINT8, SLV_205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, livery.colour2, SLE_UINT8, SLV_205, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Group, parent, SLE_UINT16, SLV_189, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -50,9 +50,9 @@ static void Load_GRPS()
|
|||
Group *g = new (index) Group();
|
||||
SlObject(g, _group_desc);
|
||||
|
||||
if (IsSavegameVersionBefore(189)) g->parent = INVALID_GROUP;
|
||||
if (IsSavegameVersionBefore(SLV_189)) g->parent = INVALID_GROUP;
|
||||
|
||||
if (IsSavegameVersionBefore(205)) {
|
||||
if (IsSavegameVersionBefore(SLV_205)) {
|
||||
const Company *c = Company::Get(g->owner);
|
||||
g->livery.colour1 = c->livery[LS_DEFAULT].colour1;
|
||||
g->livery.colour2 = c->livery[LS_DEFAULT].colour2;
|
||||
|
|
|
@ -20,58 +20,58 @@
|
|||
static OldPersistentStorage _old_ind_persistent_storage;
|
||||
|
||||
static const SaveLoad _industry_desc[] = {
|
||||
SLE_CONDVAR(Industry, location.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Industry, location.tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, location.tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Industry, location.tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_VAR(Industry, location.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_VAR(Industry, location.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_REF(Industry, town, REF_TOWN),
|
||||
SLE_CONDNULL( 2, 0, 61), ///< used to be industry's produced_cargo
|
||||
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, 202),
|
||||
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, 202),
|
||||
SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, production_rate, SLE_UINT8, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, production_rate, SLE_UINT8, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDNULL( 3, 0, 61), ///< used to be industry's accepts_cargo
|
||||
SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, 202),
|
||||
SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDNULL( 2, SL_MIN_VERSION, SLV_61), ///< used to be industry's produced_cargo
|
||||
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, SLV_78, SLV_202),
|
||||
SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, SLV_70, SLV_202),
|
||||
SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, production_rate, SLE_UINT8, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, production_rate, SLE_UINT8, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDNULL( 3, SL_MIN_VERSION, SLV_61), ///< used to be industry's accepts_cargo
|
||||
SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, SLV_78, SLV_202),
|
||||
SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_VAR(Industry, prod_level, SLE_UINT8),
|
||||
SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 2, 0, 202),
|
||||
SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 2, SL_MIN_VERSION, SLV_202),
|
||||
SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 16, SLV_202, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Industry, counter, SLE_UINT16),
|
||||
|
||||
SLE_VAR(Industry, type, SLE_UINT8),
|
||||
SLE_VAR(Industry, owner, SLE_UINT8),
|
||||
SLE_VAR(Industry, random_colour, SLE_UINT8),
|
||||
SLE_CONDVAR(Industry, last_prod_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Industry, last_prod_year, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, last_prod_year, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Industry, last_prod_year, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_VAR(Industry, was_cargo_delivered, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Industry, founder, SLE_UINT8, 70, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, construction_date, SLE_INT32, 70, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, construction_type, SLE_UINT8, 70, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, last_cargo_accepted_at[0], SLE_INT32, 70, 202),
|
||||
SLE_CONDARR(Industry, last_cargo_accepted_at, SLE_INT32, 16, 202, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, selected_layout, SLE_UINT8, 73, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, founder, SLE_UINT8, SLV_70, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, construction_date, SLE_INT32, SLV_70, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, construction_type, SLE_UINT8, SLV_70, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, last_cargo_accepted_at[0], SLE_INT32, SLV_70, SLV_202),
|
||||
SLE_CONDARR(Industry, last_cargo_accepted_at, SLE_INT32, 16, SLV_202, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Industry, selected_layout, SLE_UINT8, SLV_73, SL_MAX_VERSION),
|
||||
|
||||
SLEG_CONDARR(_old_ind_persistent_storage.storage, SLE_UINT32, 16, 76, 161),
|
||||
SLE_CONDREF(Industry, psa, REF_STORAGE, 161, SL_MAX_VERSION),
|
||||
SLEG_CONDARR(_old_ind_persistent_storage.storage, SLE_UINT32, 16, SLV_76, SLV_161),
|
||||
SLE_CONDREF(Industry, psa, REF_STORAGE, SLV_161, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(1, 82, 197), // random_triggers
|
||||
SLE_CONDVAR(Industry, random, SLE_UINT16, 82, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, SLV_82, SLV_197), // random_triggers
|
||||
SLE_CONDVAR(Industry, random, SLE_UINT16, SLV_82, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(32, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(32, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -108,7 +108,7 @@ static void Load_INDY()
|
|||
SlObject(i, _industry_desc);
|
||||
|
||||
/* Before savegame version 161, persistent storages were not stored in a pool. */
|
||||
if (IsSavegameVersionBefore(161) && !IsSavegameVersionBefore(76)) {
|
||||
if (IsSavegameVersionBefore(SLV_161) && !IsSavegameVersionBefore(SLV_76)) {
|
||||
/* Store the old persistent storage. The GRFID will be added later. */
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
i->psa = new PersistentStorage(0, 0, 0);
|
||||
|
|
|
@ -109,7 +109,7 @@ const SaveLoad *GetLinkGraphScheduleDesc()
|
|||
* SaveLoad desc for a link graph node.
|
||||
*/
|
||||
static const SaveLoad _node_desc[] = {
|
||||
SLE_CONDVAR(Node, xy, SLE_UINT32, 191, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Node, xy, SLE_UINT32, SLV_191, SL_MAX_VERSION),
|
||||
SLE_VAR(Node, supply, SLE_UINT32),
|
||||
SLE_VAR(Node, demand, SLE_UINT32),
|
||||
SLE_VAR(Node, station, SLE_UINT16),
|
||||
|
@ -121,11 +121,11 @@ static const SaveLoad _node_desc[] = {
|
|||
* SaveLoad desc for a link graph edge.
|
||||
*/
|
||||
static const SaveLoad _edge_desc[] = {
|
||||
SLE_CONDNULL(4, 0, 191), // distance
|
||||
SLE_CONDNULL(4, SL_MIN_VERSION, SLV_191), // distance
|
||||
SLE_VAR(Edge, capacity, SLE_UINT32),
|
||||
SLE_VAR(Edge, usage, SLE_UINT32),
|
||||
SLE_VAR(Edge, last_unrestricted_update, SLE_INT32),
|
||||
SLE_CONDVAR(Edge, last_restricted_update, SLE_INT32, 187, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Edge, last_restricted_update, SLE_INT32, SLV_187, SL_MAX_VERSION),
|
||||
SLE_VAR(Edge, next_edge, SLE_UINT16),
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ void SaveLoad_LinkGraph(LinkGraph &lg)
|
|||
for (NodeID from = 0; from < size; ++from) {
|
||||
Node *node = &lg.nodes[from];
|
||||
SlObject(node, _node_desc);
|
||||
if (IsSavegameVersionBefore(191)) {
|
||||
if (IsSavegameVersionBefore(SLV_191)) {
|
||||
/* We used to save the full matrix ... */
|
||||
for (NodeID to = 0; to < size; ++to) {
|
||||
SlObject(&lg.edges[from][to], _edge_desc);
|
||||
|
@ -229,7 +229,7 @@ static void Load_LGRS()
|
|||
*/
|
||||
void AfterLoadLinkGraphs()
|
||||
{
|
||||
if (IsSavegameVersionBefore(191)) {
|
||||
if (IsSavegameVersionBefore(SLV_191)) {
|
||||
LinkGraph *lg;
|
||||
FOR_ALL_LINK_GRAPHS(lg) {
|
||||
for (NodeID node_id = 0; node_id < lg->Size(); ++node_id) {
|
||||
|
|
|
@ -22,8 +22,8 @@ static uint32 _map_dim_x;
|
|||
static uint32 _map_dim_y;
|
||||
|
||||
static const SaveLoadGlobVarList _map_dimensions[] = {
|
||||
SLEG_CONDVAR(_map_dim_x, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_map_dim_y, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_map_dim_x, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_map_dim_y, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLEG_END()
|
||||
};
|
||||
|
||||
|
@ -126,7 +126,7 @@ static void Load_MAP2()
|
|||
for (TileIndex i = 0; i != size;) {
|
||||
SlArray(buf, MAP_SL_BUF_SIZE,
|
||||
/* In those versions the m2 was 8 bits */
|
||||
IsSavegameVersionBefore(5) ? SLE_FILE_U8 | SLE_VAR_U16 : SLE_UINT16
|
||||
IsSavegameVersionBefore(SLV_5) ? SLE_FILE_U8 | SLE_VAR_U16 : SLE_UINT16
|
||||
);
|
||||
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m2 = buf[j];
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ static void Load_MAP6()
|
|||
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf;
|
||||
TileIndex size = MapSize();
|
||||
|
||||
if (IsSavegameVersionBefore(42)) {
|
||||
if (IsSavegameVersionBefore(SLV_42)) {
|
||||
for (TileIndex i = 0; i != size;) {
|
||||
/* 1024, otherwise we overflow on 64x64 maps! */
|
||||
SlArray(buf, 1024, SLE_UINT8);
|
||||
|
|
|
@ -71,52 +71,52 @@ void ResetViewportAfterLoadGame()
|
|||
byte _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162.
|
||||
|
||||
static const SaveLoadGlobVarList _date_desc[] = {
|
||||
SLEG_CONDVAR(_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLEG_CONDVAR(_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_date, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLEG_CONDVAR(_date, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLEG_VAR(_date_fract, SLE_UINT16),
|
||||
SLEG_VAR(_tick_counter, SLE_UINT16),
|
||||
SLE_CONDNULL(2, 0, 157), // _vehicle_id_ctr_day
|
||||
SLEG_CONDVAR(_age_cargo_skip_counter, SLE_UINT8, 0, 162),
|
||||
SLE_CONDNULL(1, 0, 46),
|
||||
SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_157), // _vehicle_id_ctr_day
|
||||
SLEG_CONDVAR(_age_cargo_skip_counter, SLE_UINT8, SL_MIN_VERSION, SLV_162),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_46),
|
||||
SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLEG_VAR(_disaster_delay, SLE_UINT16),
|
||||
SLE_CONDNULL(2, 0, 120),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_120),
|
||||
SLEG_VAR(_random.state[0], SLE_UINT32),
|
||||
SLEG_VAR(_random.state[1], SLE_UINT32),
|
||||
SLE_CONDNULL(1, 0, 10),
|
||||
SLE_CONDNULL(4, 10, 120),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_10),
|
||||
SLE_CONDNULL(4, SLV_10, SLV_120),
|
||||
SLEG_VAR(_cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32),
|
||||
SLEG_CONDVAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, 0, 109),
|
||||
SLEG_CONDVAR(_next_competitor_start, SLE_UINT32, 109, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109),
|
||||
SLEG_CONDVAR(_next_competitor_start, SLE_UINT32, SLV_109, SL_MAX_VERSION),
|
||||
SLEG_VAR(_trees_tick_ctr, SLE_UINT8),
|
||||
SLEG_CONDVAR(_pause_mode, SLE_UINT8, 4, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, 11, 120),
|
||||
SLEG_CONDVAR(_pause_mode, SLE_UINT8, SLV_4, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, SLV_11, SLV_120),
|
||||
SLEG_END()
|
||||
};
|
||||
|
||||
static const SaveLoadGlobVarList _date_check_desc[] = {
|
||||
SLEG_CONDVAR(_load_check_data.current_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLEG_CONDVAR(_load_check_data.current_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_load_check_data.current_date, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLEG_CONDVAR(_load_check_data.current_date, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_NULL(2), // _date_fract
|
||||
SLE_NULL(2), // _tick_counter
|
||||
SLE_CONDNULL(2, 0, 157), // _vehicle_id_ctr_day
|
||||
SLE_CONDNULL(1, 0, 162), // _age_cargo_skip_counter
|
||||
SLE_CONDNULL(1, 0, 46),
|
||||
SLE_CONDNULL(2, 0, 6), // _cur_tileloop_tile
|
||||
SLE_CONDNULL(4, 6, SL_MAX_VERSION), // _cur_tileloop_tile
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_157), // _vehicle_id_ctr_day
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_162), // _age_cargo_skip_counter
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_46),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6), // _cur_tileloop_tile
|
||||
SLE_CONDNULL(4, SLV_6, SL_MAX_VERSION), // _cur_tileloop_tile
|
||||
SLE_NULL(2), // _disaster_delay
|
||||
SLE_CONDNULL(2, 0, 120),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_120),
|
||||
SLE_NULL(4), // _random.state[0]
|
||||
SLE_NULL(4), // _random.state[1]
|
||||
SLE_CONDNULL(1, 0, 10),
|
||||
SLE_CONDNULL(4, 10, 120),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_10),
|
||||
SLE_CONDNULL(4, SLV_10, SLV_120),
|
||||
SLE_NULL(1), // _cur_company_tick_index
|
||||
SLE_CONDNULL(2, 0, 109), // _next_competitor_start
|
||||
SLE_CONDNULL(4, 109, SL_MAX_VERSION), // _next_competitor_start
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_109), // _next_competitor_start
|
||||
SLE_CONDNULL(4, SLV_109, SL_MAX_VERSION), // _next_competitor_start
|
||||
SLE_NULL(1), // _trees_tick_ctr
|
||||
SLE_CONDNULL(1, 4, SL_MAX_VERSION), // _pause_mode
|
||||
SLE_CONDNULL(4, 11, 120),
|
||||
SLE_CONDNULL(1, SLV_4, SL_MAX_VERSION), // _pause_mode
|
||||
SLE_CONDNULL(4, SLV_11, SLV_120),
|
||||
SLEG_END()
|
||||
};
|
||||
|
||||
|
@ -130,17 +130,17 @@ static void SaveLoad_DATE()
|
|||
static void Check_DATE()
|
||||
{
|
||||
SlGlobList(_date_check_desc);
|
||||
if (IsSavegameVersionBefore(31)) {
|
||||
if (IsSavegameVersionBefore(SLV_31)) {
|
||||
_load_check_data.current_date += DAYS_TILL_ORIGINAL_BASE_YEAR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const SaveLoadGlobVarList _view_desc[] = {
|
||||
SLEG_CONDVAR(_saved_scrollpos_x, SLE_FILE_I16 | SLE_VAR_I32, 0, 6),
|
||||
SLEG_CONDVAR(_saved_scrollpos_x, SLE_INT32, 6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_saved_scrollpos_y, SLE_FILE_I16 | SLE_VAR_I32, 0, 6),
|
||||
SLEG_CONDVAR(_saved_scrollpos_y, SLE_INT32, 6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_saved_scrollpos_x, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_6),
|
||||
SLEG_CONDVAR(_saved_scrollpos_x, SLE_INT32, SLV_6, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR(_saved_scrollpos_y, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_6),
|
||||
SLEG_CONDVAR(_saved_scrollpos_y, SLE_INT32, SLV_6, SL_MAX_VERSION),
|
||||
SLEG_VAR(_saved_scrollpos_zoom, SLE_UINT8),
|
||||
SLEG_END()
|
||||
};
|
||||
|
|
|
@ -61,10 +61,10 @@ static const SaveLoad _grfconfig_desc[] = {
|
|||
SLE_STR(GRFConfig, filename, SLE_STR, 0x40),
|
||||
SLE_VAR(GRFConfig, ident.grfid, SLE_UINT32),
|
||||
SLE_ARR(GRFConfig, ident.md5sum, SLE_UINT8, 16),
|
||||
SLE_CONDVAR(GRFConfig, version, SLE_UINT32, 151, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GRFConfig, version, SLE_UINT32, SLV_151, SL_MAX_VERSION),
|
||||
SLE_ARR(GRFConfig, param, SLE_UINT32, 0x80),
|
||||
SLE_VAR(GRFConfig, num_params, SLE_UINT8),
|
||||
SLE_CONDVAR(GRFConfig, palette, SLE_UINT8, 101, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GRFConfig, palette, SLE_UINT8, SLV_101, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,7 @@ static void Load_NGRF_common(GRFConfig *&grfconfig)
|
|||
while (SlIterateArray() != -1) {
|
||||
GRFConfig *c = new GRFConfig();
|
||||
SlObject(c, _grfconfig_desc);
|
||||
if (IsSavegameVersionBefore(101)) c->SetSuitablePalette();
|
||||
if (IsSavegameVersionBefore(SLV_101)) c->SetSuitablePalette();
|
||||
AppendToGRFConfigList(&grfconfig, c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ static const SaveLoad _object_desc[] = {
|
|||
SLE_VAR(Object, location.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_REF(Object, town, REF_TOWN),
|
||||
SLE_VAR(Object, build_date, SLE_UINT32),
|
||||
SLE_CONDVAR(Object, colour, SLE_UINT8, 148, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Object, view, SLE_UINT8, 155, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Object, type, SLE_UINT16, 186, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Object, colour, SLE_UINT8, SLV_148, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Object, view, SLE_UINT8, SLV_155, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Object, type, SLE_UINT16, SLV_186, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ static void Ptrs_OBJS()
|
|||
Object *o;
|
||||
FOR_ALL_OBJECTS(o) {
|
||||
SlObject(o, _object_desc);
|
||||
if (IsSavegameVersionBefore(148) && !IsTileType(o->location.tile, MP_OBJECT)) {
|
||||
if (IsSavegameVersionBefore(SLV_148) && !IsTileType(o->location.tile, MP_OBJECT)) {
|
||||
/* Due to a small bug stale objects could remain. */
|
||||
delete o;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ void Order::ConvertFromOldSavegame()
|
|||
this->flags = 0;
|
||||
|
||||
/* First handle non-stop - use value from savegame if possible, else use value from config file */
|
||||
if (_settings_client.gui.sg_new_nonstop || (IsSavegameVersionBefore(22) && _savegame_type != SGT_TTO && _savegame_type != SGT_TTD && _settings_client.gui.new_nonstop)) {
|
||||
if (_settings_client.gui.sg_new_nonstop || (IsSavegameVersionBefore(SLV_22) && _savegame_type != SGT_TTO && _savegame_type != SGT_TTD && _settings_client.gui.new_nonstop)) {
|
||||
/* OFB_NON_STOP */
|
||||
this->SetNonStopType((old_flags & 8) ? ONSF_NO_STOP_AT_ANY_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
||||
} else {
|
||||
|
@ -49,7 +49,7 @@ void Order::ConvertFromOldSavegame()
|
|||
this->SetLoadType(OLF_LOAD_IF_POSSIBLE);
|
||||
} else {
|
||||
/* old OTTD versions stored full_load_any in config file - assume it was enabled when loading */
|
||||
this->SetLoadType(_settings_client.gui.sg_full_load_any || IsSavegameVersionBefore(22) ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
|
||||
this->SetLoadType(_settings_client.gui.sg_full_load_any || IsSavegameVersionBefore(SLV_22) ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
|
||||
}
|
||||
|
||||
if (this->IsType(OT_GOTO_STATION)) this->SetStopLocation(OSL_PLATFORM_FAR_END);
|
||||
|
@ -108,15 +108,15 @@ const SaveLoad *GetOrderDescription()
|
|||
SLE_VAR(Order, flags, SLE_UINT8),
|
||||
SLE_VAR(Order, dest, SLE_UINT16),
|
||||
SLE_REF(Order, next, REF_ORDER),
|
||||
SLE_CONDVAR(Order, refit_cargo, SLE_UINT8, 36, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, 36, 182), // refit_subtype
|
||||
SLE_CONDVAR(Order, wait_time, SLE_UINT16, 67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Order, travel_time, SLE_UINT16, 67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Order, max_speed, SLE_UINT16, 172, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Order, refit_cargo, SLE_UINT8, SLV_36, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, SLV_36, SLV_182), // refit_subtype
|
||||
SLE_CONDVAR(Order, wait_time, SLE_UINT16, SLV_67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Order, travel_time, SLE_UINT16, SLV_67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Order, max_speed, SLE_UINT16, SLV_172, SL_MAX_VERSION),
|
||||
|
||||
/* Leftover from the minor savegame version stuff
|
||||
* We will never use those free bytes, but we have to keep this line to allow loading of old savegames */
|
||||
SLE_CONDNULL(10, 5, 36),
|
||||
SLE_CONDNULL(10, SLV_5, SLV_36),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -135,12 +135,12 @@ static void Save_ORDR()
|
|||
|
||||
static void Load_ORDR()
|
||||
{
|
||||
if (IsSavegameVersionBefore(5, 2)) {
|
||||
if (IsSavegameVersionBefore(SLV_5, 2)) {
|
||||
/* Version older than 5.2 did not have a ->next pointer. Convert them
|
||||
* (in the old days, the orderlist was 5000 items big) */
|
||||
size_t len = SlGetFieldLength();
|
||||
|
||||
if (IsSavegameVersionBefore(5)) {
|
||||
if (IsSavegameVersionBefore(SLV_5)) {
|
||||
/* Pre-version 5 had another layout for orders
|
||||
* (uint16 instead of uint32) */
|
||||
len /= sizeof(uint16);
|
||||
|
@ -154,7 +154,7 @@ static void Load_ORDR()
|
|||
}
|
||||
|
||||
free(orders);
|
||||
} else if (IsSavegameVersionBefore(5, 2)) {
|
||||
} else if (IsSavegameVersionBefore(SLV_5, 2)) {
|
||||
len /= sizeof(uint32);
|
||||
uint32 *orders = MallocT<uint32>(len + 1);
|
||||
|
||||
|
@ -186,7 +186,7 @@ static void Load_ORDR()
|
|||
while ((index = SlIterateArray()) != -1) {
|
||||
Order *order = new (index) Order();
|
||||
SlObject(order, GetOrderDescription());
|
||||
if (IsSavegameVersionBefore(190)) {
|
||||
if (IsSavegameVersionBefore(SLV_190)) {
|
||||
order->SetTravelTimetabled(order->GetTravelTime() > 0);
|
||||
order->SetWaitTimetabled(order->GetWaitTime() > 0);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ static void Load_ORDR()
|
|||
static void Ptrs_ORDR()
|
||||
{
|
||||
/* Orders from old savegames have pointers corrected in Load_ORDR */
|
||||
if (IsSavegameVersionBefore(5, 2)) return;
|
||||
if (IsSavegameVersionBefore(SLV_5, 2)) return;
|
||||
|
||||
Order *o;
|
||||
|
||||
|
@ -253,18 +253,18 @@ const SaveLoad *GetOrderBackupDescription()
|
|||
SLE_VAR(OrderBackup, user, SLE_UINT32),
|
||||
SLE_VAR(OrderBackup, tile, SLE_UINT32),
|
||||
SLE_VAR(OrderBackup, group, SLE_UINT16),
|
||||
SLE_CONDVAR(OrderBackup, service_interval, SLE_FILE_U32 | SLE_VAR_U16, 0, 192),
|
||||
SLE_CONDVAR(OrderBackup, service_interval, SLE_UINT16, 192, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, service_interval, SLE_FILE_U32 | SLE_VAR_U16, SL_MIN_VERSION, SLV_192),
|
||||
SLE_CONDVAR(OrderBackup, service_interval, SLE_UINT16, SLV_192, SL_MAX_VERSION),
|
||||
SLE_STR(OrderBackup, name, SLE_STR, 0),
|
||||
SLE_CONDNULL(2, 0, 192), // clone (2 bytes of pointer, i.e. garbage)
|
||||
SLE_CONDREF(OrderBackup, clone, REF_VEHICLE, 192, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_192), // clone (2 bytes of pointer, i.e. garbage)
|
||||
SLE_CONDREF(OrderBackup, clone, REF_VEHICLE, SLV_192, SL_MAX_VERSION),
|
||||
SLE_VAR(OrderBackup, cur_real_order_index, SLE_UINT8),
|
||||
SLE_CONDVAR(OrderBackup, cur_implicit_order_index, SLE_UINT8, 176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, current_order_time, SLE_UINT32, 176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, lateness_counter, SLE_INT32, 176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, timetable_start, SLE_INT32, 176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_FILE_U8 | SLE_VAR_U16, 176, 180),
|
||||
SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_UINT16, 180, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, cur_implicit_order_index, SLE_UINT8, SLV_176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, current_order_time, SLE_UINT32, SLV_176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, lateness_counter, SLE_INT32, SLV_176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, timetable_start, SLE_INT32, SLV_176, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_FILE_U8 | SLE_VAR_U16, SLV_176, SLV_180),
|
||||
SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_UINT16, SLV_180, SL_MAX_VERSION),
|
||||
SLE_REF(OrderBackup, orders, REF_ORDER),
|
||||
SLE_END()
|
||||
};
|
||||
|
|
|
@ -53,230 +53,7 @@
|
|||
|
||||
#include "../safeguards.h"
|
||||
|
||||
/*
|
||||
* Previous savegame versions, the trunk revision where they were
|
||||
* introduced and the released version that had that particular
|
||||
* savegame version.
|
||||
* Up to savegame version 18 there is a minor version as well.
|
||||
*
|
||||
* 1.0 0.1.x, 0.2.x
|
||||
* 2.0 0.3.0
|
||||
* 2.1 0.3.1, 0.3.2
|
||||
* 3.x lost
|
||||
* 4.0 1
|
||||
* 4.1 122 0.3.3, 0.3.4
|
||||
* 4.2 1222 0.3.5
|
||||
* 4.3 1417
|
||||
* 4.4 1426
|
||||
* 5.0 1429
|
||||
* 5.1 1440
|
||||
* 5.2 1525 0.3.6
|
||||
* 6.0 1721
|
||||
* 6.1 1768
|
||||
* 7.0 1770
|
||||
* 8.0 1786
|
||||
* 9.0 1909
|
||||
* 10.0 2030
|
||||
* 11.0 2033
|
||||
* 11.1 2041
|
||||
* 12.1 2046
|
||||
* 13.1 2080 0.4.0, 0.4.0.1
|
||||
* 14.0 2441
|
||||
* 15.0 2499
|
||||
* 16.0 2817
|
||||
* 16.1 3155
|
||||
* 17.0 3212
|
||||
* 17.1 3218
|
||||
* 18 3227
|
||||
* 19 3396
|
||||
* 20 3403
|
||||
* 21 3472 0.4.x
|
||||
* 22 3726
|
||||
* 23 3915
|
||||
* 24 4150
|
||||
* 25 4259
|
||||
* 26 4466
|
||||
* 27 4757
|
||||
* 28 4987
|
||||
* 29 5070
|
||||
* 30 5946
|
||||
* 31 5999
|
||||
* 32 6001
|
||||
* 33 6440
|
||||
* 34 6455
|
||||
* 35 6602
|
||||
* 36 6624
|
||||
* 37 7182
|
||||
* 38 7195
|
||||
* 39 7269
|
||||
* 40 7326
|
||||
* 41 7348 0.5.x
|
||||
* 42 7573
|
||||
* 43 7642
|
||||
* 44 8144
|
||||
* 45 8501
|
||||
* 46 8705
|
||||
* 47 8735
|
||||
* 48 8935
|
||||
* 49 8969
|
||||
* 50 8973
|
||||
* 51 8978
|
||||
* 52 9066
|
||||
* 53 9316
|
||||
* 54 9613
|
||||
* 55 9638
|
||||
* 56 9667
|
||||
* 57 9691
|
||||
* 58 9762
|
||||
* 59 9779
|
||||
* 60 9874
|
||||
* 61 9892
|
||||
* 62 9905
|
||||
* 63 9956
|
||||
* 64 10006
|
||||
* 65 10210
|
||||
* 66 10211
|
||||
* 67 10236
|
||||
* 68 10266
|
||||
* 69 10319
|
||||
* 70 10541
|
||||
* 71 10567
|
||||
* 72 10601
|
||||
* 73 10903
|
||||
* 74 11030
|
||||
* 75 11107
|
||||
* 76 11139
|
||||
* 77 11172
|
||||
* 78 11176
|
||||
* 79 11188
|
||||
* 80 11228
|
||||
* 81 11244
|
||||
* 82 11410
|
||||
* 83 11589
|
||||
* 84 11822
|
||||
* 85 11874
|
||||
* 86 12042
|
||||
* 87 12129
|
||||
* 88 12134
|
||||
* 89 12160
|
||||
* 90 12293
|
||||
* 91 12347
|
||||
* 92 12381 0.6.x
|
||||
* 93 12648
|
||||
* 94 12816
|
||||
* 95 12924
|
||||
* 96 13226
|
||||
* 97 13256
|
||||
* 98 13375
|
||||
* 99 13838
|
||||
* 100 13952
|
||||
* 101 14233
|
||||
* 102 14332
|
||||
* 103 14598
|
||||
* 104 14735
|
||||
* 105 14803
|
||||
* 106 14919
|
||||
* 107 15027
|
||||
* 108 15045
|
||||
* 109 15075
|
||||
* 110 15148
|
||||
* 111 15190
|
||||
* 112 15290
|
||||
* 113 15340
|
||||
* 114 15601
|
||||
* 115 15695
|
||||
* 116 15893 0.7.x
|
||||
* 117 16037
|
||||
* 118 16129
|
||||
* 119 16242
|
||||
* 120 16439
|
||||
* 121 16694
|
||||
* 122 16855
|
||||
* 123 16909
|
||||
* 124 16993
|
||||
* 125 17113
|
||||
* 126 17433
|
||||
* 127 17439
|
||||
* 128 18281
|
||||
* 129 18292
|
||||
* 130 18404
|
||||
* 131 18481
|
||||
* 132 18522
|
||||
* 133 18674
|
||||
* 134 18703
|
||||
* 135 18719
|
||||
* 136 18764
|
||||
* 137 18912
|
||||
* 138 18942 1.0.x
|
||||
* 139 19346
|
||||
* 140 19382
|
||||
* 141 19799
|
||||
* 142 20003
|
||||
* 143 20048
|
||||
* 144 20334
|
||||
* 145 20376
|
||||
* 146 20446
|
||||
* 147 20621
|
||||
* 148 20659
|
||||
* 149 20832
|
||||
* 150 20857
|
||||
* 151 20918
|
||||
* 152 21171
|
||||
* 153 21263
|
||||
* 154 21426
|
||||
* 155 21453
|
||||
* 156 21728
|
||||
* 157 21862
|
||||
* 158 21933
|
||||
* 159 21962
|
||||
* 160 21974 1.1.x
|
||||
* 161 22567
|
||||
* 162 22713
|
||||
* 163 22767
|
||||
* 164 23290
|
||||
* 165 23304
|
||||
* 166 23415
|
||||
* 167 23504
|
||||
* 168 23637
|
||||
* 169 23816
|
||||
* 170 23826
|
||||
* 171 23835
|
||||
* 172 23947
|
||||
* 173 23967 1.2.0-RC1
|
||||
* 174 23973 1.2.x
|
||||
* 175 24136
|
||||
* 176 24446
|
||||
* 177 24619
|
||||
* 178 24789
|
||||
* 179 24810
|
||||
* 180 24998 1.3.x
|
||||
* 181 25012
|
||||
* 182 25296
|
||||
* 183 25363
|
||||
* 184 25508
|
||||
* 185 25620
|
||||
* 186 25833
|
||||
* 187 25899
|
||||
* 188 26169 1.4.x
|
||||
* 189 26450
|
||||
* 190 26547
|
||||
* 191 26646
|
||||
* 192 26700
|
||||
* 193 26802
|
||||
* 194 26881 1.5.x, 1.6.0
|
||||
* 195 27572 1.6.x
|
||||
* 196 27778 1.7.x
|
||||
* 197 27978 1.8.x
|
||||
* 198
|
||||
* 199
|
||||
* 200 #6805 Extend railtypes to 64, adding uint16 to map array.
|
||||
* 201 #6885 Extend NewGRF persistant storages.
|
||||
* 202 #6867 Increase industry cargo slots to 16 in, 16 out
|
||||
* 203 #7072 Add path cache for ships
|
||||
* 204 #7065 Add extra rotation stages for ships.
|
||||
* 205 #7108 Livery storage change and group liveries.
|
||||
*/
|
||||
extern const uint16 SAVEGAME_VERSION = 205; ///< Current savegame version of OpenTTD.
|
||||
extern const uint16 SAVEGAME_VERSION = SL_MAX_VERSION - 1; ///< Current savegame version of OpenTTD.
|
||||
|
||||
SavegameType _savegame_type; ///< type of savegame we are loading
|
||||
FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop.
|
||||
|
@ -820,7 +597,7 @@ static inline byte SlCalcConvFileLen(VarType conv)
|
|||
/** Return the size in bytes of a reference (pointer) */
|
||||
static inline size_t SlCalcRefLen()
|
||||
{
|
||||
return IsSavegameVersionBefore(69) ? 2 : 4;
|
||||
return IsSavegameVersionBefore(SLV_69) ? 2 : 4;
|
||||
}
|
||||
|
||||
void SlSetArrayIndex(uint index)
|
||||
|
@ -1161,7 +938,7 @@ static void SlString(void *ptr, size_t length, VarType conv)
|
|||
StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK;
|
||||
if ((conv & SLF_ALLOW_CONTROL) != 0) {
|
||||
settings = settings | SVS_ALLOW_CONTROL_CODE;
|
||||
if (IsSavegameVersionBefore(169)) {
|
||||
if (IsSavegameVersionBefore(SLV_169)) {
|
||||
str_fix_scc_encoded((char *)ptr, (char *)ptr + len);
|
||||
}
|
||||
}
|
||||
|
@ -1289,7 +1066,7 @@ static void *IntToReference(size_t index, SLRefType rt)
|
|||
|
||||
/* After version 4.3 REF_VEHICLE_OLD is saved as REF_VEHICLE,
|
||||
* and should be loaded like that */
|
||||
if (rt == REF_VEHICLE_OLD && !IsSavegameVersionBefore(4, 4)) {
|
||||
if (rt == REF_VEHICLE_OLD && !IsSavegameVersionBefore(SLV_4, 4)) {
|
||||
rt = REF_VEHICLE;
|
||||
}
|
||||
|
||||
|
@ -1308,7 +1085,7 @@ static void *IntToReference(size_t index, SLRefType rt)
|
|||
case REF_ORDER:
|
||||
if (Order::IsValidID(index)) return Order::Get(index);
|
||||
/* in old versions, invalid order was used to mark end of order list */
|
||||
if (IsSavegameVersionBefore(5, 2)) return NULL;
|
||||
if (IsSavegameVersionBefore(SLV_5, 2)) return NULL;
|
||||
SlErrorCorrupt("Referencing invalid Order");
|
||||
|
||||
case REF_VEHICLE_OLD:
|
||||
|
@ -1360,7 +1137,7 @@ static inline size_t SlCalcListLen(const void *list)
|
|||
{
|
||||
const std::list<void *> *l = (const std::list<void *> *) list;
|
||||
|
||||
int type_size = IsSavegameVersionBefore(69) ? 2 : 4;
|
||||
int type_size = IsSavegameVersionBefore(SLV_69) ? 2 : 4;
|
||||
/* Each entry is saved as type_size bytes, plus type_size bytes are used for the length
|
||||
* of the list */
|
||||
return l->size() * type_size + type_size;
|
||||
|
@ -1397,11 +1174,11 @@ static void SlList(void *list, SLRefType conv)
|
|||
}
|
||||
case SLA_LOAD_CHECK:
|
||||
case SLA_LOAD: {
|
||||
size_t length = IsSavegameVersionBefore(69) ? SlReadUint16() : SlReadUint32();
|
||||
size_t length = IsSavegameVersionBefore(SLV_69) ? SlReadUint16() : SlReadUint32();
|
||||
|
||||
/* Load each reference and push to the end of the list */
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
size_t data = IsSavegameVersionBefore(69) ? SlReadUint16() : SlReadUint32();
|
||||
size_t data = IsSavegameVersionBefore(SLV_69) ? SlReadUint16() : SlReadUint32();
|
||||
l->push_back((void *)data);
|
||||
}
|
||||
break;
|
||||
|
@ -1692,7 +1469,7 @@ bool SlObjectMember(void *ptr, const SaveLoad *sld)
|
|||
break;
|
||||
case SLA_LOAD_CHECK:
|
||||
case SLA_LOAD:
|
||||
*(size_t *)ptr = IsSavegameVersionBefore(69) ? SlReadUint16() : SlReadUint32();
|
||||
*(size_t *)ptr = IsSavegameVersionBefore(SLV_69) ? SlReadUint16() : SlReadUint32();
|
||||
break;
|
||||
case SLA_PTRS:
|
||||
*(void **)ptr = IntToReference(*(size_t *)ptr, (SLRefType)conv);
|
||||
|
@ -2838,7 +2615,7 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
|
|||
|
||||
GamelogReset();
|
||||
|
||||
if (IsSavegameVersionBefore(4)) {
|
||||
if (IsSavegameVersionBefore(SLV_4)) {
|
||||
/*
|
||||
* NewGRFs were introduced between 0.3,4 and 0.3.5, which both
|
||||
* shared savegame version 4. Anything before that 'obviously'
|
||||
|
|
|
@ -15,6 +15,284 @@
|
|||
#include "../fileio_type.h"
|
||||
#include "../strings_type.h"
|
||||
|
||||
/** SaveLoad versions
|
||||
* Previous savegame versions, the trunk revision where they were
|
||||
* introduced and the released version that had that particular
|
||||
* savegame version.
|
||||
* Up to savegame version 18 there is a minor version as well.
|
||||
*
|
||||
* Older entries keep their original numbering.
|
||||
*
|
||||
* Newer entries should use a descriptive labels, numeric version
|
||||
* and PR can be added to comment.
|
||||
*
|
||||
* Note that this list must not be reordered.
|
||||
*/
|
||||
enum SaveLoadVersion : uint16 {
|
||||
SL_MIN_VERSION, ///< First savegame version
|
||||
|
||||
SLV_1, ///< 1.0 0.1.x, 0.2.x
|
||||
SLV_2, /**< 2.0 0.3.0
|
||||
* 2.1 0.3.1, 0.3.2 */
|
||||
SLV_3, ///< 3.x lost
|
||||
SLV_4, /**< 4.0 1
|
||||
* 4.1 122 0.3.3, 0.3.4
|
||||
* 4.2 1222 0.3.5
|
||||
* 4.3 1417
|
||||
* 4.4 1426 */
|
||||
|
||||
SLV_5, /**< 5.0 1429
|
||||
* 5.1 1440
|
||||
* 5.2 1525 0.3.6 */
|
||||
SLV_6, /**< 6.0 1721
|
||||
* 6.1 1768 */
|
||||
SLV_7, ///< 7.0 1770
|
||||
SLV_8, ///< 8.0 1786
|
||||
SLV_9, ///< 9.0 1909
|
||||
|
||||
SLV_10, ///< 10.0 2030
|
||||
SLV_11, /**< 11.0 2033
|
||||
* 11.1 2041 */
|
||||
SLV_12, ///< 12.1 2046
|
||||
SLV_13, ///< 13.1 2080 0.4.0, 0.4.0.1
|
||||
SLV_14, ///< 14.0 2441
|
||||
|
||||
SLV_15, ///< 15.0 2499
|
||||
SLV_16, /**< 16.0 2817
|
||||
* 16.1 3155 */
|
||||
SLV_17, /**< 17.0 3212
|
||||
* 17.1 3218 */
|
||||
SLV_18, ///< 18 3227
|
||||
SLV_19, ///< 19 3396
|
||||
|
||||
SLV_20, ///< 20 3403
|
||||
SLV_21, ///< 21 3472 0.4.x
|
||||
SLV_22, ///< 22 3726
|
||||
SLV_23, ///< 23 3915
|
||||
SLV_24, ///< 24 4150
|
||||
|
||||
SLV_25, ///< 25 4259
|
||||
SLV_26, ///< 26 4466
|
||||
SLV_27, ///< 27 4757
|
||||
SLV_28, ///< 28 4987
|
||||
SLV_29, ///< 29 5070
|
||||
|
||||
SLV_30, ///< 30 5946
|
||||
SLV_31, ///< 31 5999
|
||||
SLV_32, ///< 32 6001
|
||||
SLV_33, ///< 33 6440
|
||||
SLV_34, ///< 34 6455
|
||||
|
||||
SLV_35, ///< 35 6602
|
||||
SLV_36, ///< 36 6624
|
||||
SLV_37, ///< 37 7182
|
||||
SLV_38, ///< 38 7195
|
||||
SLV_39, ///< 39 7269
|
||||
|
||||
SLV_40, ///< 40 7326
|
||||
SLV_41, ///< 41 7348 0.5.x
|
||||
SLV_42, ///< 42 7573
|
||||
SLV_43, ///< 43 7642
|
||||
SLV_44, ///< 44 8144
|
||||
|
||||
SLV_45, ///< 45 8501
|
||||
SLV_46, ///< 46 8705
|
||||
SLV_47, ///< 47 8735
|
||||
SLV_48, ///< 48 8935
|
||||
SLV_49, ///< 49 8969
|
||||
|
||||
SLV_50, ///< 50 8973
|
||||
SLV_51, ///< 51 8978
|
||||
SLV_52, ///< 52 9066
|
||||
SLV_53, ///< 53 9316
|
||||
SLV_54, ///< 54 9613
|
||||
|
||||
SLV_55, ///< 55 9638
|
||||
SLV_56, ///< 56 9667
|
||||
SLV_57, ///< 57 9691
|
||||
SLV_58, ///< 58 9762
|
||||
SLV_59, ///< 59 9779
|
||||
|
||||
SLV_60, ///< 60 9874
|
||||
SLV_61, ///< 61 9892
|
||||
SLV_62, ///< 62 9905
|
||||
SLV_63, ///< 63 9956
|
||||
SLV_64, ///< 64 10006
|
||||
|
||||
SLV_65, ///< 65 10210
|
||||
SLV_66, ///< 66 10211
|
||||
SLV_67, ///< 67 10236
|
||||
SLV_68, ///< 68 10266
|
||||
SLV_69, ///< 69 10319
|
||||
|
||||
SLV_70, ///< 70 10541
|
||||
SLV_71, ///< 71 10567
|
||||
SLV_72, ///< 72 10601
|
||||
SLV_73, ///< 73 10903
|
||||
SLV_74, ///< 74 11030
|
||||
|
||||
SLV_75, ///< 75 11107
|
||||
SLV_76, ///< 76 11139
|
||||
SLV_77, ///< 77 11172
|
||||
SLV_78, ///< 78 11176
|
||||
SLV_79, ///< 79 11188
|
||||
|
||||
SLV_80, ///< 80 11228
|
||||
SLV_81, ///< 81 11244
|
||||
SLV_82, ///< 82 11410
|
||||
SLV_83, ///< 83 11589
|
||||
SLV_84, ///< 84 11822
|
||||
|
||||
SLV_85, ///< 85 11874
|
||||
SLV_86, ///< 86 12042
|
||||
SLV_87, ///< 87 12129
|
||||
SLV_88, ///< 88 12134
|
||||
SLV_89, ///< 89 12160
|
||||
|
||||
SLV_90, ///< 90 12293
|
||||
SLV_91, ///< 91 12347
|
||||
SLV_92, ///< 92 12381 0.6.x
|
||||
SLV_93, ///< 93 12648
|
||||
SLV_94, ///< 94 12816
|
||||
|
||||
SLV_95, ///< 95 12924
|
||||
SLV_96, ///< 96 13226
|
||||
SLV_97, ///< 97 13256
|
||||
SLV_98, ///< 98 13375
|
||||
SLV_99, ///< 99 13838
|
||||
|
||||
SLV_100, ///< 100 13952
|
||||
SLV_101, ///< 101 14233
|
||||
SLV_102, ///< 102 14332
|
||||
SLV_103, ///< 103 14598
|
||||
SLV_104, ///< 104 14735
|
||||
|
||||
SLV_105, ///< 105 14803
|
||||
SLV_106, ///< 106 14919
|
||||
SLV_107, ///< 107 15027
|
||||
SLV_108, ///< 108 15045
|
||||
SLV_109, ///< 109 15075
|
||||
|
||||
SLV_110, ///< 110 15148
|
||||
SLV_111, ///< 111 15190
|
||||
SLV_112, ///< 112 15290
|
||||
SLV_113, ///< 113 15340
|
||||
SLV_114, ///< 114 15601
|
||||
|
||||
SLV_115, ///< 115 15695
|
||||
SLV_116, ///< 116 15893 0.7.x
|
||||
SLV_117, ///< 117 16037
|
||||
SLV_118, ///< 118 16129
|
||||
SLV_119, ///< 119 16242
|
||||
|
||||
SLV_120, ///< 120 16439
|
||||
SLV_121, ///< 121 16694
|
||||
SLV_122, ///< 122 16855
|
||||
SLV_123, ///< 123 16909
|
||||
SLV_124, ///< 124 16993
|
||||
|
||||
SLV_125, ///< 125 17113
|
||||
SLV_126, ///< 126 17433
|
||||
SLV_127, ///< 127 17439
|
||||
SLV_128, ///< 128 18281
|
||||
SLV_129, ///< 129 18292
|
||||
|
||||
SLV_130, ///< 130 18404
|
||||
SLV_131, ///< 131 18481
|
||||
SLV_132, ///< 132 18522
|
||||
SLV_133, ///< 133 18674
|
||||
SLV_134, ///< 134 18703
|
||||
|
||||
SLV_135, ///< 135 18719
|
||||
SLV_136, ///< 136 18764
|
||||
SLV_137, ///< 137 18912
|
||||
SLV_138, ///< 138 18942 1.0.x
|
||||
SLV_139, ///< 139 19346
|
||||
|
||||
SLV_140, ///< 140 19382
|
||||
SLV_141, ///< 141 19799
|
||||
SLV_142, ///< 142 20003
|
||||
SLV_143, ///< 143 20048
|
||||
SLV_144, ///< 144 20334
|
||||
|
||||
SLV_145, ///< 145 20376
|
||||
SLV_146, ///< 146 20446
|
||||
SLV_147, ///< 147 20621
|
||||
SLV_148, ///< 148 20659
|
||||
SLV_149, ///< 149 20832
|
||||
|
||||
SLV_150, ///< 150 20857
|
||||
SLV_151, ///< 151 20918
|
||||
SLV_152, ///< 152 21171
|
||||
SLV_153, ///< 153 21263
|
||||
SLV_154, ///< 154 21426
|
||||
|
||||
SLV_155, ///< 155 21453
|
||||
SLV_156, ///< 156 21728
|
||||
SLV_157, ///< 157 21862
|
||||
SLV_158, ///< 158 21933
|
||||
SLV_159, ///< 159 21962
|
||||
|
||||
SLV_160, ///< 160 21974 1.1.x
|
||||
SLV_161, ///< 161 22567
|
||||
SLV_162, ///< 162 22713
|
||||
SLV_163, ///< 163 22767
|
||||
SLV_164, ///< 164 23290
|
||||
|
||||
SLV_165, ///< 165 23304
|
||||
SLV_166, ///< 166 23415
|
||||
SLV_167, ///< 167 23504
|
||||
SLV_168, ///< 168 23637
|
||||
SLV_169, ///< 169 23816
|
||||
|
||||
SLV_170, ///< 170 23826
|
||||
SLV_171, ///< 171 23835
|
||||
SLV_172, ///< 172 23947
|
||||
SLV_173, ///< 173 23967 1.2.0-RC1
|
||||
SLV_174, ///< 174 23973 1.2.x
|
||||
|
||||
SLV_175, ///< 175 24136
|
||||
SLV_176, ///< 176 24446
|
||||
SLV_177, ///< 177 24619
|
||||
SLV_178, ///< 178 24789
|
||||
SLV_179, ///< 179 24810
|
||||
|
||||
SLV_180, ///< 180 24998 1.3.x
|
||||
SLV_181, ///< 181 25012
|
||||
SLV_182, ///< 182 25115 FS#5492, r25259, r25296 Goal status
|
||||
SLV_183, ///< 183 25363 Cargodist
|
||||
SLV_184, ///< 184 25508 Unit localisation split
|
||||
|
||||
SLV_185, ///< 185 25620 Storybooks
|
||||
SLV_186, ///< 186 25833 Objects storage
|
||||
SLV_187, ///< 187 25899 Linkgraph - restricted flows
|
||||
SLV_188, ///< 188 26169 FS#5831 Unify RV travel time
|
||||
SLV_189, ///< 189 26450 Heirarchical vehicle subgroups
|
||||
|
||||
SLV_190, ///< 190 26547 Separate order travel and wait times
|
||||
SLV_191, ///< 191 26636 FS#6026 Fix disaster vehicle storage (No bump)
|
||||
///< 191 26646 FS#6041 Linkgraph - store locations
|
||||
SLV_192, ///< 192 26700 FS#6066 Fix saving of order backups
|
||||
SLV_193, ///< 193 26802
|
||||
SLV_194, ///< 194 26881 v1.5
|
||||
|
||||
SLV_195, ///< 195 27572 v1.6.1
|
||||
SLV_196, ///< 196 27778 v1.7
|
||||
SLV_197, ///< 197 27978 v1.8
|
||||
SLV_198, ///< 198 PR#6763 Switch town growth rate and counter to actual game ticks
|
||||
SLV_199, ///< 199 PR#6802 Extend cargotypes to 64
|
||||
|
||||
SLV_200, ///< 200 PR#6805 Extend railtypes to 64, adding uint16 to map array.
|
||||
SLV_201, ///< 201 PR#6885 Extend NewGRF persistant storages.
|
||||
SLV_202, ///< 202 PR#6867 Increase industry cargo slots to 16 in, 16 out
|
||||
SLV_203, ///< 203 PR#7072 Add path cache for ships
|
||||
SLV_204, ///< 204 PR#7065 Add extra rotation stages for ships.
|
||||
|
||||
SLV_205, ///< 205 PR#7108 Livery storage change and group liveries.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
||||
/** Save or load result codes. */
|
||||
enum SaveOrLoadResult {
|
||||
SL_OK = 0, ///< completed successfully
|
||||
|
@ -92,9 +370,6 @@ enum SLRefType {
|
|||
REF_LINK_GRAPH_JOB = 11, ///< Load/save a reference to a link graph job.
|
||||
};
|
||||
|
||||
/** Highest possible savegame version. */
|
||||
#define SL_MAX_VERSION UINT16_MAX
|
||||
|
||||
/** Flags of a chunk. */
|
||||
enum ChunkType {
|
||||
CH_RIFF = 0,
|
||||
|
@ -211,8 +486,8 @@ struct SaveLoad {
|
|||
SaveLoadType cmd; ///< the action to take with the saved/loaded type, All types need different action
|
||||
VarType conv; ///< type of the variable to be saved, int
|
||||
uint16 length; ///< (conditional) length of the variable (eg. arrays) (max array size is 65536 elements)
|
||||
uint16 version_from; ///< save/load the variable starting from this savegame version
|
||||
uint16 version_to; ///< save/load the variable until this savegame version
|
||||
SaveLoadVersion version_from; ///< save/load the variable starting from this savegame version
|
||||
SaveLoadVersion version_to; ///< save/load the variable until this savegame version
|
||||
/* NOTE: This element either denotes the address of the variable for a global
|
||||
* variable, or the offset within a struct which is then bound to a variable
|
||||
* during runtime. Decision on which one to use is controlled by the function
|
||||
|
@ -304,7 +579,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param variable Name of the variable in the class or struct referenced by \a base.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, 0, SL_MAX_VERSION)
|
||||
#define SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a reference in every version of a savegame.
|
||||
|
@ -312,7 +587,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param variable Name of the variable in the class or struct referenced by \a base.
|
||||
* @param type Type of the reference, a value from #SLRefType.
|
||||
*/
|
||||
#define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, 0, SL_MAX_VERSION)
|
||||
#define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of an array in every version of a savegame.
|
||||
|
@ -321,7 +596,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param type Storage of the data in memory and in the savegame.
|
||||
* @param length Number of elements in the array.
|
||||
*/
|
||||
#define SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, 0, SL_MAX_VERSION)
|
||||
#define SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a string in every savegame version.
|
||||
|
@ -330,7 +605,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param type Storage of the data in memory and in the savegame.
|
||||
* @param length Number of elements in the string (only used for fixed size buffers).
|
||||
*/
|
||||
#define SLE_STR(base, variable, type, length) SLE_CONDSTR(base, variable, type, length, 0, SL_MAX_VERSION)
|
||||
#define SLE_STR(base, variable, type, length) SLE_CONDSTR(base, variable, type, length, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a list in every savegame version.
|
||||
|
@ -338,13 +613,13 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param variable Name of the variable in the class or struct referenced by \a base.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, 0, SL_MAX_VERSION)
|
||||
#define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Empty space in every savegame version.
|
||||
* @param length Length of the empty space.
|
||||
*/
|
||||
#define SLE_NULL(length) SLE_CONDNULL(length, 0, SL_MAX_VERSION)
|
||||
#define SLE_NULL(length) SLE_CONDNULL(length, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Empty space in some savegame versions.
|
||||
|
@ -355,13 +630,13 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
#define SLE_CONDNULL(length, from, to) SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to)
|
||||
|
||||
/** Translate values ingame to different values in the savegame and vv. */
|
||||
#define SLE_WRITEBYTE(base, variable) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, 0, 0)
|
||||
#define SLE_WRITEBYTE(base, variable) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
#define SLE_VEH_INCLUDE() {false, SL_VEH_INCLUDE, 0, 0, 0, SL_MAX_VERSION, NULL, 0}
|
||||
#define SLE_ST_INCLUDE() {false, SL_ST_INCLUDE, 0, 0, 0, SL_MAX_VERSION, NULL, 0}
|
||||
#define SLE_VEH_INCLUDE() {false, SL_VEH_INCLUDE, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, NULL, 0}
|
||||
#define SLE_ST_INCLUDE() {false, SL_ST_INCLUDE, 0, 0, SL_MIN_VERSION, SL_MAX_VERSION, NULL, 0}
|
||||
|
||||
/** End marker of a struct/class save or load. */
|
||||
#define SLE_END() {false, SL_END, 0, 0, 0, 0, NULL, 0}
|
||||
#define SLE_END() {false, SL_END, 0, 0, SL_MIN_VERSION, SL_MIN_VERSION, NULL, 0}
|
||||
|
||||
/**
|
||||
* Storage of global simple variables, references (pointers), and arrays.
|
||||
|
@ -426,35 +701,35 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param variable Name of the global variable.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLEG_VAR(variable, type) SLEG_CONDVAR(variable, type, 0, SL_MAX_VERSION)
|
||||
#define SLEG_VAR(variable, type) SLEG_CONDVAR(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a global reference in every savegame version.
|
||||
* @param variable Name of the global variable.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLEG_REF(variable, type) SLEG_CONDREF(variable, type, 0, SL_MAX_VERSION)
|
||||
#define SLEG_REF(variable, type) SLEG_CONDREF(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a global array in every savegame version.
|
||||
* @param variable Name of the global variable.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLEG_ARR(variable, type) SLEG_CONDARR(variable, type, lengthof(variable), 0, SL_MAX_VERSION)
|
||||
#define SLEG_ARR(variable, type) SLEG_CONDARR(variable, type, lengthof(variable), SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a global string in every savegame version.
|
||||
* @param variable Name of the global variable.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLEG_STR(variable, type) SLEG_CONDSTR(variable, type, sizeof(variable), 0, SL_MAX_VERSION)
|
||||
#define SLEG_STR(variable, type) SLEG_CONDSTR(variable, type, sizeof(variable), SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Storage of a global list in every savegame version.
|
||||
* @param variable Name of the global variable.
|
||||
* @param type Storage of the data in memory and in the savegame.
|
||||
*/
|
||||
#define SLEG_LST(variable, type) SLEG_CONDLST(variable, type, 0, SL_MAX_VERSION)
|
||||
#define SLEG_LST(variable, type) SLEG_CONDLST(variable, type, SL_MIN_VERSION, SL_MAX_VERSION)
|
||||
|
||||
/**
|
||||
* Empty global space in some savegame versions.
|
||||
|
@ -465,7 +740,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
#define SLEG_CONDNULL(length, from, to) {true, SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to, (void*)NULL}
|
||||
|
||||
/** End marker of global variables save or load. */
|
||||
#define SLEG_END() {true, SL_END, 0, 0, 0, 0, NULL, 0}
|
||||
#define SLEG_END() {true, SL_END, 0, 0, SL_MIN_VERSION, SL_MIN_VERSION, NULL, 0}
|
||||
|
||||
/**
|
||||
* Checks whether the savegame is below \a major.\a minor.
|
||||
|
@ -473,7 +748,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked.
|
||||
* @return Savegame version is earlier than the specified version.
|
||||
*/
|
||||
static inline bool IsSavegameVersionBefore(uint16 major, byte minor = 0)
|
||||
static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0)
|
||||
{
|
||||
extern uint16 _sl_version;
|
||||
extern byte _sl_minor_version;
|
||||
|
@ -487,7 +762,7 @@ static inline bool IsSavegameVersionBefore(uint16 major, byte minor = 0)
|
|||
* @param version_to Exclusive savegame version upper bound. SL_MAX_VERSION if no upper bound.
|
||||
* @return Active savegame version falls within the given range.
|
||||
*/
|
||||
static inline bool SlIsObjectCurrentlyValid(uint16 version_from, uint16 version_to)
|
||||
static inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
|
||||
{
|
||||
extern const uint16 SAVEGAME_VERSION;
|
||||
if (SAVEGAME_VERSION < version_from || SAVEGAME_VERSION >= version_to) return false;
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
|
||||
/** Description of a sign within the savegame. */
|
||||
static const SaveLoad _sign_desc[] = {
|
||||
SLE_CONDVAR(Sign, name, SLE_NAME, 0, 84),
|
||||
SLE_CONDSTR(Sign, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, x, SLE_FILE_I16 | SLE_VAR_I32, 0, 5),
|
||||
SLE_CONDVAR(Sign, y, SLE_FILE_I16 | SLE_VAR_I32, 0, 5),
|
||||
SLE_CONDVAR(Sign, x, SLE_INT32, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, y, SLE_INT32, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, owner, SLE_UINT8, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, z, SLE_FILE_U8 | SLE_VAR_I32, 0, 164),
|
||||
SLE_CONDVAR(Sign, z, SLE_INT32, 164, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, name, SLE_NAME, SL_MIN_VERSION, SLV_84),
|
||||
SLE_CONDSTR(Sign, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, x, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Sign, y, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Sign, x, SLE_INT32, SLV_5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, y, SLE_INT32, SLV_5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, owner, SLE_UINT8, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Sign, z, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_164),
|
||||
SLE_CONDVAR(Sign, z, SLE_INT32, SLV_164, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -55,12 +55,12 @@ static void Load_SIGN()
|
|||
* - we can't use IsValidCompany() now, so this is fixed in AfterLoadGame()
|
||||
* All signs that were saved are valid (including those with just 'Sign' and INVALID_OWNER).
|
||||
* - so set owner to OWNER_NONE if needed (signs from pre-version 6.1 would be lost) */
|
||||
if (IsSavegameVersionBefore(6, 1) || (IsSavegameVersionBefore(83) && si->owner == INVALID_OWNER)) {
|
||||
if (IsSavegameVersionBefore(SLV_6, 1) || (IsSavegameVersionBefore(SLV_83) && si->owner == INVALID_OWNER)) {
|
||||
si->owner = OWNER_NONE;
|
||||
}
|
||||
|
||||
/* Signs placed in scenario editor shall now be OWNER_DEITY */
|
||||
if (IsSavegameVersionBefore(171) && si->owner == OWNER_NONE && _file_to_saveload.abstract_ftype == FT_SCENARIO) {
|
||||
if (IsSavegameVersionBefore(SLV_171) && si->owner == OWNER_NONE && _file_to_saveload.abstract_ftype == FT_SCENARIO) {
|
||||
si->owner = OWNER_DEITY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,43 +150,43 @@ void AfterLoadRoadStops()
|
|||
|
||||
static const SaveLoad _roadstop_desc[] = {
|
||||
SLE_VAR(RoadStop, xy, SLE_UINT32),
|
||||
SLE_CONDNULL(1, 0, 45),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_45),
|
||||
SLE_VAR(RoadStop, status, SLE_UINT8),
|
||||
/* Index was saved in some versions, but this is not needed */
|
||||
SLE_CONDNULL(4, 0, 9),
|
||||
SLE_CONDNULL(2, 0, 45),
|
||||
SLE_CONDNULL(1, 0, 26),
|
||||
SLE_CONDNULL(4, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_45),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_26),
|
||||
|
||||
SLE_REF(RoadStop, next, REF_ROADSTOPS),
|
||||
SLE_CONDNULL(2, 0, 45),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_45),
|
||||
|
||||
SLE_CONDNULL(4, 0, 25),
|
||||
SLE_CONDNULL(1, 25, 26),
|
||||
SLE_CONDNULL(4, SL_MIN_VERSION, SLV_25),
|
||||
SLE_CONDNULL(1, SLV_25, SLV_26),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _old_station_desc[] = {
|
||||
SLE_CONDVAR(Station, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Station, xy, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, 0, 6), ///< bus/lorry tile
|
||||
SLE_CONDVAR(Station, train_station.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Station, train_station.tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, dock_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Station, dock_tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, xy, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Station, xy, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, SL_MIN_VERSION, SLV_6), ///< bus/lorry tile
|
||||
SLE_CONDVAR(Station, train_station.tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Station, train_station.tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, dock_tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Station, dock_tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_REF(Station, town, REF_TOWN),
|
||||
SLE_VAR(Station, train_station.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_CONDVAR(Station, train_station.h, SLE_FILE_U8 | SLE_VAR_U16, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, train_station.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(1, 0, 4), ///< alpha_order
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_4), ///< alpha_order
|
||||
|
||||
SLE_VAR(Station, string_id, SLE_STRINGID),
|
||||
SLE_CONDSTR(Station, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, indtype, SLE_UINT8, 103, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, had_vehicle_of_type, SLE_FILE_U16 | SLE_VAR_U8, 0, 122),
|
||||
SLE_CONDVAR(Station, had_vehicle_of_type, SLE_UINT8, 122, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Station, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, indtype, SLE_UINT8, SLV_103, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, had_vehicle_of_type, SLE_FILE_U16 | SLE_VAR_U8, SL_MIN_VERSION, SLV_122),
|
||||
SLE_CONDVAR(Station, had_vehicle_of_type, SLE_UINT8, SLV_122, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Station, time_since_load, SLE_UINT8),
|
||||
SLE_VAR(Station, time_since_unload, SLE_UINT8),
|
||||
|
@ -195,32 +195,32 @@ static const SaveLoad _old_station_desc[] = {
|
|||
SLE_VAR(Station, facilities, SLE_UINT8),
|
||||
SLE_VAR(Station, airport.type, SLE_UINT8),
|
||||
|
||||
SLE_CONDNULL(2, 0, 6), ///< Truck/bus stop status
|
||||
SLE_CONDNULL(1, 0, 5), ///< Blocked months
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_6), ///< Truck/bus stop status
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_5), ///< Blocked months
|
||||
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U16, 0, 3),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U32, 3, 46),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_UINT64, 46, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U16, SL_MIN_VERSION, SLV_3),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_VAR_U64 | SLE_FILE_U32, SLV_3, SLV_46),
|
||||
SLE_CONDVAR(Station, airport.flags, SLE_UINT64, SLV_46, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(2, 0, 26), ///< last-vehicle
|
||||
SLE_CONDVAR(Station, last_vehicle_type, SLE_UINT8, 26, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_26), ///< last-vehicle
|
||||
SLE_CONDVAR(Station, last_vehicle_type, SLE_UINT8, SLV_26, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(2, 3, 26), ///< custom station class and id
|
||||
SLE_CONDVAR(Station, build_date, SLE_FILE_U16 | SLE_VAR_I32, 3, 31),
|
||||
SLE_CONDVAR(Station, build_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SLV_3, SLV_26), ///< custom station class and id
|
||||
SLE_CONDVAR(Station, build_date, SLE_FILE_U16 | SLE_VAR_I32, SLV_3, SLV_31),
|
||||
SLE_CONDVAR(Station, build_date, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDREF(Station, bus_stops, REF_ROADSTOPS, 6, SL_MAX_VERSION),
|
||||
SLE_CONDREF(Station, truck_stops, REF_ROADSTOPS, 6, SL_MAX_VERSION),
|
||||
SLE_CONDREF(Station, bus_stops, REF_ROADSTOPS, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDREF(Station, truck_stops, REF_ROADSTOPS, SLV_6, SL_MAX_VERSION),
|
||||
|
||||
/* Used by newstations for graphic variations */
|
||||
SLE_CONDVAR(Station, random_bits, SLE_UINT16, 27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, waiting_triggers, SLE_UINT8, 27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, num_specs, SLE_UINT8, 27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, random_bits, SLE_UINT16, SLV_27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, waiting_triggers, SLE_UINT8, SLV_27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, num_specs, SLE_UINT8, SLV_27, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDLST(Station, loading_vehicles, REF_VEHICLE, 57, SL_MAX_VERSION),
|
||||
SLE_CONDLST(Station, loading_vehicles, REF_VEHICLE, SLV_57, SL_MAX_VERSION),
|
||||
|
||||
/* reserve extra space in savegame here. (currently 32 bytes) */
|
||||
SLE_CONDNULL(32, 2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(32, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -233,8 +233,8 @@ static uint8 _cargo_days;
|
|||
static Money _cargo_feeder_share;
|
||||
|
||||
static const SaveLoad _station_speclist_desc[] = {
|
||||
SLE_CONDVAR(StationSpecList, grfid, SLE_UINT32, 27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StationSpecList, localidx, SLE_UINT8, 27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StationSpecList, grfid, SLE_UINT32, SLV_27, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StationSpecList, localidx, SLE_UINT8, SLV_27, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -254,7 +254,7 @@ static const SaveLoad _flow_desc[] = {
|
|||
SLE_VAR(FlowSaveLoad, source, SLE_UINT16),
|
||||
SLE_VAR(FlowSaveLoad, via, SLE_UINT16),
|
||||
SLE_VAR(FlowSaveLoad, share, SLE_UINT32),
|
||||
SLE_CONDVAR(FlowSaveLoad, restricted, SLE_BOOL, 187, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(FlowSaveLoad, restricted, SLE_BOOL, SLV_187, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -266,27 +266,27 @@ static const SaveLoad _flow_desc[] = {
|
|||
const SaveLoad *GetGoodsDesc()
|
||||
{
|
||||
static const SaveLoad goods_desc[] = {
|
||||
SLEG_CONDVAR( _waiting_acceptance, SLE_UINT16, 0, 68),
|
||||
SLE_CONDVAR(GoodsEntry, status, SLE_UINT8, 68, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, 51, 68),
|
||||
SLEG_CONDVAR( _waiting_acceptance, SLE_UINT16, SL_MIN_VERSION, SLV_68),
|
||||
SLE_CONDVAR(GoodsEntry, status, SLE_UINT8, SLV_68, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SLV_51, SLV_68),
|
||||
SLE_VAR(GoodsEntry, time_since_pickup, SLE_UINT8),
|
||||
SLE_VAR(GoodsEntry, rating, SLE_UINT8),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, 0, 7),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_UINT16, 7, 68),
|
||||
SLEG_CONDVAR( _cargo_source_xy, SLE_UINT32, 44, 68),
|
||||
SLEG_CONDVAR( _cargo_days, SLE_UINT8, 0, 68),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_7),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_UINT16, SLV_7, SLV_68),
|
||||
SLEG_CONDVAR( _cargo_source_xy, SLE_UINT32, SLV_44, SLV_68),
|
||||
SLEG_CONDVAR( _cargo_days, SLE_UINT8, SL_MIN_VERSION, SLV_68),
|
||||
SLE_VAR(GoodsEntry, last_speed, SLE_UINT8),
|
||||
SLE_VAR(GoodsEntry, last_age, SLE_UINT8),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_U32 | SLE_VAR_I64, 14, 65),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, 65, 68),
|
||||
SLE_CONDVAR(GoodsEntry, amount_fract, SLE_UINT8, 150, SL_MAX_VERSION),
|
||||
SLEG_CONDLST( _packets, REF_CARGO_PACKET, 68, 183),
|
||||
SLEG_CONDVAR( _num_dests, SLE_UINT32, 183, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, cargo.reserved_count, SLE_UINT, 181, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, link_graph, SLE_UINT16, 183, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, node, SLE_UINT16, 183, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _num_flows, SLE_UINT32, 183, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, max_waiting_cargo, SLE_UINT32, 183, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_U32 | SLE_VAR_I64, SLV_14, SLV_65),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, SLV_65, SLV_68),
|
||||
SLE_CONDVAR(GoodsEntry, amount_fract, SLE_UINT8, SLV_150, SL_MAX_VERSION),
|
||||
SLEG_CONDLST( _packets, REF_CARGO_PACKET, SLV_68, SLV_183),
|
||||
SLEG_CONDVAR( _num_dests, SLE_UINT32, SLV_183, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, cargo.reserved_count, SLE_UINT, SLV_181, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, link_graph, SLE_UINT16, SLV_183, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, node, SLE_UINT16, SLV_183, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _num_flows, SLE_UINT32, SLV_183, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(GoodsEntry, max_waiting_cargo, SLE_UINT32, SLV_183, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
@ -329,7 +329,7 @@ static void Load_STNS()
|
|||
_cargo_days = 0;
|
||||
_cargo_feeder_share = 0;
|
||||
|
||||
uint num_cargo = IsSavegameVersionBefore(55) ? 12 : IsSavegameVersionBefore(199) ? 32 : NUM_CARGO;
|
||||
uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
|
||||
int index;
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
Station *st = new (index) Station();
|
||||
|
@ -342,11 +342,11 @@ static void Load_STNS()
|
|||
GoodsEntry *ge = &st->goods[i];
|
||||
SlObject(ge, GetGoodsDesc());
|
||||
SwapPackets(ge);
|
||||
if (IsSavegameVersionBefore(68)) {
|
||||
if (IsSavegameVersionBefore(SLV_68)) {
|
||||
SB(ge->status, GoodsEntry::GES_ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
|
||||
if (GB(_waiting_acceptance, 0, 12) != 0) {
|
||||
/* In old versions, enroute_from used 0xFF as INVALID_STATION */
|
||||
StationID source = (IsSavegameVersionBefore(7) && _cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
|
||||
StationID source = (IsSavegameVersionBefore(SLV_7) && _cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
|
||||
|
||||
/* Make sure we can allocate the CargoPacket. This is safe
|
||||
* as there can only be ~64k stations and 32 cargoes in these
|
||||
|
@ -375,12 +375,12 @@ static void Load_STNS()
|
|||
static void Ptrs_STNS()
|
||||
{
|
||||
/* Don't run when savegame version is higher than or equal to 123. */
|
||||
if (!IsSavegameVersionBefore(123)) return;
|
||||
if (!IsSavegameVersionBefore(SLV_123)) return;
|
||||
|
||||
uint num_cargo = IsSavegameVersionBefore(199) ? 32 : NUM_CARGO;
|
||||
uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) {
|
||||
if (!IsSavegameVersionBefore(68)) {
|
||||
if (!IsSavegameVersionBefore(SLV_68)) {
|
||||
for (CargoID i = 0; i < num_cargo; i++) {
|
||||
GoodsEntry *ge = &st->goods[i];
|
||||
SwapPackets(ge);
|
||||
|
@ -425,14 +425,14 @@ static const SaveLoad _station_desc[] = {
|
|||
SLE_REF(Station, truck_stops, REF_ROADSTOPS),
|
||||
SLE_VAR(Station, dock_tile, SLE_UINT32),
|
||||
SLE_VAR(Station, airport.tile, SLE_UINT32),
|
||||
SLE_CONDVAR(Station, airport.w, SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.h, SLE_FILE_U8 | SLE_VAR_U16, 140, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.w, SLE_FILE_U8 | SLE_VAR_U16, SLV_140, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_140, SL_MAX_VERSION),
|
||||
SLE_VAR(Station, airport.type, SLE_UINT8),
|
||||
SLE_CONDVAR(Station, airport.layout, SLE_UINT8, 145, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.layout, SLE_UINT8, SLV_145, SL_MAX_VERSION),
|
||||
SLE_VAR(Station, airport.flags, SLE_UINT64),
|
||||
SLE_CONDVAR(Station, airport.rotation, SLE_UINT8, 145, SL_MAX_VERSION),
|
||||
SLEG_CONDARR(_old_st_persistent_storage.storage, SLE_UINT32, 16, 145, 161),
|
||||
SLE_CONDREF(Station, airport.psa, REF_STORAGE, 161, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, airport.rotation, SLE_UINT8, SLV_145, SL_MAX_VERSION),
|
||||
SLEG_CONDARR(_old_st_persistent_storage.storage, SLE_UINT32, 16, SLV_145, SLV_161),
|
||||
SLE_CONDREF(Station, airport.psa, REF_STORAGE, SLV_161, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Station, indtype, SLE_UINT8),
|
||||
|
||||
|
@ -441,8 +441,8 @@ static const SaveLoad _station_desc[] = {
|
|||
SLE_VAR(Station, last_vehicle_type, SLE_UINT8),
|
||||
SLE_VAR(Station, had_vehicle_of_type, SLE_UINT8),
|
||||
SLE_LST(Station, loading_vehicles, REF_VEHICLE),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_FILE_U32 | SLE_VAR_U64, 127, 199),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_UINT64, 199, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_FILE_U32 | SLE_VAR_U64, SLV_127, SLV_199),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_UINT64, SLV_199, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -453,9 +453,9 @@ static const SaveLoad _waypoint_desc[] = {
|
|||
|
||||
SLE_VAR(Waypoint, town_cn, SLE_UINT16),
|
||||
|
||||
SLE_CONDVAR(Waypoint, train_station.tile, SLE_UINT32, 124, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Waypoint, train_station.w, SLE_FILE_U8 | SLE_VAR_U16, 124, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Waypoint, train_station.h, SLE_FILE_U8 | SLE_VAR_U16, 124, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Waypoint, train_station.tile, SLE_UINT32, SLV_124, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Waypoint, train_station.w, SLE_FILE_U8 | SLE_VAR_U16, SLV_124, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Waypoint, train_station.h, SLE_FILE_U8 | SLE_VAR_U16, SLV_124, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -522,7 +522,7 @@ static void Load_STNN()
|
|||
{
|
||||
_num_flows = 0;
|
||||
|
||||
uint num_cargo = IsSavegameVersionBefore(199) ? 32 : NUM_CARGO;
|
||||
uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
|
||||
int index;
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
bool waypoint = (SlReadByte() & FACIL_WAYPOINT) != 0;
|
||||
|
@ -534,7 +534,7 @@ static void Load_STNN()
|
|||
Station *st = Station::From(bst);
|
||||
|
||||
/* Before savegame version 161, persistent storages were not stored in a pool. */
|
||||
if (IsSavegameVersionBefore(161) && !IsSavegameVersionBefore(145) && st->facilities & FACIL_AIRPORT) {
|
||||
if (IsSavegameVersionBefore(SLV_161) && !IsSavegameVersionBefore(SLV_145) && st->facilities & FACIL_AIRPORT) {
|
||||
/* Store the old persistent storage. The GRFID will be added later. */
|
||||
assert(PersistentStorage::CanAllocateItem());
|
||||
st->airport.psa = new PersistentStorage(0, 0, 0);
|
||||
|
@ -555,7 +555,7 @@ static void Load_STNN()
|
|||
}
|
||||
prev_source = flow.source;
|
||||
}
|
||||
if (IsSavegameVersionBefore(183)) {
|
||||
if (IsSavegameVersionBefore(SLV_183)) {
|
||||
SwapPackets(&st->goods[i]);
|
||||
} else {
|
||||
StationCargoPair pair;
|
||||
|
@ -581,14 +581,14 @@ static void Load_STNN()
|
|||
static void Ptrs_STNN()
|
||||
{
|
||||
/* Don't run when savegame version lower than 123. */
|
||||
if (IsSavegameVersionBefore(123)) return;
|
||||
if (IsSavegameVersionBefore(SLV_123)) return;
|
||||
|
||||
uint num_cargo = IsSavegameVersionBefore(199) ? 32 : NUM_CARGO;
|
||||
uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) {
|
||||
for (CargoID i = 0; i < num_cargo; i++) {
|
||||
GoodsEntry *ge = &st->goods[i];
|
||||
if (IsSavegameVersionBefore(183)) {
|
||||
if (IsSavegameVersionBefore(SLV_183)) {
|
||||
SwapPackets(ge);
|
||||
SlObject(ge, GetGoodsDesc());
|
||||
SwapPackets(ge);
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
/** Description of the data to save and load in #PersistentStorage. */
|
||||
static const SaveLoad _storage_desc[] = {
|
||||
SLE_CONDVAR(PersistentStorage, grfid, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDARR(PersistentStorage, storage, SLE_UINT32, 16, 161, 201),
|
||||
SLE_CONDARR(PersistentStorage, storage, SLE_UINT32, 256, 201, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(PersistentStorage, grfid, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDARR(PersistentStorage, storage, SLE_UINT32, 16, SLV_161, SLV_201),
|
||||
SLE_CONDARR(PersistentStorage, storage, SLE_UINT32, 256, SLV_201, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/** Called after load to trash broken pages. */
|
||||
void AfterLoadStoryBook()
|
||||
{
|
||||
if (IsSavegameVersionBefore(185)) {
|
||||
if (IsSavegameVersionBefore(SLV_185)) {
|
||||
/* Trash all story pages and page elements because
|
||||
* they were saved with wrong data types.
|
||||
*/
|
||||
|
@ -29,11 +29,11 @@ void AfterLoadStoryBook()
|
|||
}
|
||||
|
||||
static const SaveLoad _story_page_elements_desc[] = {
|
||||
SLE_CONDVAR(StoryPageElement, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 185),
|
||||
SLE_CONDVAR(StoryPageElement, sort_value, SLE_UINT32, 185, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StoryPageElement, sort_value, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_185),
|
||||
SLE_CONDVAR(StoryPageElement, sort_value, SLE_UINT32, SLV_185, SL_MAX_VERSION),
|
||||
SLE_VAR(StoryPageElement, page, SLE_UINT16),
|
||||
SLE_CONDVAR(StoryPageElement, type, SLE_FILE_U16 | SLE_VAR_U8, 0, 185),
|
||||
SLE_CONDVAR(StoryPageElement, type, SLE_UINT8, 185, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StoryPageElement, type, SLE_FILE_U16 | SLE_VAR_U8, SL_MIN_VERSION, SLV_185),
|
||||
SLE_CONDVAR(StoryPageElement, type, SLE_UINT8, SLV_185, SL_MAX_VERSION),
|
||||
SLE_VAR(StoryPageElement, referenced_id, SLE_UINT32),
|
||||
SLE_STR(StoryPageElement, text, SLE_STR | SLF_ALLOW_CONTROL, 0),
|
||||
SLE_END()
|
||||
|
@ -66,11 +66,11 @@ static void Load_STORY_PAGE_ELEMENT()
|
|||
}
|
||||
|
||||
static const SaveLoad _story_pages_desc[] = {
|
||||
SLE_CONDVAR(StoryPage, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 185),
|
||||
SLE_CONDVAR(StoryPage, sort_value, SLE_UINT32, 185, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StoryPage, sort_value, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_185),
|
||||
SLE_CONDVAR(StoryPage, sort_value, SLE_UINT32, SLV_185, SL_MAX_VERSION),
|
||||
SLE_VAR(StoryPage, date, SLE_UINT32),
|
||||
SLE_CONDVAR(StoryPage, company, SLE_FILE_U16 | SLE_VAR_U8, 0, 185),
|
||||
SLE_CONDVAR(StoryPage, company, SLE_UINT8, 185, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(StoryPage, company, SLE_FILE_U16 | SLE_VAR_U8, SL_MIN_VERSION, SLV_185),
|
||||
SLE_CONDVAR(StoryPage, company, SLE_UINT8, SLV_185, SL_MAX_VERSION),
|
||||
SLE_STR(StoryPage, title, SLE_STR | SLF_ALLOW_CONTROL, 0),
|
||||
SLE_END()
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ char *CopyFromOldName(StringID id)
|
|||
/* Is this name an (old) custom name? */
|
||||
if (GetStringTab(id) != TEXT_TAB_OLD_CUSTOM) return NULL;
|
||||
|
||||
if (IsSavegameVersionBefore(37)) {
|
||||
if (IsSavegameVersionBefore(SLV_37)) {
|
||||
/* Allow for expansion when converted to UTF-8. */
|
||||
char tmp[LEN_OLD_STRINGS * MAX_CHAR_LENGTH];
|
||||
uint offs = _savegame_type == SGT_TTO ? LEN_OLD_STRINGS_TTO * GB(id, 0, 8) : LEN_OLD_STRINGS * GB(id, 0, 9);
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
static const SaveLoad _subsidies_desc[] = {
|
||||
SLE_VAR(Subsidy, cargo_type, SLE_UINT8),
|
||||
SLE_VAR(Subsidy, remaining, SLE_UINT8),
|
||||
SLE_CONDVAR(Subsidy, awarded, SLE_UINT8, 125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, src_type, SLE_UINT8, 125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, dst_type, SLE_UINT8, 125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, src, SLE_FILE_U8 | SLE_VAR_U16, 0, 5),
|
||||
SLE_CONDVAR(Subsidy, src, SLE_UINT16, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, dst, SLE_FILE_U8 | SLE_VAR_U16, 0, 5),
|
||||
SLE_CONDVAR(Subsidy, dst, SLE_UINT16, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, awarded, SLE_UINT8, SLV_125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, src_type, SLE_UINT8, SLV_125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, dst_type, SLE_UINT8, SLV_125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, src, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Subsidy, src, SLE_UINT16, SLV_5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Subsidy, dst, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Subsidy, dst, SLE_UINT16, SLV_5, SL_MAX_VERSION),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
|
|
|
@ -116,105 +116,105 @@ void UpdateHousesAndTowns()
|
|||
|
||||
/** Save and load of towns. */
|
||||
static const SaveLoad _town_desc[] = {
|
||||
SLE_CONDVAR(Town, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Town, xy, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, xy, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Town, xy, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(2, 0, 3), ///< population, no longer in use
|
||||
SLE_CONDNULL(4, 3, 85), ///< population, no longer in use
|
||||
SLE_CONDNULL(2, 0, 92), ///< num_houses, no longer in use
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_3), ///< population, no longer in use
|
||||
SLE_CONDNULL(4, SLV_3, SLV_85), ///< population, no longer in use
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_92), ///< num_houses, no longer in use
|
||||
|
||||
SLE_CONDVAR(Town, townnamegrfid, SLE_UINT32, 66, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, townnamegrfid, SLE_UINT32, SLV_66, SL_MAX_VERSION),
|
||||
SLE_VAR(Town, townnametype, SLE_UINT16),
|
||||
SLE_VAR(Town, townnameparts, SLE_UINT32),
|
||||
SLE_CONDSTR(Town, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Town, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Town, flags, SLE_UINT8),
|
||||
SLE_CONDVAR(Town, statues, SLE_FILE_U8 | SLE_VAR_U16, 0, 104),
|
||||
SLE_CONDVAR(Town, statues, SLE_UINT16, 104, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, statues, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
|
||||
SLE_CONDVAR(Town, statues, SLE_UINT16, SLV_104, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(1, 0, 2), ///< sort_index, no longer in use
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_2), ///< sort_index, no longer in use
|
||||
|
||||
SLE_CONDVAR(Town, have_ratings, SLE_FILE_U8 | SLE_VAR_U16, 0, 104),
|
||||
SLE_CONDVAR(Town, have_ratings, SLE_UINT16, 104, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Town, ratings, SLE_INT16, 8, 0, 104),
|
||||
SLE_CONDARR(Town, ratings, SLE_INT16, MAX_COMPANIES, 104, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, have_ratings, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_104),
|
||||
SLE_CONDVAR(Town, have_ratings, SLE_UINT16, SLV_104, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Town, ratings, SLE_INT16, 8, SL_MIN_VERSION, SLV_104),
|
||||
SLE_CONDARR(Town, ratings, SLE_INT16, MAX_COMPANIES, SLV_104, SL_MAX_VERSION),
|
||||
/* failed bribe attempts are stored since savegame format 4 */
|
||||
SLE_CONDARR(Town, unwanted, SLE_INT8, 8, 4, 104),
|
||||
SLE_CONDARR(Town, unwanted, SLE_INT8, MAX_COMPANIES, 104, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Town, unwanted, SLE_INT8, 8, SLV_4, SLV_104),
|
||||
SLE_CONDARR(Town, unwanted, SLE_INT8, MAX_COMPANIES, SLV_104, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_max, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_max, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_max, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_max, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_act, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_act, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_act, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_act, SLE_FILE_U16 | SLE_VAR_U32, 0, 9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_max, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_max, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_max, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_max, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_act, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_act, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_act, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_act, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_9),
|
||||
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_max, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_max, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_max, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_max, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_act, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_act, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_act, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_act, SLE_UINT32, 9, 165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_max, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_max, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_max, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_max, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].old_act, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].old_act, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_PASSENGERS].new_act, SLE_UINT32, SLV_9, SLV_165),
|
||||
SLE_CONDVAR(Town, supplied[CT_MAIL].new_act, SLE_UINT32, SLV_9, SLV_165),
|
||||
|
||||
SLE_CONDNULL(2, 0, 164), ///< pct_pass_transported / pct_mail_transported, now computed on the fly
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_164), ///< pct_pass_transported / pct_mail_transported, now computed on the fly
|
||||
|
||||
SLE_CONDVAR(Town, received[TE_FOOD].old_act, SLE_UINT16, 0, 165),
|
||||
SLE_CONDVAR(Town, received[TE_WATER].old_act, SLE_UINT16, 0, 165),
|
||||
SLE_CONDVAR(Town, received[TE_FOOD].new_act, SLE_UINT16, 0, 165),
|
||||
SLE_CONDVAR(Town, received[TE_WATER].new_act, SLE_UINT16, 0, 165),
|
||||
SLE_CONDVAR(Town, received[TE_FOOD].old_act, SLE_UINT16, SL_MIN_VERSION, SLV_165),
|
||||
SLE_CONDVAR(Town, received[TE_WATER].old_act, SLE_UINT16, SL_MIN_VERSION, SLV_165),
|
||||
SLE_CONDVAR(Town, received[TE_FOOD].new_act, SLE_UINT16, SL_MIN_VERSION, SLV_165),
|
||||
SLE_CONDVAR(Town, received[TE_WATER].new_act, SLE_UINT16, SL_MIN_VERSION, SLV_165),
|
||||
|
||||
SLE_CONDARR(Town, goal, SLE_UINT32, NUM_TE, 165, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Town, goal, SLE_UINT32, NUM_TE, SLV_165, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDSTR(Town, text, SLE_STR | SLF_ALLOW_CONTROL, 0, 168, SL_MAX_VERSION),
|
||||
SLE_CONDSTR(Town, text, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_168, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Town, time_until_rebuild, SLE_FILE_U8 | SLE_VAR_U16, 0, 54),
|
||||
SLE_CONDVAR(Town, grow_counter, SLE_FILE_U8 | SLE_VAR_U16, 0, 54),
|
||||
SLE_CONDVAR(Town, growth_rate, SLE_FILE_U8 | SLE_VAR_I16, 0, 54),
|
||||
SLE_CONDVAR(Town, time_until_rebuild, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_54),
|
||||
SLE_CONDVAR(Town, grow_counter, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_54),
|
||||
SLE_CONDVAR(Town, growth_rate, SLE_FILE_U8 | SLE_VAR_I16, SL_MIN_VERSION, SLV_54),
|
||||
|
||||
SLE_CONDVAR(Town, time_until_rebuild, SLE_UINT16, 54, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, grow_counter, SLE_UINT16, 54, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, time_until_rebuild, SLE_UINT16, SLV_54, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, grow_counter, SLE_UINT16, SLV_54, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Town, growth_rate, SLE_FILE_I16 | SLE_VAR_U16, 54, 165),
|
||||
SLE_CONDVAR(Town, growth_rate, SLE_UINT16, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, growth_rate, SLE_FILE_I16 | SLE_VAR_U16, SLV_54, SLV_165),
|
||||
SLE_CONDVAR(Town, growth_rate, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Town, fund_buildings_months, SLE_UINT8),
|
||||
SLE_VAR(Town, road_build_months, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Town, exclusivity, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, exclusive_counter, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, exclusivity, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, exclusive_counter, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Town, larger_town, SLE_BOOL, 56, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, layout, SLE_UINT8, 113, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, larger_town, SLE_BOOL, SLV_56, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, layout, SLE_UINT8, SLV_113, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDLST(Town, psa_list, REF_STORAGE, 161, SL_MAX_VERSION),
|
||||
SLE_CONDLST(Town, psa_list, REF_STORAGE, SLV_161, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Town, cargo_produced, SLE_FILE_U32 | SLE_VAR_U64, 166, 199),
|
||||
SLE_CONDVAR(Town, cargo_produced, SLE_UINT64, 199, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Town, cargo_produced, SLE_FILE_U32 | SLE_VAR_U64, SLV_166, SLV_199),
|
||||
SLE_CONDVAR(Town, cargo_produced, SLE_UINT64, SLV_199, SL_MAX_VERSION),
|
||||
|
||||
/* reserve extra space in savegame here. (currently 30 bytes) */
|
||||
SLE_CONDNULL(30, 2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(30, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _town_supplied_desc[] = {
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, old_max, SLE_UINT32, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, new_max, SLE_UINT32, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, old_act, SLE_UINT32, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, new_act, SLE_UINT32, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, old_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, new_max, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, old_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint32>, new_act, SLE_UINT32, SLV_165, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static const SaveLoad _town_received_desc[] = {
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, old_max, SLE_UINT16, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, new_max, SLE_UINT16, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, old_act, SLE_UINT16, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, new_act, SLE_UINT16, 165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, old_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, new_max, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, old_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(TransportedCargoStat<uint16>, new_act, SLE_UINT16, SLV_165, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -253,7 +253,7 @@ static void RealSave_Town(Town *t)
|
|||
SlObject(&t->received[i], _town_received_desc);
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(166)) return;
|
||||
if (IsSavegameVersionBefore(SLV_166)) return;
|
||||
|
||||
SlObject(&t->cargo_accepted, GetTileMatrixDesc());
|
||||
if (t->cargo_accepted.area.w != 0) {
|
||||
|
@ -275,7 +275,7 @@ static void Save_TOWN()
|
|||
static void Load_TOWN()
|
||||
{
|
||||
int index;
|
||||
uint num_cargo = IsSavegameVersionBefore(199) ? 32 : NUM_CARGO;
|
||||
uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
|
||||
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
Town *t = new (index) Town();
|
||||
|
@ -292,7 +292,7 @@ static void Load_TOWN()
|
|||
SlErrorCorrupt("Invalid town name generator");
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(166)) continue;
|
||||
if (IsSavegameVersionBefore(SLV_166)) continue;
|
||||
|
||||
SlObject(&t->cargo_accepted, GetTileMatrixDesc());
|
||||
if (t->cargo_accepted.area.w != 0) {
|
||||
|
@ -310,7 +310,7 @@ static void Load_TOWN()
|
|||
static void Ptrs_TOWN()
|
||||
{
|
||||
/* Don't run when savegame version lower than 161. */
|
||||
if (IsSavegameVersionBefore(161)) return;
|
||||
if (IsSavegameVersionBefore(SLV_161)) return;
|
||||
|
||||
Town *t;
|
||||
FOR_ALL_TOWNS(t) {
|
||||
|
|
|
@ -273,7 +273,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->orders.old != NULL) {
|
||||
if (IsSavegameVersionBefore(105)) { // Pre-105 didn't save an OrderList
|
||||
if (IsSavegameVersionBefore(SLV_105)) { // Pre-105 didn't save an OrderList
|
||||
if (mapping[v->orders.old] == NULL) {
|
||||
/* This adds the whole shared vehicle chain for case b */
|
||||
|
||||
|
@ -285,7 +285,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
} else {
|
||||
v->orders.list = mapping[v->orders.old];
|
||||
/* For old games (case a) we must create the shared vehicle chain */
|
||||
if (IsSavegameVersionBefore(5, 2)) {
|
||||
if (IsSavegameVersionBefore(SLV_5, 2)) {
|
||||
v->AddToShared(v->orders.list->GetFirstSharedVehicle());
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
|
||||
if (part_of_load) {
|
||||
if (IsSavegameVersionBefore(105)) {
|
||||
if (IsSavegameVersionBefore(SLV_105)) {
|
||||
/* Before 105 there was no order for shared orders, thus it messed up horribly */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->First() != v || v->orders.list != NULL || v->previous_shared != NULL || v->next_shared == NULL) continue;
|
||||
|
@ -322,7 +322,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(157)) {
|
||||
if (IsSavegameVersionBefore(SLV_157)) {
|
||||
/* The road vehicle subtype was converted to a flag. */
|
||||
RoadVehicle *rv;
|
||||
FOR_ALL_ROADVEHICLES(rv) {
|
||||
|
@ -339,7 +339,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(160)) {
|
||||
if (IsSavegameVersionBefore(SLV_160)) {
|
||||
/* In some old savegames there might be some "crap" stored. */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (!v->IsPrimaryVehicle() && v->type != VEH_DISASTER) {
|
||||
|
@ -349,14 +349,14 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(162)) {
|
||||
if (IsSavegameVersionBefore(SLV_162)) {
|
||||
/* Set the vehicle-local cargo age counter from the old global counter. */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
v->cargo_age_counter = _age_cargo_skip_counter;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(180)) {
|
||||
if (IsSavegameVersionBefore(SLV_180)) {
|
||||
/* Set service interval flags */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (!v->IsPrimaryVehicle()) continue;
|
||||
|
@ -369,7 +369,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(204)) {
|
||||
if (IsSavegameVersionBefore(SLV_204)) {
|
||||
/* Ship rotation added */
|
||||
Ship *s;
|
||||
FOR_ALL_SHIPS(s) {
|
||||
|
@ -416,7 +416,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
|
||||
/* Stop non-front engines */
|
||||
if (part_of_load && IsSavegameVersionBefore(112)) {
|
||||
if (part_of_load && IsSavegameVersionBefore(SLV_112)) {
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->type == VEH_TRAIN) {
|
||||
Train *t = Train::From(v);
|
||||
|
@ -429,7 +429,7 @@ void AfterLoadVehicles(bool part_of_load)
|
|||
}
|
||||
/* trains weren't stopping gradually in old OTTD versions (and TTO/TTD)
|
||||
* other vehicle types didn't have zero speed while stopped (even in 'recent' OTTD versions) */
|
||||
if ((v->vehstatus & VS_STOPPED) && (v->type != VEH_TRAIN || IsSavegameVersionBefore(2, 1))) {
|
||||
if ((v->vehstatus & VS_STOPPED) && (v->type != VEH_TRAIN || IsSavegameVersionBefore(SLV_2, 1))) {
|
||||
v->cur_speed = 0;
|
||||
}
|
||||
}
|
||||
|
@ -586,132 +586,132 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
SLE_VAR(Vehicle, subtype, SLE_UINT8),
|
||||
|
||||
SLE_REF(Vehicle, next, REF_VEHICLE_OLD),
|
||||
SLE_CONDVAR(Vehicle, name, SLE_NAME, 0, 84),
|
||||
SLE_CONDSTR(Vehicle, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, unitnumber, SLE_FILE_U8 | SLE_VAR_U16, 0, 8),
|
||||
SLE_CONDVAR(Vehicle, unitnumber, SLE_UINT16, 8, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, name, SLE_NAME, SL_MIN_VERSION, SLV_84),
|
||||
SLE_CONDSTR(Vehicle, name, SLE_STR | SLF_ALLOW_CONTROL, 0, SLV_84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, unitnumber, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_8),
|
||||
SLE_CONDVAR(Vehicle, unitnumber, SLE_UINT16, SLV_8, SL_MAX_VERSION),
|
||||
SLE_VAR(Vehicle, owner, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_FILE_U8 | SLE_VAR_I32, 0, 164),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_INT32, 164, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_164),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_INT32, SLV_164, SL_MAX_VERSION),
|
||||
SLE_VAR(Vehicle, direction, SLE_UINT8),
|
||||
|
||||
SLE_CONDNULL(2, 0, 58),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_58),
|
||||
SLE_VAR(Vehicle, spritenum, SLE_UINT8),
|
||||
SLE_CONDNULL(5, 0, 58),
|
||||
SLE_CONDNULL(5, SL_MIN_VERSION, SLV_58),
|
||||
SLE_VAR(Vehicle, engine_type, SLE_UINT16),
|
||||
|
||||
SLE_CONDNULL(2, 0, 152),
|
||||
SLE_CONDNULL(2, SL_MIN_VERSION, SLV_152),
|
||||
SLE_VAR(Vehicle, cur_speed, SLE_UINT16),
|
||||
SLE_VAR(Vehicle, subspeed, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, acceleration, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, progress, SLE_UINT8),
|
||||
|
||||
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, last_station_visited, SLE_FILE_U8 | SLE_VAR_U16, 0, 5),
|
||||
SLE_CONDVAR(Vehicle, last_station_visited, SLE_UINT16, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, last_loading_station, SLE_UINT16, 182, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, last_station_visited, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Vehicle, last_station_visited, SLE_UINT16, SLV_5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, last_loading_station, SLE_UINT16, SLV_182, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Vehicle, cargo_type, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, cargo_subtype, SLE_UINT8, 35, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_days, SLE_UINT8, 0, 68),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, 0, 7),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_UINT16, 7, 68),
|
||||
SLEG_CONDVAR( _cargo_source_xy, SLE_UINT32, 44, 68),
|
||||
SLE_CONDVAR(Vehicle, cargo_subtype, SLE_UINT8, SLV_35, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_days, SLE_UINT8, SL_MIN_VERSION, SLV_68),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_7),
|
||||
SLEG_CONDVAR( _cargo_source, SLE_UINT16, SLV_7, SLV_68),
|
||||
SLEG_CONDVAR( _cargo_source_xy, SLE_UINT32, SLV_44, SLV_68),
|
||||
SLE_VAR(Vehicle, cargo_cap, SLE_UINT16),
|
||||
SLE_CONDVAR(Vehicle, refit_cap, SLE_UINT16, 182, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_count, SLE_UINT16, 0, 68),
|
||||
SLE_CONDLST(Vehicle, cargo.packets, REF_CARGO_PACKET, 68, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Vehicle, cargo.action_counts, SLE_UINT, VehicleCargoList::NUM_MOVE_TO_ACTION, 181, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, cargo_age_counter, SLE_UINT16, 162, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, refit_cap, SLE_UINT16, SLV_182, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_count, SLE_UINT16, SL_MIN_VERSION, SLV_68),
|
||||
SLE_CONDLST(Vehicle, cargo.packets, REF_CARGO_PACKET, SLV_68, SL_MAX_VERSION),
|
||||
SLE_CONDARR(Vehicle, cargo.action_counts, SLE_UINT, VehicleCargoList::NUM_MOVE_TO_ACTION, SLV_181, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, cargo_age_counter, SLE_UINT16, SLV_162, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Vehicle, day_counter, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, tick_counter, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, running_ticks, SLE_UINT8, 88, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, running_ticks, SLE_UINT8, SLV_88, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Vehicle, cur_implicit_order_index, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, cur_real_order_index, SLE_UINT8, 158, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, cur_real_order_index, SLE_UINT8, SLV_158, SL_MAX_VERSION),
|
||||
/* num_orders is now part of OrderList and is not saved but counted */
|
||||
SLE_CONDNULL(1, 0, 105),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_105),
|
||||
|
||||
/* This next line is for version 4 and prior compatibility.. it temporarily reads
|
||||
type and flags (which were both 4 bits) into type. Later on this is
|
||||
converted correctly */
|
||||
SLE_CONDVAR(Vehicle, current_order.type, SLE_UINT8, 0, 5),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_FILE_U8 | SLE_VAR_U16, 0, 5),
|
||||
SLE_CONDVAR(Vehicle, current_order.type, SLE_UINT8, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
|
||||
|
||||
/* Orders for version 5 and on */
|
||||
SLE_CONDVAR(Vehicle, current_order.type, SLE_UINT8, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.flags, SLE_UINT8, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_UINT16, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.type, SLE_UINT8, SLV_5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.flags, SLE_UINT8, SLV_5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_UINT16, SLV_5, SL_MAX_VERSION),
|
||||
|
||||
/* Refit in current order */
|
||||
SLE_CONDVAR(Vehicle, current_order.refit_cargo, SLE_UINT8, 36, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, 36, 182), // refit_subtype
|
||||
SLE_CONDVAR(Vehicle, current_order.refit_cargo, SLE_UINT8, SLV_36, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(1, SLV_36, SLV_182), // refit_subtype
|
||||
|
||||
/* Timetable in current order */
|
||||
SLE_CONDVAR(Vehicle, current_order.wait_time, SLE_UINT16, 67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.travel_time, SLE_UINT16, 67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.max_speed, SLE_UINT16, 174, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, timetable_start, SLE_INT32, 129, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.wait_time, SLE_UINT16, SLV_67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.travel_time, SLE_UINT16, SLV_67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.max_speed, SLE_UINT16, SLV_174, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, timetable_start, SLE_INT32, SLV_129, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDREF(Vehicle, orders, REF_ORDER, 0, 105),
|
||||
SLE_CONDREF(Vehicle, orders, REF_ORDERLIST, 105, SL_MAX_VERSION),
|
||||
SLE_CONDREF(Vehicle, orders, REF_ORDER, SL_MIN_VERSION, SLV_105),
|
||||
SLE_CONDREF(Vehicle, orders, REF_ORDERLIST, SLV_105, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, max_age, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Vehicle, max_age, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, date_of_last_service, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Vehicle, date_of_last_service, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, service_interval, SLE_UINT16, 0, 31),
|
||||
SLE_CONDVAR(Vehicle, service_interval, SLE_FILE_U32 | SLE_VAR_U16, 31, 180),
|
||||
SLE_CONDVAR(Vehicle, service_interval, SLE_UINT16, 180, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, max_age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Vehicle, max_age, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, date_of_last_service, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Vehicle, date_of_last_service, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, service_interval, SLE_UINT16, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Vehicle, service_interval, SLE_FILE_U32 | SLE_VAR_U16, SLV_31, SLV_180),
|
||||
SLE_CONDVAR(Vehicle, service_interval, SLE_UINT16, SLV_180, SL_MAX_VERSION),
|
||||
SLE_VAR(Vehicle, reliability, SLE_UINT16),
|
||||
SLE_VAR(Vehicle, reliability_spd_dec, SLE_UINT16),
|
||||
SLE_VAR(Vehicle, breakdown_ctr, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, breakdown_delay, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, breakdowns_since_last_service, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, breakdown_chance, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, build_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Vehicle, build_year, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, build_year, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Vehicle, build_year, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Vehicle, load_unload_ticks, SLE_UINT16),
|
||||
SLEG_CONDVAR( _cargo_paid_for, SLE_UINT16, 45, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, vehicle_flags, SLE_FILE_U8 | SLE_VAR_U16, 40, 180),
|
||||
SLE_CONDVAR(Vehicle, vehicle_flags, SLE_UINT16, 180, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_paid_for, SLE_UINT16, SLV_45, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, vehicle_flags, SLE_FILE_U8 | SLE_VAR_U16, SLV_40, SLV_180),
|
||||
SLE_CONDVAR(Vehicle, vehicle_flags, SLE_UINT16, SLV_180, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, profit_this_year, SLE_FILE_I32 | SLE_VAR_I64, 0, 65),
|
||||
SLE_CONDVAR(Vehicle, profit_this_year, SLE_INT64, 65, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, profit_last_year, SLE_FILE_I32 | SLE_VAR_I64, 0, 65),
|
||||
SLE_CONDVAR(Vehicle, profit_last_year, SLE_INT64, 65, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_I32 | SLE_VAR_I64, 51, 65),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, 65, 68),
|
||||
SLEG_CONDVAR( _cargo_loaded_at_xy, SLE_UINT32, 51, 68),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_FILE_I32 | SLE_VAR_I64, 0, 65),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_INT64, 65, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, profit_this_year, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(Vehicle, profit_this_year, SLE_INT64, SLV_65, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, profit_last_year, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(Vehicle, profit_last_year, SLE_INT64, SLV_65, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_FILE_I32 | SLE_VAR_I64, SLV_51, SLV_65),
|
||||
SLEG_CONDVAR( _cargo_feeder_share, SLE_INT64, SLV_65, SLV_68),
|
||||
SLEG_CONDVAR( _cargo_loaded_at_xy, SLE_UINT32, SLV_51, SLV_68),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_INT64, SLV_65, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, 2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, 2, 69),
|
||||
SLE_CONDNULL(4, 69, 101),
|
||||
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SLV_2, SLV_69),
|
||||
SLE_CONDNULL(4, SLV_69, SLV_101),
|
||||
|
||||
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, 60, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, SLV_60, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, 67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, 67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, SLV_67, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, SLV_67, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(10, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(10, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -725,15 +725,15 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
SLE_VAR(Train, railtype, SLE_UINT8),
|
||||
SLE_VAR(Train, track, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Train, flags, SLE_FILE_U8 | SLE_VAR_U16, 2, 100),
|
||||
SLE_CONDVAR(Train, flags, SLE_UINT16, 100, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, 2, 60),
|
||||
SLE_CONDVAR(Train, flags, SLE_FILE_U8 | SLE_VAR_U16, SLV_2, SLV_100),
|
||||
SLE_CONDVAR(Train, flags, SLE_UINT16, SLV_100, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(2, SLV_2, SLV_60),
|
||||
|
||||
SLE_CONDVAR(Train, wait_counter, SLE_UINT16, 136, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Train, wait_counter, SLE_UINT16, SLV_136, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(2, 2, 20),
|
||||
SLE_CONDVAR(Train, gv_flags, SLE_UINT16, 139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(11, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(2, SLV_2, SLV_20),
|
||||
SLE_CONDVAR(Train, gv_flags, SLE_UINT16, SLV_139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(11, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -749,11 +749,11 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
SLE_VAR(RoadVehicle, crashed_ctr, SLE_UINT16),
|
||||
SLE_VAR(RoadVehicle, reverse_ctr, SLE_UINT8),
|
||||
|
||||
SLE_CONDNULL(2, 6, 69),
|
||||
SLE_CONDVAR(RoadVehicle, gv_flags, SLE_UINT16, 139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, 69, 131),
|
||||
SLE_CONDNULL(2, 6, 131),
|
||||
SLE_CONDNULL(16, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(2, SLV_6, SLV_69),
|
||||
SLE_CONDVAR(RoadVehicle, gv_flags, SLE_UINT16, SLV_139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(4, SLV_69, SLV_131),
|
||||
SLE_CONDNULL(2, SLV_6, SLV_131),
|
||||
SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -762,10 +762,10 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
SLE_WRITEBYTE(Vehicle, type),
|
||||
SLE_VEH_INCLUDE(),
|
||||
SLE_VAR(Ship, state, SLE_UINT8),
|
||||
SLE_CONDDEQUE(Ship, path, SLE_UINT8, 203, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Ship, rotation, SLE_UINT8, 204, SL_MAX_VERSION),
|
||||
SLE_CONDDEQUE(Ship, path, SLE_UINT8, SLV_203, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Ship, rotation, SLE_UINT8, SLV_204, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(16, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -776,19 +776,19 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
SLE_VAR(Aircraft, crashed_counter, SLE_UINT16),
|
||||
SLE_VAR(Aircraft, pos, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Aircraft, targetairport, SLE_FILE_U8 | SLE_VAR_U16, 0, 5),
|
||||
SLE_CONDVAR(Aircraft, targetairport, SLE_UINT16, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, targetairport, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Aircraft, targetairport, SLE_UINT16, SLV_5, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Aircraft, state, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Aircraft, previous_pos, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, last_direction, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, number_consecutive_turns, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, previous_pos, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, last_direction, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, number_consecutive_turns, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Aircraft, turn_counter, SLE_UINT8, 136, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, flags, SLE_UINT8, 167, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, turn_counter, SLE_UINT8, SLV_136, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Aircraft, flags, SLE_UINT8, SLV_167, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(13, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(13, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -798,27 +798,27 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
|
||||
SLE_VAR(Vehicle, subtype, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_FILE_I16 | SLE_VAR_I32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_INT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_FILE_I16 | SLE_VAR_I32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_INT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_FILE_U8 | SLE_VAR_I32, 0, 164),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_INT32, 164, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_INT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_INT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_164),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_INT32, SLV_164, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Vehicle, sprite_seq.seq[0].sprite, SLE_FILE_U16 | SLE_VAR_U32),
|
||||
SLE_CONDNULL(5, 0, 59),
|
||||
SLE_CONDNULL(5, SL_MIN_VERSION, SLV_59),
|
||||
SLE_VAR(Vehicle, progress, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
|
||||
|
||||
SLE_VAR(EffectVehicle, animation_state, SLE_UINT16),
|
||||
SLE_VAR(EffectVehicle, animation_substate, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(Vehicle, spritenum, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, spritenum, SLE_UINT8, SLV_2, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(15, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(15, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -829,37 +829,37 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||
SLE_REF(Vehicle, next, REF_VEHICLE_OLD),
|
||||
|
||||
SLE_VAR(Vehicle, subtype, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, dest_tile, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_FILE_I16 | SLE_VAR_I32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_INT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_FILE_I16 | SLE_VAR_I32, 0, 6),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_INT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_FILE_U8 | SLE_VAR_I32, 0, 164),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_INT32, 164, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, x_pos, SLE_INT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_FILE_I16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(Vehicle, y_pos, SLE_INT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_FILE_U8 | SLE_VAR_I32, SL_MIN_VERSION, SLV_164),
|
||||
SLE_CONDVAR(Vehicle, z_pos, SLE_INT32, SLV_164, SL_MAX_VERSION),
|
||||
SLE_VAR(Vehicle, direction, SLE_UINT8),
|
||||
|
||||
SLE_CONDNULL(5, 0, 58),
|
||||
SLE_CONDNULL(5, SL_MIN_VERSION, SLV_58),
|
||||
SLE_VAR(Vehicle, owner, SLE_UINT8),
|
||||
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_FILE_U8 | SLE_VAR_U16, 0, 5),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_UINT16, 5, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5),
|
||||
SLE_CONDVAR(Vehicle, current_order.dest, SLE_UINT16, SLV_5, SL_MAX_VERSION),
|
||||
|
||||
SLE_VAR(Vehicle, sprite_seq.seq[0].sprite, SLE_FILE_U16 | SLE_VAR_U32),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, 0, 31),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_VAR(Vehicle, tick_counter, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(DisasterVehicle, image_override, SLE_FILE_U16 | SLE_VAR_U32, 0, 191),
|
||||
SLE_CONDVAR(DisasterVehicle, image_override, SLE_UINT32, 191, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(DisasterVehicle, big_ufo_destroyer_target, SLE_FILE_U16 | SLE_VAR_U32, 0, 191),
|
||||
SLE_CONDVAR(DisasterVehicle, big_ufo_destroyer_target, SLE_UINT32, 191, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(DisasterVehicle, flags, SLE_UINT8, 194, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(DisasterVehicle, image_override, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_191),
|
||||
SLE_CONDVAR(DisasterVehicle, image_override, SLE_UINT32, SLV_191, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(DisasterVehicle, big_ufo_destroyer_target, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_191),
|
||||
SLE_CONDVAR(DisasterVehicle, big_ufo_destroyer_target, SLE_UINT32, SLV_191, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(DisasterVehicle, flags, SLE_UINT8, SLV_194, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDNULL(16, 2, 144), // old reserved space
|
||||
SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -920,13 +920,13 @@ void Load_VEHS()
|
|||
}
|
||||
|
||||
/* Old savegames used 'last_station_visited = 0xFF' */
|
||||
if (IsSavegameVersionBefore(5) && v->last_station_visited == 0xFF) {
|
||||
if (IsSavegameVersionBefore(SLV_5) && v->last_station_visited == 0xFF) {
|
||||
v->last_station_visited = INVALID_STATION;
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(182)) v->last_loading_station = INVALID_STATION;
|
||||
if (IsSavegameVersionBefore(SLV_182)) v->last_loading_station = INVALID_STATION;
|
||||
|
||||
if (IsSavegameVersionBefore(5)) {
|
||||
if (IsSavegameVersionBefore(SLV_5)) {
|
||||
/* Convert the current_order.type (which is a mix of type and flags, because
|
||||
* in those versions, they both were 4 bits big) to type and flags */
|
||||
v->current_order.flags = GB(v->current_order.type, 4, 4);
|
||||
|
@ -934,7 +934,7 @@ void Load_VEHS()
|
|||
}
|
||||
|
||||
/* Advanced vehicle lists got added */
|
||||
if (IsSavegameVersionBefore(60)) v->group_id = DEFAULT_GROUP;
|
||||
if (IsSavegameVersionBefore(SLV_60)) v->group_id = DEFAULT_GROUP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ void MoveWaypointsToBaseStations()
|
|||
* waypoints to make way for storing the index in m2. The custom graphics
|
||||
* id which was stored in m4 is now saved as a grf/id reference in the
|
||||
* waypoint struct. */
|
||||
if (IsSavegameVersionBefore(17)) {
|
||||
if (IsSavegameVersionBefore(SLV_17)) {
|
||||
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
|
||||
if (wp->delete_ctr != 0) continue; // The waypoint was deleted
|
||||
|
||||
|
@ -113,7 +113,7 @@ void MoveWaypointsToBaseStations()
|
|||
TileIndex t = wp->xy;
|
||||
if (IsTileType(t, MP_RAILWAY) && GetRailTileType(t) == 2 /* RAIL_TILE_WAYPOINT */ && _m[t].m2 == wp->index) {
|
||||
/* The tile might've been reserved! */
|
||||
bool reserved = !IsSavegameVersionBefore(100) && HasBit(_m[t].m5, 4);
|
||||
bool reserved = !IsSavegameVersionBefore(SLV_100) && HasBit(_m[t].m5, 4);
|
||||
|
||||
/* The tile really has our waypoint, so reassign the map array */
|
||||
MakeRailWaypoint(t, GetTileOwner(t), new_wp->index, (Axis)GB(_m[t].m5, 0, 1), 0, GetRailType(t));
|
||||
|
@ -150,21 +150,21 @@ void MoveWaypointsToBaseStations()
|
|||
}
|
||||
|
||||
static const SaveLoad _old_waypoint_desc[] = {
|
||||
SLE_CONDVAR(OldWaypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 6),
|
||||
SLE_CONDVAR(OldWaypoint, xy, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, town_index, SLE_UINT16, 12, 122),
|
||||
SLE_CONDREF(OldWaypoint, town, REF_TOWN, 122, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, 12, 89),
|
||||
SLE_CONDVAR(OldWaypoint, town_cn, SLE_UINT16, 89, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, string_id, SLE_STRINGID, 0, 84),
|
||||
SLE_CONDSTR(OldWaypoint, name, SLE_STR, 0, 84, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_6),
|
||||
SLE_CONDVAR(OldWaypoint, xy, SLE_UINT32, SLV_6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, town_index, SLE_UINT16, SLV_12, SLV_122),
|
||||
SLE_CONDREF(OldWaypoint, town, REF_TOWN, SLV_122, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, SLV_12, SLV_89),
|
||||
SLE_CONDVAR(OldWaypoint, town_cn, SLE_UINT16, SLV_89, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, string_id, SLE_STRINGID, SL_MIN_VERSION, SLV_84),
|
||||
SLE_CONDSTR(OldWaypoint, name, SLE_STR, 0, SLV_84, SL_MAX_VERSION),
|
||||
SLE_VAR(OldWaypoint, delete_ctr, SLE_UINT8),
|
||||
|
||||
SLE_CONDVAR(OldWaypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, 3, 31),
|
||||
SLE_CONDVAR(OldWaypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, localidx, SLE_UINT8, 3, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, grfid, SLE_UINT32, 17, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, owner, SLE_UINT8, 101, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, SLV_3, SLV_31),
|
||||
SLE_CONDVAR(OldWaypoint, build_date, SLE_INT32, SLV_31, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, localidx, SLE_UINT8, SLV_3, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, grfid, SLE_UINT32, SLV_17, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(OldWaypoint, owner, SLE_UINT8, SLV_101, SL_MAX_VERSION),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
@ -190,10 +190,10 @@ static void Ptrs_WAYP()
|
|||
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
|
||||
SlObject(wp, _old_waypoint_desc);
|
||||
|
||||
if (IsSavegameVersionBefore(12)) {
|
||||
if (IsSavegameVersionBefore(SLV_12)) {
|
||||
wp->town_cn = (wp->string_id & 0xC000) == 0xC000 ? (wp->string_id >> 8) & 0x3F : 0;
|
||||
wp->town = ClosestTownFromTile(wp->xy, UINT_MAX);
|
||||
} else if (IsSavegameVersionBefore(122)) {
|
||||
} else if (IsSavegameVersionBefore(SLV_122)) {
|
||||
/* Only for versions 12 .. 122 */
|
||||
if (!Town::IsValidID(wp->town_index)) {
|
||||
/* Upon a corrupted waypoint we'll likely get here. The next step will be to
|
||||
|
@ -206,7 +206,7 @@ static void Ptrs_WAYP()
|
|||
}
|
||||
wp->town = Town::Get(wp->town_index);
|
||||
}
|
||||
if (IsSavegameVersionBefore(84)) {
|
||||
if (IsSavegameVersionBefore(SLV_84)) {
|
||||
wp->name = CopyFromOldName(wp->string_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1377,7 +1377,7 @@ static void PrepareOldDiffCustom()
|
|||
*/
|
||||
static void HandleOldDiffCustom(bool savegame)
|
||||
{
|
||||
uint options_to_load = GAME_DIFFICULTY_NUM - ((savegame && IsSavegameVersionBefore(4)) ? 1 : 0);
|
||||
uint options_to_load = GAME_DIFFICULTY_NUM - ((savegame && IsSavegameVersionBefore(SLV_4)) ? 1 : 0);
|
||||
|
||||
if (!savegame) {
|
||||
/* If we did read to old_diff_custom, then at least one value must be non 0. */
|
||||
|
|
|
@ -31,7 +31,7 @@ strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
|||
strval = STR_NULL
|
||||
proc = NULL
|
||||
load = NULL
|
||||
from = 0
|
||||
from = SL_MIN_VERSION
|
||||
to = SL_MAX_VERSION
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
|||
strval = STR_NULL
|
||||
proc = NULL
|
||||
load = NULL
|
||||
from = 0
|
||||
from = SL_MIN_VERSION
|
||||
to = SL_MAX_VERSION
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
|||
strval = STR_NULL
|
||||
proc = NULL
|
||||
load = NULL
|
||||
from = 0
|
||||
from = SL_MIN_VERSION
|
||||
to = SL_MAX_VERSION
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
@ -77,7 +77,7 @@ def = 0
|
|||
min = 0
|
||||
max = 0
|
||||
full = NULL
|
||||
to = 4
|
||||
to = SLV_4
|
||||
|
||||
[SDTG_GENERAL]
|
||||
name = ""diff_custom""
|
||||
|
@ -91,7 +91,7 @@ def = 0
|
|||
min = 0
|
||||
max = 0
|
||||
full = NULL
|
||||
from = 4
|
||||
from = SLV_4
|
||||
|
||||
##
|
||||
[SDTG_VAR]
|
||||
|
@ -152,21 +152,21 @@ type = SLE_UINT8
|
|||
def = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT
|
||||
min = MIN_SNOWLINE_HEIGHT * TILE_HEIGHT
|
||||
max = MAX_SNOWLINE_HEIGHT * TILE_HEIGHT
|
||||
to = 22
|
||||
to = SLV_22
|
||||
|
||||
[SDT_NULL]
|
||||
length = 1
|
||||
from = 22
|
||||
to = 165
|
||||
from = SLV_22
|
||||
to = SLV_165
|
||||
|
||||
[SDT_NULL]
|
||||
length = 1
|
||||
to = 23
|
||||
to = SLV_23
|
||||
|
||||
[SDTC_OMANY]
|
||||
var = gui.autosave
|
||||
type = SLE_UINT8
|
||||
from = 23
|
||||
from = SLV_23
|
||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||
def = 1
|
||||
max = 4
|
||||
|
|
|
@ -32,7 +32,7 @@ strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
|||
strval = STR_NULL
|
||||
proc = NULL
|
||||
load = NULL
|
||||
from = 0
|
||||
from = SL_MIN_VERSION
|
||||
to = SL_MAX_VERSION
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,7 +30,7 @@ strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
|||
strval = STR_NULL
|
||||
proc = NULL
|
||||
load = NULL
|
||||
from = 0
|
||||
from = SL_MIN_VERSION
|
||||
to = SL_MAX_VERSION
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
|||
strval = STR_NULL
|
||||
proc = NULL
|
||||
load = NULL
|
||||
from = 0
|
||||
from = SL_MIN_VERSION
|
||||
to = SL_MAX_VERSION
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
|
Loading…
Reference in New Issue