Changeset - r23266:58eee2f3d1b6
[Not reviewed]
master
0 10 0
Peter Nelson - 6 years ago 2019-02-01 22:46:12
peter1138@openttd.org
Codechange: Change from numeric to descriptive SLV enum labels for last entries.
10 files changed with 54 insertions and 54 deletions:
0 comments (0 inline, 0 general)
src/saveload/afterload.cpp
Show inline comments
 
@@ -1214,8 +1214,8 @@ bool AfterLoadGame()
 
		}
 
	}
 

	
 
	/* Railtype moved from m3 to m8 in version SLV_200. */
 
	if (IsSavegameVersionBefore(SLV_200)) {
 
	/* Railtype moved from m3 to m8 in version SLV_EXTEND_RAILTYPES. */
 
	if (IsSavegameVersionBefore(SLV_EXTEND_RAILTYPES)) {
 
		for (TileIndex t = 0; t < map_size; t++) {
 
			switch (GetTileType(t)) {
 
				case MP_RAILWAY:
 
@@ -3015,7 +3015,7 @@ bool AfterLoadGame()
 
		}
 
	}
 

	
 
	if (IsSavegameVersionBefore(SLV_202)) {
 
	if (IsSavegameVersionBefore(SLV_EXTEND_INDUSTRY_CARGO_SLOTS)) {
 
		/* Make sure added industry cargo slots are cleared */
 
		Industry *i;
 
		FOR_ALL_INDUSTRIES(i) {
src/saveload/company_sl.cpp
Show inline comments
 
@@ -350,8 +350,8 @@ static const SaveLoad _company_economy_d
 
	SLE_CONDVAR(CompanyEconomyEntry, company_value,       SLE_INT64,                  SLV_2, 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_CONDARR(CompanyEconomyEntry, delivered_cargo,     SLE_UINT32, 32,           SLV_170, SLV_EXTEND_CARGOTYPES),
 
	SLE_CONDARR(CompanyEconomyEntry, delivered_cargo,     SLE_UINT32, NUM_CARGO,    SLV_EXTEND_CARGOTYPES, SL_MAX_VERSION),
 
	    SLE_VAR(CompanyEconomyEntry, performance_history, SLE_INT32),
 

	
 
	SLE_END()
 
@@ -443,7 +443,7 @@ static void SaveLoad_PLYR_common(Company
 

	
 
	/* Write each livery entry. */
 
	int num_liveries = IsSavegameVersionBefore(SLV_63) ? LS_END - 4 : (IsSavegameVersionBefore(SLV_85) ? LS_END - 2: LS_END);
 
	bool update_in_use = IsSavegameVersionBefore(SLV_205);
 
	bool update_in_use = IsSavegameVersionBefore(SLV_GROUP_LIVERIES);
 
	if (c != NULL) {
 
		for (i = 0; i < num_liveries; i++) {
 
			SlObject(&c->livery[i], _company_livery_desc);
src/saveload/economy_sl.cpp
Show inline comments
 
@@ -29,7 +29,7 @@ static void Load_PRIC()
 
/** Cargo payment rates in pre 126 savegames */
 
static void Load_CAPR()
 
{
 
	uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 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);
src/saveload/group_sl.cpp
Show inline comments
 
@@ -24,9 +24,9 @@ static const SaveLoad _group_desc[] = {
 
	     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,                     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, livery.in_use,      SLE_UINT8,                     SLV_GROUP_LIVERIES, SL_MAX_VERSION),
 
	 SLE_CONDVAR(Group, livery.colour1,     SLE_UINT8,                     SLV_GROUP_LIVERIES, SL_MAX_VERSION),
 
	 SLE_CONDVAR(Group, livery.colour2,     SLE_UINT8,                     SLV_GROUP_LIVERIES, SL_MAX_VERSION),
 
	 SLE_CONDVAR(Group, parent,             SLE_UINT16,                    SLV_189, SL_MAX_VERSION),
 
	     SLE_END()
 
};
 
@@ -52,7 +52,7 @@ static void Load_GRPS()
 

	
 
		if (IsSavegameVersionBefore(SLV_189)) g->parent = INVALID_GROUP;
 

	
 
		if (IsSavegameVersionBefore(SLV_205)) {
 
		if (IsSavegameVersionBefore(SLV_GROUP_LIVERIES)) {
 
	                const Company *c = Company::Get(g->owner);
 
	                g->livery.colour1 = c->livery[LS_DEFAULT].colour1;
 
	                g->livery.colour2 = c->livery[LS_DEFAULT].colour2;
src/saveload/industry_sl.cpp
Show inline comments
 
@@ -26,28 +26,28 @@ static const SaveLoad _industry_desc[] =
 
	    SLE_VAR(Industry, location.h,                 SLE_FILE_U8 | SLE_VAR_U16),
 
	    SLE_REF(Industry, town,                       REF_TOWN),
 
	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_CONDARR(Industry, produced_cargo,             SLE_UINT8,   2,              SLV_78, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, produced_cargo,             SLE_UINT8,  16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, incoming_cargo_waiting,     SLE_UINT16,  3,              SLV_70, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, incoming_cargo_waiting,     SLE_UINT16, 16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, produced_cargo_waiting,     SLE_UINT16,  2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, produced_cargo_waiting,     SLE_UINT16, 16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, production_rate,            SLE_UINT8,   2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, production_rate,            SLE_UINT8,  16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, 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_CONDARR(Industry, accepts_cargo,              SLE_UINT8,   3,              SLV_78, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, accepts_cargo,              SLE_UINT8,  16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	    SLE_VAR(Industry, prod_level,                 SLE_UINT8),
 
	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_CONDARR(Industry, this_month_production,      SLE_UINT16,  2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, this_month_production,      SLE_UINT16, 16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, this_month_transported,     SLE_UINT16,  2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, this_month_transported,     SLE_UINT16, 16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8,   2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8,  16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, last_month_production,      SLE_UINT16,  2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, last_month_production,      SLE_UINT16, 16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 
	SLE_CONDARR(Industry, last_month_transported,     SLE_UINT16,  2,               SL_MIN_VERSION, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, last_month_transported,     SLE_UINT16, 16,             SLV_EXTEND_INDUSTRY_CARGO_SLOTS, SL_MAX_VERSION),
 

	
 
	    SLE_VAR(Industry, counter,                    SLE_UINT16),
 

	
 
@@ -61,8 +61,8 @@ static const SaveLoad _industry_desc[] =
 
	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, last_cargo_accepted_at[0],  SLE_INT32,                 SLV_70, SLV_EXTEND_INDUSTRY_CARGO_SLOTS),
 
	SLE_CONDARR(Industry, last_cargo_accepted_at,     SLE_INT32, 16,            SLV_EXTEND_INDUSTRY_CARGO_SLOTS, 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,            SLV_76, SLV_161),
src/saveload/saveload.h
Show inline comments
 
@@ -280,15 +280,15 @@ enum SaveLoadVersion : uint16 {
 
	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_EXTEND_CARGOTYPES,                  ///< 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_EXTEND_RAILTYPES,                   ///< 200  PR#6805 Extend railtypes to 64, adding uint16 to map array.
 
	SLV_EXTEND_PERSISTENT_STORAGE,          ///< 201  PR#6885 Extend NewGRF persistant storages.
 
	SLV_EXTEND_INDUSTRY_CARGO_SLOTS,        ///< 202  PR#6867 Increase industry cargo slots to 16 in, 16 out
 
	SLV_SHIP_PATH_CACHE,                    ///< 203  PR#7072 Add path cache for ships
 
	SLV_SHIP_ROTATION,                      ///< 204  PR#7065 Add extra rotation stages for ships.
 

	
 
	SLV_205,                                ///< 205  PR#7108 Livery storage change and group liveries.
 
	SLV_GROUP_LIVERIES,                     ///< 205  PR#7108 Livery storage change and group liveries.
 

	
 
	SL_MAX_VERSION,                         ///< Highest possible saveload version
 
};
src/saveload/station_sl.cpp
Show inline comments
 
@@ -329,7 +329,7 @@ static void Load_STNS()
 
	_cargo_days = 0;
 
	_cargo_feeder_share = 0;
 

	
 
	uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO;
 
	int index;
 
	while ((index = SlIterateArray()) != -1) {
 
		Station *st = new (index) Station();
 
@@ -377,7 +377,7 @@ static void Ptrs_STNS()
 
	/* Don't run when savegame version is higher than or equal to 123. */
 
	if (!IsSavegameVersionBefore(SLV_123)) return;
 

	
 
	uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO;
 
	Station *st;
 
	FOR_ALL_STATIONS(st) {
 
		if (!IsSavegameVersionBefore(SLV_68)) {
 
@@ -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, SLV_127, SLV_199),
 
	  SLE_CONDVAR(Station, always_accepted,            SLE_UINT64,                 SLV_199, SL_MAX_VERSION),
 
	  SLE_CONDVAR(Station, always_accepted,            SLE_FILE_U32 | SLE_VAR_U64, SLV_127, SLV_EXTEND_CARGOTYPES),
 
	  SLE_CONDVAR(Station, always_accepted,            SLE_UINT64,                 SLV_EXTEND_CARGOTYPES, SL_MAX_VERSION),
 

	
 
	      SLE_END()
 
};
 
@@ -522,7 +522,7 @@ static void Load_STNN()
 
{
 
	_num_flows = 0;
 

	
 
	uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO;
 
	int index;
 
	while ((index = SlIterateArray()) != -1) {
 
		bool waypoint = (SlReadByte() & FACIL_WAYPOINT) != 0;
 
@@ -583,7 +583,7 @@ static void Ptrs_STNN()
 
	/* Don't run when savegame version lower than 123. */
 
	if (IsSavegameVersionBefore(SLV_123)) return;
 

	
 
	uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO;
 
	Station *st;
 
	FOR_ALL_STATIONS(st) {
 
		for (CargoID i = 0; i < num_cargo; i++) {
src/saveload/storage_sl.cpp
Show inline comments
 
@@ -18,8 +18,8 @@
 
/** Description of the data to save and load in #PersistentStorage. */
 
static const SaveLoad _storage_desc[] = {
 
	 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_CONDARR(PersistentStorage, storage,  SLE_UINT32,  16,           SLV_161, SLV_EXTEND_PERSISTENT_STORAGE),
 
	 SLE_CONDARR(PersistentStorage, storage,  SLE_UINT32, 256,           SLV_EXTEND_PERSISTENT_STORAGE, SL_MAX_VERSION),
 
	 SLE_END()
 
};
 

	
src/saveload/town_sl.cpp
Show inline comments
 
@@ -192,8 +192,8 @@ static const SaveLoad _town_desc[] = {
 

	
 
	SLE_CONDLST(Town, psa_list,            REF_STORAGE,                SLV_161, 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),
 
	SLE_CONDVAR(Town, cargo_produced,        SLE_FILE_U32 | SLE_VAR_U64, SLV_166, SLV_EXTEND_CARGOTYPES),
 
	SLE_CONDVAR(Town, cargo_produced,        SLE_UINT64,                 SLV_EXTEND_CARGOTYPES, SL_MAX_VERSION),
 

	
 
	/* reserve extra space in savegame here. (currently 30 bytes) */
 
	SLE_CONDNULL(30, SLV_2, SL_MAX_VERSION),
 
@@ -275,7 +275,7 @@ static void Save_TOWN()
 
static void Load_TOWN()
 
{
 
	int index;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO;
 
	uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO;
 

	
 
	while ((index = SlIterateArray()) != -1) {
 
		Town *t = new (index) Town();
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -369,7 +369,7 @@ void AfterLoadVehicles(bool part_of_load
 
			}
 
		}
 

	
 
		if (IsSavegameVersionBefore(SLV_204)) {
 
		if (IsSavegameVersionBefore(SLV_SHIP_ROTATION)) {
 
			/* Ship rotation added */
 
			Ship *s;
 
			FOR_ALL_SHIPS(s) {
 
@@ -762,8 +762,8 @@ const SaveLoad *GetVehicleDescription(Ve
 
		SLE_WRITEBYTE(Vehicle, type),
 
		SLE_VEH_INCLUDE(),
 
		      SLE_VAR(Ship, state,                     SLE_UINT8),
 
		SLE_CONDDEQUE(Ship, path,                      SLE_UINT8,                  SLV_203, SL_MAX_VERSION),
 
		  SLE_CONDVAR(Ship, rotation,                  SLE_UINT8,                  SLV_204, SL_MAX_VERSION),
 
		SLE_CONDDEQUE(Ship, path,                      SLE_UINT8,                  SLV_SHIP_PATH_CACHE, SL_MAX_VERSION),
 
		  SLE_CONDVAR(Ship, rotation,                  SLE_UINT8,                  SLV_SHIP_ROTATION, SL_MAX_VERSION),
 

	
 
		SLE_CONDNULL(16, SLV_2, SLV_144), // old reserved space
 

	
0 comments (0 inline, 0 general)