diff options
author | Peter Nelson <peter1138@openttd.org> | 2019-01-26 01:48:40 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-02-02 21:39:06 +0000 |
commit | 9de12521ecec338160c37920e65fd02c0c742bef (patch) | |
tree | 66f41585907f29ddbe22bb340c34bd23bffa58bd | |
parent | ea4ea628163c735db4c4714966c9bc1c560e0f61 (diff) | |
download | openttd-9de12521ecec338160c37920e65fd02c0c742bef.tar.xz |
Codechange: Convert saveload numbers to enum values.
(This was mostly achieved with a few in-place regexes)
37 files changed, 1275 insertions, 1223 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 077f86bf6..40343b188 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -533,14 +533,14 @@ bool AfterLoadGame() /* The LFSR used in RunTileLoop iteration cannot have a zeroed state, make it non-zeroed. */ if (_cur_tileloop_tile == 0) _cur_tileloop_tile = 1; - if (IsSavegameVersionBefore(98)) GamelogOldver(); + if (IsSavegameVersionBefore(SLV_98)) GamelogOldver(); GamelogTestRevision(); GamelogTestMode(); - if (IsSavegameVersionBefore(98)) GamelogGRFAddList(_grfconfig); + if (IsSavegameVersionBefore(SLV_98)) GamelogGRFAddList(_grfconfig); - if (IsSavegameVersionBefore(119)) { + if (IsSavegameVersionBefore(SLV_119)) { _pause_mode = (_pause_mode == 2) ? PM_PAUSED_NORMAL : PM_UNPAUSED; } else if (_network_dedicated && (_pause_mode & PM_PAUSED_ERROR) != 0) { DEBUG(net, 0, "The loading savegame was paused due to an error state."); @@ -565,7 +565,7 @@ bool AfterLoadGame() * Because the data stored by TTDPatch are unusable for rail stations > 7x7, * recompute the width and height. Doing this unconditionally for all old * savegames simplifies the code. */ - if (IsSavegameVersionBefore(2)) { + if (IsSavegameVersionBefore(SLV_2)) { Station *st; FOR_ALL_STATIONS(st) { st->train_station.w = st->train_station.h = 0; @@ -583,7 +583,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(194)) { + if (IsSavegameVersionBefore(SLV_194)) { _settings_game.construction.max_heightlevel = 15; /* In old savegame versions, the heightlevel was coded in bits 0..3 of the type field */ @@ -601,19 +601,19 @@ bool AfterLoadGame() } /* in version 2.1 of the savegame, town owner was unified. */ - if (IsSavegameVersionBefore(2, 1)) ConvertTownOwner(); + if (IsSavegameVersionBefore(SLV_2, 1)) ConvertTownOwner(); /* from version 4.1 of the savegame, exclusive rights are stored at towns */ - if (IsSavegameVersionBefore(4, 1)) UpdateExclusiveRights(); + if (IsSavegameVersionBefore(SLV_4, 1)) UpdateExclusiveRights(); /* from version 4.2 of the savegame, currencies are in a different order */ - if (IsSavegameVersionBefore(4, 2)) UpdateCurrencies(); + if (IsSavegameVersionBefore(SLV_4, 2)) UpdateCurrencies(); /* In old version there seems to be a problem that water is owned by * OWNER_NONE, not OWNER_WATER.. I can't replicate it for the current * (4.3) version, so I just check when versions are older, and then * walk through the whole map.. */ - if (IsSavegameVersionBefore(4, 3)) { + if (IsSavegameVersionBefore(SLV_4, 3)) { for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_WATER) && GetTileOwner(t) >= MAX_COMPANIES) { SetTileOwner(t, OWNER_WATER); @@ -621,7 +621,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(84)) { + if (IsSavegameVersionBefore(SLV_84)) { Company *c; FOR_ALL_COMPANIES(c) { c->name = CopyFromOldName(c->name_1); @@ -647,7 +647,7 @@ bool AfterLoadGame() /* From this point the old names array is cleared. */ ResetOldNames(); - if (IsSavegameVersionBefore(106)) { + if (IsSavegameVersionBefore(SLV_106)) { /* no station is determined by 'tile == INVALID_TILE' now (instead of '0') */ Station *st; FOR_ALL_STATIONS(st) { @@ -659,7 +659,7 @@ bool AfterLoadGame() /* the same applies to Company::location_of_HQ */ Company *c; FOR_ALL_COMPANIES(c) { - if (c->location_of_HQ == 0 || (IsSavegameVersionBefore(4) && c->location_of_HQ == 0xFFFF)) { + if (c->location_of_HQ == 0 || (IsSavegameVersionBefore(SLV_4) && c->location_of_HQ == 0xFFFF)) { c->location_of_HQ = INVALID_TILE; } } @@ -692,7 +692,7 @@ bool AfterLoadGame() } /* The value of _date_fract got divided, so make sure that old games are converted correctly. */ - if (IsSavegameVersionBefore(11, 1) || (IsSavegameVersionBefore(147) && _date_fract > DAY_TICKS)) _date_fract /= 885; + if (IsSavegameVersionBefore(SLV_11, 1) || (IsSavegameVersionBefore(SLV_147) && _date_fract > DAY_TICKS)) _date_fract /= 885; /* Update current year * must be done before loading sprites as some newgrfs check it */ @@ -711,29 +711,29 @@ bool AfterLoadGame() * right value has been chosen in the settings. Otherwise we will be converting * it incorrectly in half of the times without a means to correct that. */ - if (IsSavegameVersionBefore(4, 2)) _settings_game.station.modified_catchment = false; - if (IsSavegameVersionBefore(6, 1)) _settings_game.pf.forbid_90_deg = false; - if (IsSavegameVersionBefore(21)) _settings_game.vehicle.train_acceleration_model = 0; - if (IsSavegameVersionBefore(90)) _settings_game.vehicle.plane_speed = 4; - if (IsSavegameVersionBefore(95)) _settings_game.vehicle.dynamic_engines = 0; - if (IsSavegameVersionBefore(96)) _settings_game.economy.station_noise_level = false; - if (IsSavegameVersionBefore(133)) { + if (IsSavegameVersionBefore(SLV_4, 2)) _settings_game.station.modified_catchment = false; + if (IsSavegameVersionBefore(SLV_6, 1)) _settings_game.pf.forbid_90_deg = false; + if (IsSavegameVersionBefore(SLV_21)) _settings_game.vehicle.train_acceleration_model = 0; + if (IsSavegameVersionBefore(SLV_90)) _settings_game.vehicle.plane_speed = 4; + if (IsSavegameVersionBefore(SLV_95)) _settings_game.vehicle.dynamic_engines = 0; + if (IsSavegameVersionBefore(SLV_96)) _settings_game.economy.station_noise_level = false; + if (IsSavegameVersionBefore(SLV_133)) { _settings_game.vehicle.train_slope_steepness = 3; } - if (IsSavegameVersionBefore(134)) _settings_game.economy.feeder_payment_share = 75; - if (IsSavegameVersionBefore(138)) _settings_game.vehicle.plane_crashes = 2; - if (IsSavegameVersionBefore(139)) { + if (IsSavegameVersionBefore(SLV_134)) _settings_game.economy.feeder_payment_share = 75; + if (IsSavegameVersionBefore(SLV_138)) _settings_game.vehicle.plane_crashes = 2; + if (IsSavegameVersionBefore(SLV_139)) { _settings_game.vehicle.roadveh_acceleration_model = 0; _settings_game.vehicle.roadveh_slope_steepness = 7; } - if (IsSavegameVersionBefore(143)) _settings_game.economy.allow_town_level_crossings = true; - if (IsSavegameVersionBefore(159)) { + if (IsSavegameVersionBefore(SLV_143)) _settings_game.economy.allow_town_level_crossings = true; + if (IsSavegameVersionBefore(SLV_159)) { _settings_game.vehicle.max_train_length = 50; _settings_game.construction.max_bridge_length = 64; _settings_game.construction.max_tunnel_length = 64; } - if (IsSavegameVersionBefore(166)) _settings_game.economy.infrastructure_maintenance = false; - if (IsSavegameVersionBefore(183)) { + if (IsSavegameVersionBefore(SLV_166)) _settings_game.economy.infrastructure_maintenance = false; + if (IsSavegameVersionBefore(SLV_183)) { _settings_game.linkgraph.distribution_pax = DT_MANUAL; _settings_game.linkgraph.distribution_mail = DT_MANUAL; _settings_game.linkgraph.distribution_armoured = DT_MANUAL; @@ -749,7 +749,7 @@ bool AfterLoadGame() /* Connect front and rear engines of multiheaded trains and converts * subtype to the new format */ - if (IsSavegameVersionBefore(17, 1)) ConvertOldMultiheadToNew(); + if (IsSavegameVersionBefore(SLV_17, 1)) ConvertOldMultiheadToNew(); /* Connect front and rear engines of multiheaded trains */ ConnectMultiheadedTrains(); @@ -765,7 +765,7 @@ bool AfterLoadGame() /* Oilrig was moved from id 15 to 9. We have to do this conversion * here as AfterLoadVehicles can check it indirectly via the newgrf * code. */ - if (IsSavegameVersionBefore(139)) { + if (IsSavegameVersionBefore(SLV_139)) { Station *st; FOR_ALL_STATIONS(st) { if (st->airport.tile != INVALID_TILE && st->airport.type == 15) { @@ -797,7 +797,7 @@ bool AfterLoadGame() * This problem appears in savegame version 21 too, see r3455. But after loading the * savegame and saving again, the buggy map array could be converted to new savegame * version. It didn't show up before r12070. */ - if (IsSavegameVersionBefore(87)) UpdateVoidTiles(); + if (IsSavegameVersionBefore(SLV_87)) UpdateVoidTiles(); /* If Load Scenario / New (Scenario) Game is used, * a company does not exist yet. So create one here. @@ -816,7 +816,7 @@ bool AfterLoadGame() cp->current_station = cp->front->last_station_visited; } - if (IsSavegameVersionBefore(72)) { + if (IsSavegameVersionBefore(SLV_72)) { /* Locks in very old savegames had OWNER_WATER as owner */ for (TileIndex t = 0; t < MapSize(); t++) { switch (GetTileType(t)) { @@ -887,7 +887,7 @@ bool AfterLoadGame() switch (GetStationType(t)) { case STATION_TRUCK: case STATION_BUS: - if (IsSavegameVersionBefore(6)) { + if (IsSavegameVersionBefore(SLV_6)) { /* Before version 5 you could not have more than 250 stations. * Version 6 adds large maps, so you could only place 253*253 * road stops on a map (no freeform edges) = 64009. So, yes @@ -937,12 +937,12 @@ bool AfterLoadGame() /* In version 2.2 of the savegame, we have new airports, so status of all aircraft is reset. * This has to be called after the oilrig airport_type update above ^^^ ! */ - if (IsSavegameVersionBefore(2, 2)) UpdateOldAircraft(); + if (IsSavegameVersionBefore(SLV_2, 2)) UpdateOldAircraft(); /* In version 6.1 we put the town index in the map-array. To do this, we need * to use m2 (16bit big), so we need to clean m2, and that is where this is * all about ;) */ - if (IsSavegameVersionBefore(6, 1)) { + if (IsSavegameVersionBefore(SLV_6, 1)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_HOUSE: @@ -965,20 +965,20 @@ bool AfterLoadGame() } /* Force the freeform edges to false for old savegames. */ - if (IsSavegameVersionBefore(111)) { + if (IsSavegameVersionBefore(SLV_111)) { _settings_game.construction.freeform_edges = false; } /* From version 9.0, we update the max passengers of a town (was sometimes negative * before that. */ - if (IsSavegameVersionBefore(9)) { + if (IsSavegameVersionBefore(SLV_9)) { Town *t; FOR_ALL_TOWNS(t) UpdateTownMaxPass(t); } /* From version 16.0, we included autorenew on engines, which are now saved, but * of course, we do need to initialize them for older savegames. */ - if (IsSavegameVersionBefore(16)) { + if (IsSavegameVersionBefore(SLV_16)) { Company *c; FOR_ALL_COMPANIES(c) { c->engine_renew_list = NULL; @@ -999,7 +999,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(48)) { + if (IsSavegameVersionBefore(SLV_48)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_RAILWAY: @@ -1027,9 +1027,9 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(61)) { + if (IsSavegameVersionBefore(SLV_61)) { /* Added the RoadType */ - bool old_bridge = IsSavegameVersionBefore(42); + bool old_bridge = IsSavegameVersionBefore(SLV_42); for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_ROAD: @@ -1066,9 +1066,9 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(114)) { - bool fix_roadtypes = !IsSavegameVersionBefore(61); - bool old_bridge = IsSavegameVersionBefore(42); + if (IsSavegameVersionBefore(SLV_114)) { + bool fix_roadtypes = !IsSavegameVersionBefore(SLV_61); + bool old_bridge = IsSavegameVersionBefore(SLV_42); for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { @@ -1133,7 +1133,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(42)) { + if (IsSavegameVersionBefore(SLV_42)) { Vehicle *v; for (TileIndex t = 0; t < map_size; t++) { @@ -1214,8 +1214,8 @@ bool AfterLoadGame() } } - /* Railtype moved from m3 to m8 in version 200. */ - if (IsSavegameVersionBefore(200)) { + /* Railtype moved from m3 to m8 in version SLV_200. */ + if (IsSavegameVersionBefore(SLV_200)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_RAILWAY: @@ -1247,7 +1247,7 @@ bool AfterLoadGame() } /* Elrails got added in rev 24 */ - if (IsSavegameVersionBefore(24)) { + if (IsSavegameVersionBefore(SLV_24)) { RailType min_rail = RAILTYPE_ELECTRIC; Train *v; @@ -1297,12 +1297,12 @@ bool AfterLoadGame() /* In version 16.1 of the savegame a company can decide if trains, which get * replaced, shall keep their old length. In all prior versions, just default * to false */ - if (IsSavegameVersionBefore(16, 1)) { + if (IsSavegameVersionBefore(SLV_16, 1)) { Company *c; FOR_ALL_COMPANIES(c) c->settings.renew_keep_length = false; } - if (IsSavegameVersionBefore(123)) { + if (IsSavegameVersionBefore(SLV_123)) { /* Waypoints became subclasses of stations ... */ MoveWaypointsToBaseStations(); /* ... and buoys were moved to waypoints. */ @@ -1311,7 +1311,7 @@ bool AfterLoadGame() /* From version 15, we moved a semaphore bit from bit 2 to bit 3 in m4, making * room for PBS. Now in version 21 move it back :P. */ - if (IsSavegameVersionBefore(21) && !IsSavegameVersionBefore(15)) { + if (IsSavegameVersionBefore(SLV_21) && !IsSavegameVersionBefore(SLV_15)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_RAILWAY: @@ -1345,14 +1345,14 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(25)) { + if (IsSavegameVersionBefore(SLV_25)) { RoadVehicle *rv; FOR_ALL_ROADVEHICLES(rv) { rv->vehstatus &= ~0x40; } } - if (IsSavegameVersionBefore(26)) { + if (IsSavegameVersionBefore(SLV_26)) { Station *st; FOR_ALL_STATIONS(st) { st->last_vehicle_type = VEH_INVALID; @@ -1361,7 +1361,7 @@ bool AfterLoadGame() YapfNotifyTrackLayoutChange(INVALID_TILE, INVALID_TRACK); - if (IsSavegameVersionBefore(34)) { + if (IsSavegameVersionBefore(SLV_34)) { Company *c; FOR_ALL_COMPANIES(c) ResetCompanyLivery(c); } @@ -1372,11 +1372,11 @@ bool AfterLoadGame() c->avail_roadtypes = GetCompanyRoadtypes(c->index); } - if (!IsSavegameVersionBefore(27)) AfterLoadStations(); + if (!IsSavegameVersionBefore(SLV_27)) AfterLoadStations(); /* Time starts at 0 instead of 1920. * Account for this in older games by adding an offset */ - if (IsSavegameVersionBefore(31)) { + if (IsSavegameVersionBefore(SLV_31)) { Station *st; Waypoint *wp; Engine *e; @@ -1401,7 +1401,7 @@ bool AfterLoadGame() /* From 32 on we save the industry who made the farmland. * To give this prettiness to old savegames, we remove all farmfields and * plant new ones. */ - if (IsSavegameVersionBefore(32)) { + if (IsSavegameVersionBefore(SLV_32)) { Industry *i; for (TileIndex t = 0; t < map_size; t++) { @@ -1421,7 +1421,7 @@ bool AfterLoadGame() } /* Setting no refit flags to all orders in savegames from before refit in orders were added */ - if (IsSavegameVersionBefore(36)) { + if (IsSavegameVersionBefore(SLV_36)) { Order *order; Vehicle *v; @@ -1436,14 +1436,14 @@ bool AfterLoadGame() /* from version 38 we have optional elrails, since we cannot know the * preference of a user, let elrails enabled; it can be disabled manually */ - if (IsSavegameVersionBefore(38)) _settings_game.vehicle.disable_elrails = false; + if (IsSavegameVersionBefore(SLV_38)) _settings_game.vehicle.disable_elrails = false; /* do the same as when elrails were enabled/disabled manually just now */ SettingsDisableElrail(_settings_game.vehicle.disable_elrails); InitializeRailGUI(); /* From version 53, the map array was changed for house tiles to allow * space for newhouses grf features. A new byte, m7, was also added. */ - if (IsSavegameVersionBefore(53)) { + if (IsSavegameVersionBefore(SLV_53)) { for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_HOUSE)) { if (GB(_m[t].m3, 6, 2) != TOWN_HOUSE_COMPLETED) { @@ -1480,7 +1480,7 @@ bool AfterLoadGame() /* Check and update house and town values */ UpdateHousesAndTowns(); - if (IsSavegameVersionBefore(43)) { + if (IsSavegameVersionBefore(SLV_43)) { for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_INDUSTRY)) { switch (GetIndustryGfx(t)) { @@ -1507,7 +1507,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(45)) { + if (IsSavegameVersionBefore(SLV_45)) { Vehicle *v; /* Originally just the fact that some cargo had been paid for was * stored to stop people cheating and cashing in several times. This @@ -1521,14 +1521,14 @@ bool AfterLoadGame() /* Buoys do now store the owner of the previous water tile, which can never * be OWNER_NONE. So replace OWNER_NONE with OWNER_WATER. */ - if (IsSavegameVersionBefore(46)) { + if (IsSavegameVersionBefore(SLV_46)) { Waypoint *wp; FOR_ALL_WAYPOINTS(wp) { if ((wp->facilities & FACIL_DOCK) != 0 && IsTileOwner(wp->xy, OWNER_NONE) && TileHeight(wp->xy) == 0) SetTileOwner(wp->xy, OWNER_WATER); } } - if (IsSavegameVersionBefore(50)) { + if (IsSavegameVersionBefore(SLV_50)) { Aircraft *v; /* Aircraft units changed from 8 mph to 1 km-ish/h */ FOR_ALL_AIRCRAFT(v) { @@ -1541,9 +1541,9 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(49)) FOR_ALL_COMPANIES(c) c->face = ConvertFromOldCompanyManagerFace(c->face); + if (IsSavegameVersionBefore(SLV_49)) FOR_ALL_COMPANIES(c) c->face = ConvertFromOldCompanyManagerFace(c->face); - if (IsSavegameVersionBefore(52)) { + if (IsSavegameVersionBefore(SLV_52)) { for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_OBJECT) && _m[t].m5 == OBJECT_STATUE) { _m[t].m2 = CalcClosestTownFromTile(t)->index; @@ -1554,7 +1554,7 @@ bool AfterLoadGame() /* A setting containing the proportion of towns that grow twice as * fast was added in version 54. From version 56 this is now saved in the * town as cities can be built specifically in the scenario editor. */ - if (IsSavegameVersionBefore(56)) { + if (IsSavegameVersionBefore(SLV_56)) { Town *t; FOR_ALL_TOWNS(t) { @@ -1564,7 +1564,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(57)) { + if (IsSavegameVersionBefore(SLV_57)) { Vehicle *v; /* Added a FIFO queue of vehicles loading at stations */ FOR_ALL_VEHICLES(v) { @@ -1578,7 +1578,7 @@ bool AfterLoadGame() ClrBit(v->vehicle_flags, VF_LOADING_FINISHED); } } - } else if (IsSavegameVersionBefore(59)) { + } else if (IsSavegameVersionBefore(SLV_59)) { /* For some reason non-loading vehicles could be in the station's loading vehicle list */ Station *st; @@ -1592,7 +1592,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(58)) { + if (IsSavegameVersionBefore(SLV_58)) { /* Setting difficulty industry_density other than zero get bumped to +1 * since a new option (very low at position 1) has been added */ if (_settings_game.difficulty.industry_density > 0) { @@ -1603,7 +1603,7 @@ bool AfterLoadGame() _settings_game.difficulty.number_towns++; } - if (IsSavegameVersionBefore(64)) { + if (IsSavegameVersionBefore(SLV_64)) { /* Since now we allow different signal types and variants on a single tile. * Move signal states to m4 to make room and clone the signal type/variant. */ for (TileIndex t = 0; t < map_size; t++) { @@ -1617,7 +1617,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(69)) { + if (IsSavegameVersionBefore(SLV_69)) { /* In some old savegames a bit was cleared when it should not be cleared */ RoadVehicle *rv; FOR_ALL_ROADVEHICLES(rv) { @@ -1627,7 +1627,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(70)) { + if (IsSavegameVersionBefore(SLV_70)) { /* Added variables to support newindustries */ Industry *i; FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE; @@ -1635,7 +1635,7 @@ bool AfterLoadGame() /* From version 82, old style canals (above sealevel (0), WATER owner) are no longer supported. Replace the owner for those by OWNER_NONE. */ - if (IsSavegameVersionBefore(82)) { + if (IsSavegameVersionBefore(SLV_82)) { for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_WATER) && GetWaterTileType(t) == WATER_TILE_CLEAR && @@ -1652,7 +1652,7 @@ bool AfterLoadGame() * someone can remove canals owned by somebody else and it prevents * making floods using the removal of ship depots. */ - if (IsSavegameVersionBefore(83)) { + if (IsSavegameVersionBefore(SLV_83)) { for (TileIndex t = 0; t < map_size; t++) { if (IsShipDepotTile(t)) { _m[t].m4 = (TileHeight(t) == 0) ? OWNER_WATER : OWNER_NONE; @@ -1660,7 +1660,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(74)) { + if (IsSavegameVersionBefore(SLV_74)) { Station *st; FOR_ALL_STATIONS(st) { for (CargoID c = 0; c < NUM_CARGO; c++) { @@ -1670,7 +1670,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(78)) { + if (IsSavegameVersionBefore(SLV_78)) { Industry *i; uint j; FOR_ALL_INDUSTRIES(i) { @@ -1688,7 +1688,7 @@ bool AfterLoadGame() * grassy trees were always drawn fully grassy. Furthermore, trees on rough * land used to have zero density, now they have full density. Therefore, * make all grassy/rough land trees have a density of 3. */ - if (IsSavegameVersionBefore(81)) { + if (IsSavegameVersionBefore(SLV_81)) { for (TileIndex t = 0; t < map_size; t++) { if (GetTileType(t) == MP_TREES) { TreeGround groundType = (TreeGround)GB(_m[t].m2, 4, 2); @@ -1698,7 +1698,7 @@ bool AfterLoadGame() } - if (IsSavegameVersionBefore(93)) { + if (IsSavegameVersionBefore(SLV_93)) { /* Rework of orders. */ Order *order; FOR_ALL_ORDERS(order) order->ConvertFromOldSavegame(); @@ -1715,7 +1715,7 @@ bool AfterLoadGame() FOR_VEHICLE_ORDERS(v, order) order->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); } } - } else if (IsSavegameVersionBefore(94)) { + } else if (IsSavegameVersionBefore(SLV_94)) { /* Unload and transfer are now mutual exclusive. */ Order *order; FOR_ALL_ORDERS(order) { @@ -1734,7 +1734,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(84)) { + if (IsSavegameVersionBefore(SLV_84)) { /* Set all share owners to INVALID_COMPANY for * 1) all inactive companies * (when inactive companies were stored in the savegame - TTD, TTDP and some @@ -1751,7 +1751,7 @@ bool AfterLoadGame() } /* The water class was moved/unified. */ - if (IsSavegameVersionBefore(146)) { + if (IsSavegameVersionBefore(SLV_146)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_STATION: @@ -1785,7 +1785,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(86)) { + if (IsSavegameVersionBefore(SLV_86)) { for (TileIndex t = 0; t < map_size; t++) { /* Move river flag and update canals to use water class */ if (IsTileType(t, MP_WATER)) { @@ -1816,7 +1816,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(87)) { + if (IsSavegameVersionBefore(SLV_87)) { for (TileIndex t = 0; t < map_size; t++) { /* skip oil rigs at borders! */ if ((IsTileType(t, MP_WATER) || IsBuoyTile(t)) && @@ -1854,13 +1854,13 @@ bool AfterLoadGame() } /* Convert old PF settings to new */ - if (_settings_game.pf.yapf.rail_use_yapf || IsSavegameVersionBefore(28)) { + if (_settings_game.pf.yapf.rail_use_yapf || IsSavegameVersionBefore(SLV_28)) { _settings_game.pf.pathfinder_for_trains = VPF_YAPF; } else { _settings_game.pf.pathfinder_for_trains = VPF_NPF; } - if (_settings_game.pf.yapf.road_use_yapf || IsSavegameVersionBefore(28)) { + if (_settings_game.pf.yapf.road_use_yapf || IsSavegameVersionBefore(SLV_28)) { _settings_game.pf.pathfinder_for_roadvehs = VPF_YAPF; } else { _settings_game.pf.pathfinder_for_roadvehs = VPF_NPF; @@ -1873,7 +1873,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(88)) { + if (IsSavegameVersionBefore(SLV_88)) { /* Profits are now with 8 bit fract */ Vehicle *v; FOR_ALL_VEHICLES(v) { @@ -1883,7 +1883,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(91)) { + if (IsSavegameVersionBefore(SLV_91)) { /* Increase HouseAnimationFrame from 5 to 7 bits */ for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_HOUSE) && GetHouseType(t) >= NEW_HOUSE_OFFSET) { @@ -1893,7 +1893,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(62)) { + if (IsSavegameVersionBefore(SLV_62)) { /* Remove all trams from savegames without tram support. * There would be trams without tram track under causing crashes sooner or later. */ RoadVehicle *v; @@ -1905,7 +1905,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(99)) { + if (IsSavegameVersionBefore(SLV_99)) { for (TileIndex t = 0; t < map_size; t++) { /* Set newly introduced WaterClass of industry tiles */ if (IsTileType(t, MP_STATION) && IsOilRig(t)) { @@ -1929,7 +1929,7 @@ bool AfterLoadGame() /* Move the signal variant back up one bit for PBS. We don't convert the old PBS * format here, as an old layout wouldn't work properly anyway. To be safe, we * clear any possible PBS reservations as well. */ - if (IsSavegameVersionBefore(100)) { + if (IsSavegameVersionBefore(SLV_100)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_RAILWAY: @@ -1967,21 +1967,21 @@ bool AfterLoadGame() } /* Reserve all tracks trains are currently on. */ - if (IsSavegameVersionBefore(101)) { + if (IsSavegameVersionBefore(SLV_101)) { const Train *t; FOR_ALL_TRAINS(t) { if (t->First() == t) t->ReserveTrackUnderConsist(); } } - if (IsSavegameVersionBefore(102)) { + if (IsSavegameVersionBefore(SLV_102)) { for (TileIndex t = 0; t < map_size; t++) { /* Now all crossings should be in correct state */ if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false); } } - if (IsSavegameVersionBefore(103)) { + if (IsSavegameVersionBefore(SLV_103)) { /* Non-town-owned roads now store the closest town */ UpdateNearestTownForRoadTiles(false); @@ -1999,7 +1999,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(104)) { + if (IsSavegameVersionBefore(SLV_104)) { Aircraft *a; FOR_ALL_AIRCRAFT(a) { /* Set engine_type of shadow and rotor */ @@ -2026,7 +2026,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(112)) { + if (IsSavegameVersionBefore(SLV_112)) { for (TileIndex t = 0; t < map_size; t++) { /* Check for HQ bit being set, instead of using map accessor, * since we've already changed it code-wise */ @@ -2038,7 +2038,7 @@ bool AfterLoadGame() } } } - if (IsSavegameVersionBefore(144)) { + if (IsSavegameVersionBefore(SLV_144)) { for (TileIndex t = 0; t < map_size; t++) { if (!IsTileType(t, MP_OBJECT)) continue; @@ -2053,7 +2053,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(147) && Object::GetNumItems() == 0) { + if (IsSavegameVersionBefore(SLV_147) && Object::GetNumItems() == 0) { /* Make real objects for object tiles. */ for (TileIndex t = 0; t < map_size; t++) { if (!IsTileType(t, MP_OBJECT)) continue; @@ -2097,7 +2097,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(113)) { + if (IsSavegameVersionBefore(SLV_113)) { /* allow_town_roads is added, set it if town_layout wasn't TL_NO_ROADS */ if (_settings_game.economy.town_layout == 0) { // was TL_NO_ROADS _settings_game.economy.allow_town_roads = false; @@ -2127,7 +2127,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(114)) { + if (IsSavegameVersionBefore(SLV_114)) { /* There could be (deleted) stations with invalid owner, set owner to OWNER NONE. * The conversion affects oil rigs and buoys too, but it doesn't matter as * they have st->owner == OWNER_NONE already. */ @@ -2138,14 +2138,14 @@ bool AfterLoadGame() } /* Trains could now stop in a specific location. */ - if (IsSavegameVersionBefore(117)) { + if (IsSavegameVersionBefore(SLV_117)) { Order *o; FOR_ALL_ORDERS(o) { if (o->IsType(OT_GOTO_STATION)) o->SetStopLocation(OSL_PLATFORM_FAR_END); } } - if (IsSavegameVersionBefore(120)) { + if (IsSavegameVersionBefore(SLV_120)) { extern VehicleDefaultSettings _old_vds; Company *c; FOR_ALL_COMPANIES(c) { @@ -2153,7 +2153,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(121)) { + if (IsSavegameVersionBefore(SLV_121)) { /* Delete small ufos heading for non-existing vehicles */ Vehicle *v; FOR_ALL_DISASTERVEHICLES(v) { @@ -2185,7 +2185,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(122)) { + if (IsSavegameVersionBefore(SLV_122)) { /* Animated tiles would sometimes not be actually animated or * in case of old savegames duplicate. */ @@ -2208,7 +2208,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(124) && !IsSavegameVersionBefore(1)) { + if (IsSavegameVersionBefore(SLV_124) && !IsSavegameVersionBefore(SLV_1)) { /* The train station tile area was added, but for really old (TTDPatch) it's already valid. */ Waypoint *wp; FOR_ALL_WAYPOINTS(wp) { @@ -2224,7 +2224,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(125)) { + if (IsSavegameVersionBefore(SLV_125)) { /* Convert old subsidies */ Subsidy *s; FOR_ALL_SUBSIDIES(s) { @@ -2284,7 +2284,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(126)) { + if (IsSavegameVersionBefore(SLV_126)) { /* Recompute inflation based on old unround loan limit * Note: Max loan is 500000. With an inflation of 4% across 170 years * that results in a max loan of about 0.7 * 2^31. @@ -2302,7 +2302,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(128)) { + if (IsSavegameVersionBefore(SLV_128)) { const Depot *d; FOR_ALL_DEPOTS(d) { _m[d->xy].m2 = d->index; @@ -2312,7 +2312,7 @@ bool AfterLoadGame() /* The behaviour of force_proceed has been changed. Now * it counts signals instead of some random time out. */ - if (IsSavegameVersionBefore(131)) { + if (IsSavegameVersionBefore(SLV_131)) { Train *t; FOR_ALL_TRAINS(t) { if (t->force_proceed != TFP_NONE) { @@ -2323,7 +2323,7 @@ bool AfterLoadGame() /* The bits for the tree ground and tree density have * been swapped (m2 bits 7..6 and 5..4. */ - if (IsSavegameVersionBefore(135)) { + if (IsSavegameVersionBefore(SLV_135)) { for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_CLEAR)) { if (GetRawClearGround(t) == CLEAR_SNOW) { @@ -2343,7 +2343,7 @@ bool AfterLoadGame() } /* Wait counter and load/unload ticks got split. */ - if (IsSavegameVersionBefore(136)) { + if (IsSavegameVersionBefore(SLV_136)) { Aircraft *a; FOR_ALL_AIRCRAFT(a) { a->turn_counter = a->current_order.IsType(OT_LOADING) ? 0 : a->load_unload_ticks; @@ -2356,7 +2356,7 @@ bool AfterLoadGame() } /* Airport tile animation uses animation frame instead of other graphics id */ - if (IsSavegameVersionBefore(137)) { + if (IsSavegameVersionBefore(SLV_137)) { struct AirportTileConversion { byte old_start; byte num_frames; @@ -2392,7 +2392,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(140)) { + if (IsSavegameVersionBefore(SLV_140)) { Station *st; FOR_ALL_STATIONS(st) { if (st->airport.tile != INVALID_TILE) { @@ -2402,7 +2402,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(141)) { + if (IsSavegameVersionBefore(SLV_141)) { for (TileIndex t = 0; t < map_size; t++) { /* Reset tropic zone for VOID tiles, they shall not have any. */ if (IsTileType(t, MP_VOID)) SetTropicZone(t, TROPICZONE_NORMAL); @@ -2417,7 +2417,7 @@ bool AfterLoadGame() FOR_ALL_DEPOTS(d) MakeDefaultName(d); } - if (IsSavegameVersionBefore(142)) { + if (IsSavegameVersionBefore(SLV_142)) { Depot *d; FOR_ALL_DEPOTS(d) d->build_date = _date; } @@ -2427,7 +2427,7 @@ bool AfterLoadGame() * another airport in the same station so we don't allow that anymore. * For old savegames with such aircraft we just throw them in the air and * treat the aircraft like they were flying already. */ - if (IsSavegameVersionBefore(146)) { + if (IsSavegameVersionBefore(SLV_146)) { Aircraft *v; FOR_ALL_AIRCRAFT(v) { if (!v->IsNormalAircraft()) continue; @@ -2446,7 +2446,7 @@ bool AfterLoadGame() } /* Move the animation frame to the same location (m7) for all objects. */ - if (IsSavegameVersionBefore(147)) { + if (IsSavegameVersionBefore(SLV_147)) { for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_HOUSE: @@ -2478,7 +2478,7 @@ bool AfterLoadGame() } /* Add (random) colour to all objects. */ - if (IsSavegameVersionBefore(148)) { + if (IsSavegameVersionBefore(SLV_148)) { Object *o; FOR_ALL_OBJECTS(o) { Owner owner = GetTileOwner(o->location.tile); @@ -2486,7 +2486,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(149)) { + if (IsSavegameVersionBefore(SLV_149)) { for (TileIndex t = 0; t < map_size; t++) { if (!IsTileType(t, MP_STATION)) continue; if (!IsBuoy(t) && !IsOilRig(t) && !(IsDock(t) && IsTileFlat(t))) { @@ -2508,7 +2508,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(152)) { + if (IsSavegameVersionBefore(SLV_152)) { _industry_builder.Reset(); // Initialize industry build data. /* The moment vehicles go from hidden to visible changed. This means @@ -2577,7 +2577,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(153)) { + if (IsSavegameVersionBefore(SLV_153)) { RoadVehicle *rv; FOR_ALL_ROADVEHICLES(rv) { if (rv->state == RVSB_IN_DEPOT || rv->state == RVSB_WORMHOLE) continue; @@ -2592,7 +2592,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(156)) { + if (IsSavegameVersionBefore(SLV_156)) { /* The train's pathfinder lost flag got moved. */ Train *t; FOR_ALL_TRAINS(t) { @@ -2610,7 +2610,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(158)) { + if (IsSavegameVersionBefore(SLV_158)) { Vehicle *v; FOR_ALL_VEHICLES(v) { switch (v->type) { @@ -2707,14 +2707,14 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(159)) { + if (IsSavegameVersionBefore(SLV_159)) { /* If the savegame is old (before version 100), then the value of 255 * for these settings did not mean "disabled". As such everything * before then did reverse. * To simplify stuff we disable all turning around or we do not * disable anything at all. So, if some reversing was disabled we * will keep reversing disabled, otherwise it'll be turned on. */ - _settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255); + _settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(SLV_100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255); Train *t; FOR_ALL_TRAINS(t) { @@ -2722,7 +2722,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(160)) { + if (IsSavegameVersionBefore(SLV_160)) { /* Setting difficulty industry_density other than zero get bumped to +1 * since a new option (minimal at position 1) has been added */ if (_settings_game.difficulty.industry_density > 0) { @@ -2730,10 +2730,10 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(161)) { + if (IsSavegameVersionBefore(SLV_161)) { /* Before savegame version 161, persistent storages were not stored in a pool. */ - if (!IsSavegameVersionBefore(76)) { + if (!IsSavegameVersionBefore(SLV_76)) { Industry *ind; FOR_ALL_INDUSTRIES(ind) { assert(ind->psa != NULL); @@ -2756,7 +2756,7 @@ bool AfterLoadGame() } } - if (!IsSavegameVersionBefore(145)) { + if (!IsSavegameVersionBefore(SLV_145)) { Station *st; FOR_ALL_STATIONS(st) { if (!(st->facilities & FACIL_AIRPORT)) continue; @@ -2783,11 +2783,11 @@ bool AfterLoadGame() } /* This triggers only when old snow_lines were copied into the snow_line_height. */ - if (IsSavegameVersionBefore(164) && _settings_game.game_creation.snow_line_height >= MIN_SNOWLINE_HEIGHT * TILE_HEIGHT) { + if (IsSavegameVersionBefore(SLV_164) && _settings_game.game_creation.snow_line_height >= MIN_SNOWLINE_HEIGHT * TILE_HEIGHT) { _settings_game.game_creation.snow_line_height /= TILE_HEIGHT; } - if (IsSavegameVersionBefore(164) && !IsSavegameVersionBefore(32)) { + if (IsSavegameVersionBefore(SLV_164) && !IsSavegameVersionBefore(SLV_32)) { /* We store 4 fences in the field tiles instead of only SE and SW. */ for (TileIndex t = 0; t < map_size; t++) { if (!IsTileType(t, MP_CLEAR) && !IsTileType(t, MP_TREES)) continue; @@ -2806,9 +2806,9 @@ bool AfterLoadGame() } /* The center of train vehicles was changed, fix up spacing. */ - if (IsSavegameVersionBefore(164)) FixupTrainLengths(); + if (IsSavegameVersionBefore(SLV_164)) FixupTrainLengths(); - if (IsSavegameVersionBefore(165)) { + if (IsSavegameVersionBefore(SLV_165)) { Town *t; FOR_ALL_TOWNS(t) { @@ -2826,7 +2826,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(165)) { + if (IsSavegameVersionBefore(SLV_165)) { /* Adjust zoom level to account for new levels */ _saved_scrollpos_zoom = _saved_scrollpos_zoom + ZOOM_LVL_SHIFT; _saved_scrollpos_x *= ZOOM_LVL_BASE; @@ -2838,7 +2838,7 @@ bool AfterLoadGame() * which is done by StartupEngines(). */ if (gcf_res != GLC_ALL_GOOD) StartupEngines(); - if (IsSavegameVersionBefore(166)) { + if (IsSavegameVersionBefore(SLV_166)) { /* Update cargo acceptance map of towns. */ for (TileIndex t = 0; t < map_size; t++) { if (!IsTileType(t, MP_HOUSE)) continue; @@ -2852,7 +2852,7 @@ bool AfterLoadGame() } /* The road owner of standard road stops was not properly accounted for. */ - if (IsSavegameVersionBefore(172)) { + if (IsSavegameVersionBefore(SLV_172)) { for (TileIndex t = 0; t < map_size; t++) { if (!IsStandardRoadStopTile(t)) continue; Owner o = GetTileOwner(t); @@ -2861,13 +2861,13 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(175)) { + if (IsSavegameVersionBefore(SLV_175)) { /* Introduced tree planting limit. */ Company *c; FOR_ALL_COMPANIES(c) c->tree_limit = _settings_game.construction.tree_frame_burst << 16; } - if (IsSavegameVersionBefore(177)) { + if (IsSavegameVersionBefore(SLV_177)) { /* Fix too high inflation rates */ if (_economy.inflation_prices > MAX_INFLATION) _economy.inflation_prices = MAX_INFLATION; if (_economy.inflation_payment > MAX_INFLATION) _economy.inflation_payment = MAX_INFLATION; @@ -2878,13 +2878,13 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(178)) { + if (IsSavegameVersionBefore(SLV_178)) { extern uint8 _old_diff_level; /* Initialise script settings profile */ _settings_game.script.settings_profile = IsInsideMM(_old_diff_level, SP_BEGIN, SP_END) ? _old_diff_level : (uint)SP_MEDIUM; } - if (IsSavegameVersionBefore(182)) { + if (IsSavegameVersionBefore(SLV_182)) { Aircraft *v; /* Aircraft acceleration variable was bonkers */ FOR_ALL_AIRCRAFT(v) { @@ -2903,7 +2903,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(184)) { + if (IsSavegameVersionBefore(SLV_184)) { /* The global units configuration is split up in multiple configurations. */ extern uint8 _old_units; _settings_game.locale.units_velocity = Clamp(_old_units, 0, 2); @@ -2914,7 +2914,7 @@ bool AfterLoadGame() _settings_game.locale.units_height = Clamp(_old_units, 0, 2); } - if (IsSavegameVersionBefore(186)) { + if (IsSavegameVersionBefore(SLV_186)) { /* Move ObjectType from map to pool */ for (TileIndex t = 0; t < map_size; t++) { if (IsTileType(t, MP_OBJECT)) { @@ -2925,7 +2925,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(188)) { + if (IsSavegameVersionBefore(SLV_188)) { /* Fix articulated road vehicles. * Some curves were shorter than other curves. * Now they have the same length, but that means that trailing articulated parts will @@ -2988,9 +2988,9 @@ bool AfterLoadGame() * Only keep order-backups for network clients (and when replaying). * If we are a network server or not networking, then we just loaded a previously * saved-by-server savegame. There are no clients with a backup, so clear it. - * Furthermore before savegame version 192 the actual content was always corrupt. + * Furthermore before savegame version SLV_192 the actual content was always corrupt. */ - if (!_networking || _network_server || IsSavegameVersionBefore(192)) { + if (!_networking || _network_server || IsSavegameVersionBefore(SLV_192)) { #ifndef DEBUG_DUMP_COMMANDS /* Note: We cannot use CleanPool since that skips part of the destructor * and then leaks un-reachable Orders in the order pool. */ @@ -3001,7 +3001,7 @@ bool AfterLoadGame() #endif } - if (IsSavegameVersionBefore(198)) { + if (IsSavegameVersionBefore(SLV_198)) { /* Convert towns growth_rate and grow_counter to ticks */ Town *t; FOR_ALL_TOWNS(t) { @@ -3015,7 +3015,7 @@ bool AfterLoadGame() } } - if (IsSavegameVersionBefore(202)) { + if (IsSavegameVersionBefore(SLV_202)) { /* Make sure added industry cargo slots are cleared */ Industry *i; FOR_ALL_INDUSTRIES(i) { @@ -3046,7 +3046,7 @@ bool AfterLoadGame() } /* Station acceptance is some kind of cache */ - if (IsSavegameVersionBefore(127)) { + if (IsSavegameVersionBefore(SLV_127)) { Station *st; FOR_ALL_STATIONS(st) UpdateStationAcceptance(st, false); } diff --git a/src/saveload/ai_sl.cpp b/src/saveload/ai_sl.cpp index e8b5339c0..2492bb666 100644 --- a/src/saveload/ai_sl.cpp +++ b/src/saveload/ai_sl.cpp @@ -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() }; diff --git a/src/saveload/animated_tile_sl.cpp b/src/saveload/animated_tile_sl.cpp index 2152c42e3..c54c4724a 100644 --- a/src/saveload/animated_tile_sl.cpp +++ b/src/saveload/animated_tile_sl.cpp @@ -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; diff --git a/src/saveload/autoreplace_sl.cpp b/src/saveload/autoreplace_sl.cpp index 99e945503..1798df1ad 100644 --- a/src/saveload/autoreplace_sl.cpp +++ b/src/saveload/autoreplace_sl.cpp @@ -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; } } diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp index 9ed6e9e0d..e3f372e9a 100644 --- a/src/saveload/cargopacket_sl.cpp +++ b/src/saveload/cargopacket_sl.cpp @@ -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() }; diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp index 985293369..882a0265b 100644 --- a/src/saveload/company_sl.cpp +++ b/src/saveload/company_sl.cpp @@ -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, 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, 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, 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, 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, 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, 0, 69), - SLE_CONDNULL(4, 69, 107), - - SLE_CONDNULL(18, 0, 107), - SLE_CONDNULL(20, 0, 107), - SLE_CONDNULL(32, 0, 107), - - SLE_CONDNULL(64, 2, 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, 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, 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, SL_MIN_VERSION, SLV_69), + SLE_CONDNULL(4, SLV_69, SLV_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, 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; } diff --git a/src/saveload/depot_sl.cpp b/src/saveload/depot_sl.cpp index 14a255779..b92417693 100644 --- a/src/saveload/depot_sl.cpp +++ b/src/saveload/depot_sl.cpp @@ -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); } } diff --git a/src/saveload/economy_sl.cpp b/src/saveload/economy_sl.cpp index 997a7ae6e..10ca8ec44 100644 --- a/src/saveload/economy_sl.cpp +++ b/src/saveload/economy_sl.cpp @@ -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() }; diff --git a/src/saveload/engine_sl.cpp b/src/saveload/engine_sl.cpp index d9552bded..5221d1bbd 100644 --- a/src/saveload/engine_sl.cpp +++ b/src/saveload/engine_sl.cpp @@ -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 diff --git a/src/saveload/goal_sl.cpp b/src/saveload/goal_sl.cpp index 4d1441787..a8cdc2305 100644 --- a/src/saveload/goal_sl.cpp +++ b/src/saveload/goal_sl.cpp @@ -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() }; diff --git a/src/saveload/group_sl.cpp b/src/saveload/group_sl.cpp index 9142cceea..31788141d 100644 --- a/src/saveload/group_sl.cpp +++ b/src/saveload/group_sl.cpp @@ -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; diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp index 7fe667f42..ba250603a 100644 --- a/src/saveload/industry_sl.cpp +++ b/src/saveload/industry_sl.cpp @@ -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); diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp index 93959370c..76390a010 100644 --- a/src/saveload/linkgraph_sl.cpp +++ b/src/saveload/linkgraph_sl.cpp @@ -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) { diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp index 693ddb7ce..5402ecc0d 100644 --- a/src/saveload/map_sl.cpp +++ b/src/saveload/map_sl.cpp @@ -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); diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp index 0be1077a7..cca3365b5 100644 --- a/src/saveload/misc_sl.cpp +++ b/src/saveload/misc_sl.cpp @@ -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() }; diff --git a/src/saveload/newgrf_sl.cpp b/src/saveload/newgrf_sl.cpp index de261f02a..e40b45926 100644 --- a/src/saveload/newgrf_sl.cpp +++ b/src/saveload/newgrf_sl.cpp @@ -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); } } diff --git a/src/saveload/object_sl.cpp b/src/saveload/object_sl.cpp index dfb1d2cbf..6b0b99e47 100644 --- a/src/saveload/object_sl.cpp +++ b/src/saveload/object_sl.cpp @@ -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; } diff --git a/src/saveload/order_sl.cpp b/src/saveload/order_sl.cpp index a56e56892..b89514d47 100644 --- a/src/saveload/order_sl.cpp +++ b/src/saveload/order_sl.cpp @@ -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() }; diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index b20e996ca..1d5eff8ba 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -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' diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 8a2eeead2..f14f884d5 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -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; diff --git a/src/saveload/signs_sl.cpp b/src/saveload/signs_sl.cpp index 6b838cfc1..545c628b3 100644 --- a/src/saveload/signs_sl.cpp +++ b/src/saveload/signs_sl.cpp @@ -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; } } diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index d9c026cd4..57f3bfdfb 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -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); diff --git a/src/saveload/storage_sl.cpp b/src/saveload/storage_sl.cpp index 30d438614..1c6c44248 100644 --- a/src/saveload/storage_sl.cpp +++ b/src/saveload/storage_sl.cpp @@ -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() }; diff --git a/src/saveload/story_sl.cpp b/src/saveload/story_sl.cpp index cbfc847b6..f9bbf34b9 100644 --- a/src/saveload/story_sl.cpp +++ b/src/saveload/story_sl.cpp @@ -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() }; diff --git a/src/saveload/strings_sl.cpp b/src/saveload/strings_sl.cpp index aa2fdd3e6..d8fe81d11 100644 --- a/src/saveload/strings_sl.cpp +++ b/src/saveload/strings_sl.cpp @@ -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); diff --git a/src/saveload/subsidy_sl.cpp b/src/saveload/subsidy_sl.cpp index d796bda1a..6f10ec8d0 100644 --- a/src/saveload/subsidy_sl.cpp +++ b/src/saveload/subsidy_sl.cpp @@ -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() }; diff --git a/src/saveload/town_sl.cpp b/src/saveload/town_sl.cpp index 8a8d4a9f7..cbfdad0bb 100644 --- a/src/saveload/town_sl.cpp +++ b/src/saveload/town_sl.cpp @@ -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) { diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index e2816e8d8..d97b01d5e 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -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, 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, 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, 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_CONDREF(Vehicle, orders, REF_ORDER, 0, 105), - SLE_CONDREF(Vehicle, orders, REF_ORDERLIST, 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, 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, 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, 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, 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, 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, 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; } } diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp index c525566b8..ae74d812b 100644 --- a/src/saveload/waypoint_sl.cpp +++ b/src/saveload/waypoint_sl.cpp @@ -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); } } diff --git a/src/settings.cpp b/src/settings.cpp index d16cff7a1..41d3e2809 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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. */ diff --git a/src/table/company_settings.ini b/src/table/company_settings.ini index 71b95cc39..a6e873f65 100644 --- a/src/table/company_settings.ini +++ b/src/table/company_settings.ini @@ -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 diff --git a/src/table/currency_settings.ini b/src/table/currency_settings.ini index dede8b0fb..bcce65801 100644 --- a/src/table/currency_settings.ini +++ b/src/table/currency_settings.ini @@ -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 diff --git a/src/table/gameopt_settings.ini b/src/table/gameopt_settings.ini index ef38b15ff..624d475c3 100644 --- a/src/table/gameopt_settings.ini +++ b/src/table/gameopt_settings.ini @@ -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 diff --git a/src/table/misc_settings.ini b/src/table/misc_settings.ini index 52ca2d16e..b710478fb 100644 --- a/src/table/misc_settings.ini +++ b/src/table/misc_settings.ini @@ -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 diff --git a/src/table/settings.ini b/src/table/settings.ini index 0d3109ad5..2b36e32b7 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -89,7 +89,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 @@ -101,7 +101,7 @@ cat = SC_ADVANCED base = GameSettings var = difficulty.max_no_competitors type = SLE_UINT8 -from = 97 +from = SLV_97 def = 0 min = 0 max = MAX_COMPANIES - 1 @@ -111,14 +111,14 @@ cat = SC_BASIC [SDT_NULL] length = 1 -from = 97 -to = 110 +from = SLV_97 +to = SLV_110 [SDT_VAR] base = GameSettings var = difficulty.number_towns type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_NEWGAME_ONLY def = 2 min = 0 @@ -131,7 +131,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.industry_density type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING def = ID_END - 1 min = 0 @@ -146,7 +146,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.max_loan type = SLE_UINT32 -from = 97 +from = SLV_97 guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO | SGF_CURRENCY def = 300000 min = 100000 @@ -161,7 +161,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.initial_interest type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO def = 2 min = 2 @@ -175,7 +175,7 @@ strval = STR_CONFIG_SETTING_PERCENTAGE base = GameSettings var = difficulty.vehicle_costs type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO | SGF_MULTISTRING def = 0 min = 0 @@ -190,7 +190,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.competitor_speed type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING def = 2 min = 0 @@ -203,14 +203,14 @@ cat = SC_BASIC [SDT_NULL] length = 1 -from = 97 -to = 110 +from = SLV_97 +to = SLV_110 [SDT_VAR] base = GameSettings var = difficulty.vehicle_breakdowns type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING def = 1 min = 0 @@ -225,7 +225,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.subsidy_multiplier type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING def = 2 min = 0 @@ -239,7 +239,7 @@ strval = STR_SUBSIDY_X1_5 base = GameSettings var = difficulty.construction_cost type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO | SGF_MULTISTRING def = 0 min = 0 @@ -254,7 +254,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.terrain_type type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY def = 1 min = 0 @@ -269,7 +269,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.quantity_sea_lakes type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_NEWGAME_ONLY def = 0 min = 0 @@ -281,7 +281,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = difficulty.economy -from = 97 +from = SLV_97 def = false str = STR_CONFIG_SETTING_RECESSIONS strhelp = STR_CONFIG_SETTING_RECESSIONS_HELPTEXT @@ -289,7 +289,7 @@ strhelp = STR_CONFIG_SETTING_RECESSIONS_HELPTEXT [SDT_BOOL] base = GameSettings var = difficulty.line_reverse_mode -from = 97 +from = SLV_97 def = false str = STR_CONFIG_SETTING_TRAIN_REVERSING strhelp = STR_CONFIG_SETTING_TRAIN_REVERSING_HELPTEXT @@ -297,7 +297,7 @@ strhelp = STR_CONFIG_SETTING_TRAIN_REVERSING_HELPTEXT [SDT_BOOL] base = GameSettings var = difficulty.disasters -from = 97 +from = SLV_97 def = false str = STR_CONFIG_SETTING_DISASTERS strhelp = STR_CONFIG_SETTING_DISASTERS_HELPTEXT @@ -307,7 +307,7 @@ cat = SC_BASIC base = GameSettings var = difficulty.town_council_tolerance type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING def = 0 min = 0 @@ -323,8 +323,8 @@ name = ""diff_level"" var = _old_diff_level type = SLE_UINT8 flags = SLF_NOT_IN_CONFIG -from = 97 -to = 178 +from = SLV_97 +to = SLV_178 def = 3 min = 0 max = 3 @@ -336,7 +336,7 @@ cat = SC_BASIC base = GameSettings var = game_creation.town_name type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_NO_NETWORK def = 0 max = 255 @@ -347,7 +347,7 @@ cat = SC_BASIC base = GameSettings var = game_creation.landscape type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY def = 0 max = 3 @@ -361,14 +361,14 @@ cat = SC_BASIC ; Snow line (or snow_line_height * TILE_HEIGHT) [SDT_NULL] length = 1 -from = 97 -to = 164 +from = SLV_97 +to = SLV_164 [SDT_OMANY] base = GameSettings var = vehicle.road_side type = SLE_UINT8 -from = 97 +from = SLV_97 guiflags = SGF_MULTISTRING | SGF_NO_NETWORK def = 1 max = 1 @@ -384,7 +384,7 @@ proc = CheckRoadSide base = GameSettings var = construction.max_heightlevel type = SLE_UINT8 -from = 194 +from = SLV_194 guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO def = DEF_MAX_HEIGHTLEVEL min = MIN_MAX_HEIGHTLEVEL @@ -407,7 +407,7 @@ cat = SC_EXPERT base = GameSettings var = construction.command_pause_level type = SLE_UINT8 -from = 154 +from = SLV_154 guiflags = SGF_MULTISTRING | SGF_NO_NETWORK def = 1 min = 0 @@ -421,7 +421,7 @@ strval = STR_CONFIG_SETTING_COMMAND_PAUSE_LEVEL_NO_ACTIONS base = GameSettings var = construction.terraform_per_64k_frames type = SLE_UINT32 -from = 156 +from = SLV_156 def = 64 << 16 min = 0 max = 1 << 30 @@ -432,7 +432,7 @@ cat = SC_EXPERT base = GameSettings var = construction.terraform_frame_burst type = SLE_UINT16 -from = 156 +from = SLV_156 def = 4096 min = 0 max = 1 << 30 @@ -443,7 +443,7 @@ cat = SC_EXPERT base = GameSettings var = construction.clear_per_64k_frames type = SLE_UINT32 -from = 156 +from = SLV_156 def = 64 << 16 min = 0 max = 1 << 30 @@ -454,7 +454,7 @@ cat = SC_EXPERT base = GameSettings var = construction.clear_frame_burst type = SLE_UINT16 -from = 156 +from = SLV_156 def = 4096 min = 0 max = 1 << 30 @@ -465,7 +465,7 @@ cat = SC_EXPERT base = GameSettings var = construction.tree_per_64k_frames type = SLE_UINT32 -from = 175 +from = SLV_175 def = 64 << 16 min = 0 max = 1 << 30 @@ -476,7 +476,7 @@ cat = SC_EXPERT base = GameSettings var = construction.tree_frame_burst type = SLE_UINT16 -from = 175 +from = SLV_175 def = 4096 min = 0 max = 1 << 30 @@ -486,7 +486,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = construction.autoslope -from = 75 +from = SLV_75 def = true str = STR_CONFIG_SETTING_AUTOSLOPE strhelp = STR_CONFIG_SETTING_AUTOSLOPE_HELPTEXT @@ -503,7 +503,7 @@ strhelp = STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT base = GameSettings var = construction.max_bridge_length type = SLE_UINT16 -from = 159 +from = SLV_159 guiflags = SGF_NO_NETWORK def = 64 min = 1 @@ -517,7 +517,7 @@ strval = STR_CONFIG_SETTING_TILE_LENGTH base = GameSettings var = construction.max_bridge_height type = SLE_UINT8 -from = 194 +from = SLV_194 guiflags = SGF_NO_NETWORK def = 12 min = 1 @@ -532,7 +532,7 @@ cat = SC_EXPERT base = GameSettings var = construction.max_tunnel_length type = SLE_UINT16 -from = 159 +from = SLV_159 guiflags = SGF_NO_NETWORK def = 64 min = 1 @@ -545,7 +545,7 @@ strval = STR_CONFIG_SETTING_TILE_LENGTH # construction.longbridges [SDT_NULL] length = 1 -to = 159 +to = SLV_159 [SDT_VAR] base = GameSettings @@ -573,7 +573,7 @@ strhelp = STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT base = GameSettings var = economy.town_layout type = SLE_UINT8 -from = 59 +from = SLV_59 guiflags = SGF_MULTISTRING def = TL_ORIGINAL min = TL_BEGIN @@ -587,7 +587,7 @@ proc = TownFoundingChanged [SDT_BOOL] base = GameSettings var = economy.allow_town_roads -from = 113 +from = SLV_113 guiflags = SGF_NO_NETWORK def = true str = STR_CONFIG_SETTING_ALLOW_TOWN_ROADS @@ -597,7 +597,7 @@ strhelp = STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT base = GameSettings var = economy.found_town type = SLE_UINT8 -from = 128 +from = SLV_128 guiflags = SGF_MULTISTRING def = TF_FORBIDDEN min = TF_BEGIN @@ -612,7 +612,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = economy.allow_town_level_crossings -from = 143 +from = SLV_143 guiflags = SGF_NO_NETWORK def = true str = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS @@ -624,7 +624,7 @@ strhelp = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT base = GameSettings var = linkgraph.recalc_interval type = SLE_UINT16 -from = 183 +from = SLV_183 def = 4 min = 2 max = 32 @@ -637,7 +637,7 @@ strhelp = STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT base = GameSettings var = linkgraph.recalc_time type = SLE_UINT16 -from = 183 +from = SLV_183 def = 16 min = 1 max = 4096 @@ -650,7 +650,7 @@ strhelp = STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT base = GameSettings var = linkgraph.distribution_pax type = SLE_UINT8 -from = 183 +from = SLV_183 guiflags = SGF_MULTISTRING def = DT_MANUAL min = DT_MIN @@ -664,7 +664,7 @@ strhelp = STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT base = GameSettings var = linkgraph.distribution_mail type = SLE_UINT8 -from = 183 +from = SLV_183 guiflags = SGF_MULTISTRING def = DT_MANUAL min = DT_MIN @@ -678,7 +678,7 @@ strhelp = STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT base = GameSettings var = linkgraph.distribution_armoured type = SLE_UINT8 -from = 183 +from = SLV_183 guiflags = SGF_MULTISTRING def = DT_MANUAL min = DT_MIN @@ -692,7 +692,7 @@ strhelp = STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT base = GameSettings var = linkgraph.distribution_default type = SLE_UINT8 -from = 183 +from = SLV_183 guiflags = SGF_MULTISTRING def = DT_MANUAL min = DT_BEGIN @@ -706,7 +706,7 @@ strhelp = STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT base = GameSettings var = linkgraph.accuracy type = SLE_UINT8 -from = 183 +from = SLV_183 def = 16 min = 2 max = 64 @@ -719,7 +719,7 @@ strhelp = STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT base = GameSettings var = linkgraph.demand_distance type = SLE_UINT8 -from = 183 +from = SLV_183 def = 100 min = 0 max = 255 @@ -732,7 +732,7 @@ strhelp = STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT base = GameSettings var = linkgraph.demand_size type = SLE_UINT8 -from = 183 +from = SLV_183 def = 100 min = 0 max = 100 @@ -745,7 +745,7 @@ strhelp = STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT base = GameSettings var = linkgraph.short_path_saturation type = SLE_UINT8 -from = 183 +from = SLV_183 def = 80 min = 0 max = 250 @@ -774,7 +774,7 @@ proc = TrainAccelerationModelChanged base = GameSettings var = vehicle.roadveh_acceleration_model type = SLE_UINT8 -from = 139 +from = SLV_139 guiflags = SGF_MULTISTRING def = 1 min = 0 @@ -789,7 +789,7 @@ proc = RoadVehAccelerationModelChanged base = GameSettings var = vehicle.train_slope_steepness type = SLE_UINT8 -from = 133 +from = SLV_133 def = 3 min = 0 max = 10 @@ -804,7 +804,7 @@ cat = SC_EXPERT base = GameSettings var = vehicle.roadveh_slope_steepness type = SLE_UINT8 -from = 139 +from = SLV_139 def = 7 min = 0 max = 10 @@ -828,7 +828,7 @@ cat = SC_EXPERT base = GameSettings var = vehicle.max_train_length type = SLE_UINT8 -from = 159 +from = SLV_159 def = 7 min = 1 max = 64 @@ -841,13 +841,13 @@ cat = SC_BASIC ; vehicle.mammoth_trains [SDT_NULL] length = 1 -to = 159 +to = SLV_159 [SDT_VAR] base = GameSettings var = vehicle.smoke_amount type = SLE_UINT8 -from = 145 +from = SLV_145 guiflags = SGF_MULTISTRING def = 1 min = 0 @@ -859,7 +859,7 @@ strval = STR_CONFIG_SETTING_NONE ; order.gotodepot [SDT_NULL] length = 1 -to = 159 +to = SLV_159 ; path finder @@ -872,31 +872,31 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.new_pathfinding_all -to = 87 +to = SLV_87 def = false cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.yapf.ship_use_yapf -from = 28 -to = 87 +from = SLV_28 +to = SLV_87 def = false cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.yapf.road_use_yapf -from = 28 -to = 87 +from = SLV_28 +to = SLV_87 def = true cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.yapf.rail_use_yapf -from = 28 -to = 87 +from = SLV_28 +to = SLV_87 def = true cat = SC_EXPERT @@ -905,7 +905,7 @@ cat = SC_EXPERT base = GameSettings var = pf.pathfinder_for_trains type = SLE_UINT8 -from = 87 +from = SLV_87 guiflags = SGF_MULTISTRING def = 2 min = 1 @@ -920,7 +920,7 @@ cat = SC_EXPERT base = GameSettings var = pf.pathfinder_for_roadvehs type = SLE_UINT8 -from = 87 +from = SLV_87 guiflags = SGF_MULTISTRING def = 2 min = 1 @@ -935,7 +935,7 @@ cat = SC_EXPERT base = GameSettings var = pf.pathfinder_for_ships type = SLE_UINT8 -from = 87 +from = SLV_87 guiflags = SGF_MULTISTRING def = 2 min = 0 @@ -1012,7 +1012,7 @@ name = NULL guiflags = SGF_NO_NETWORK var = _old_vds.servint_ispercent def = false -to = 120 +to = SLV_120 [SDTG_VAR] name = NULL @@ -1022,7 +1022,7 @@ var = _old_vds.servint_trains def = 150 min = 5 max = 800 -to = 120 +to = SLV_120 [SDTG_VAR] name = NULL @@ -1032,7 +1032,7 @@ var = _old_vds.servint_roadveh def = 150 min = 5 max = 800 -to = 120 +to = SLV_120 [SDTG_VAR] name = NULL @@ -1042,7 +1042,7 @@ var = _old_vds.servint_ships def = 360 min = 5 max = 800 -to = 120 +to = SLV_120 [SDTG_VAR] name = NULL @@ -1052,7 +1052,7 @@ var = _old_vds.servint_aircraft def = 150 min = 5 max = 800 -to = 120 +to = SLV_120 [SDT_BOOL] base = GameSettings @@ -1073,7 +1073,7 @@ proc = UpdateConsists [SDT_BOOL] base = GameSettings var = vehicle.disable_elrails -from = 38 +from = SLV_38 guiflags = SGF_NO_NETWORK def = false str = STR_CONFIG_SETTING_DISABLE_ELRAILS @@ -1085,7 +1085,7 @@ cat = SC_EXPERT base = GameSettings var = vehicle.freight_trains type = SLE_UINT8 -from = 39 +from = SLV_39 guiflags = SGF_NO_NETWORK def = 1 min = 1 @@ -1099,14 +1099,14 @@ proc = UpdateConsists ; order.timetabling [SDT_NULL] length = 1 -from = 67 -to = 159 +from = SLV_67 +to = SLV_159 [SDT_VAR] base = GameSettings var = vehicle.plane_speed type = SLE_UINT8 -from = 90 +from = SLV_90 guiflags = SGF_NO_NETWORK def = 4 min = 1 @@ -1118,7 +1118,7 @@ strval = STR_CONFIG_SETTING_PLANE_SPEED_VALUE [SDT_BOOL] base = GameSettings var = vehicle.dynamic_engines -from = 95 +from = SLV_95 guiflags = SGF_NO_NETWORK def = true proc = ChangeDynamicEngines @@ -1128,7 +1128,7 @@ cat = SC_EXPERT base = GameSettings var = vehicle.plane_crashes type = SLE_UINT8 -from = 138 +from = SLV_138 guiflags = SGF_MULTISTRING def = 2 min = 0 @@ -1142,12 +1142,12 @@ cat = SC_BASIC ; station.join_stations [SDT_NULL] length = 1 -to = 159 +to = SLV_159 [SDTC_BOOL] var = gui.sg_full_load_any -from = 22 -to = 93 +from = SLV_22 +to = SLV_93 def = true [SDT_BOOL] @@ -1165,14 +1165,14 @@ cat = SC_EXPERT [SDTC_BOOL] var = gui.sg_new_nonstop -from = 22 -to = 93 +from = SLV_22 +to = SLV_93 def = false ; station.nonuniform_stations [SDT_NULL] length = 1 -to = 159 +to = SLV_159 [SDT_VAR] base = GameSettings @@ -1207,7 +1207,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = order.gradual_loading -from = 40 +from = SLV_40 guiflags = SGF_NO_NETWORK def = true cat = SC_EXPERT @@ -1215,7 +1215,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = construction.road_stop_on_town_road -from = 47 +from = SLV_47 def = true str = STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD strhelp = STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT @@ -1224,7 +1224,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = construction.road_stop_on_competitor_road -from = 114 +from = SLV_114 def = true str = STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD strhelp = STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT @@ -1233,14 +1233,14 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = station.adjacent_stations -from = 62 +from = SLV_62 def = true cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = economy.station_noise_level -from = 96 +from = SLV_96 guiflags = SGF_NO_NETWORK def = false str = STR_CONFIG_SETTING_NOISE_LEVEL @@ -1250,7 +1250,7 @@ proc = InvalidateTownViewWindow [SDT_BOOL] base = GameSettings var = station.distant_join_stations -from = 106 +from = SLV_106 def = true str = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS strhelp = STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT @@ -1283,7 +1283,7 @@ cat = SC_BASIC base = GameSettings var = construction.industry_platform type = SLE_UINT8 -from = 148 +from = SLV_148 def = 1 min = 0 max = 4 @@ -1301,7 +1301,7 @@ strhelp = STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT [SDT_NULL] length = 1 -to = 141 +to = SLV_141 [SDT_BOOL] base = GameSettings @@ -1315,7 +1315,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = economy.exclusive_rights -from = 79 +from = SLV_79 def = true str = STR_CONFIG_SETTING_ALLOW_EXCLUSIVE strhelp = STR_CONFIG_SETTING_ALLOW_EXCLUSIVE_HELPTEXT @@ -1325,7 +1325,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = economy.fund_buildings -from = 165 +from = SLV_165 def = true str = STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS strhelp = STR_CONFIG_SETTING_ALLOW_FUND_BUILDINGS_HELPTEXT @@ -1335,7 +1335,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = economy.fund_roads -from = 160 +from = SLV_160 def = true str = STR_CONFIG_SETTING_ALLOW_FUND_ROAD strhelp = STR_CONFIG_SETTING_ALLOW_FUND_ROAD_HELPTEXT @@ -1345,7 +1345,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = economy.give_money -from = 79 +from = SLV_79 def = true str = STR_CONFIG_SETTING_ALLOW_GIVE_MONEY strhelp = STR_CONFIG_SETTING_ALLOW_GIVE_MONEY_HELPTEXT @@ -1366,7 +1366,7 @@ cat = SC_BASIC [SDT_NULL] length = 4 -to = 144 +to = SLV_144 [SDT_VAR] base = GameSettings @@ -1382,7 +1382,7 @@ cat = SC_BASIC [SDT_NULL] length = 4 -to = 105 +to = SLV_105 [SDT_BOOL] base = GameSettings @@ -1405,7 +1405,7 @@ proc = InvalidateCompanyWindow base = GameSettings var = economy.feeder_payment_share type = SLE_UINT8 -from = 134 +from = SLV_134 def = 75 min = 0 max = 100 @@ -1418,7 +1418,7 @@ cat = SC_EXPERT base = GameSettings var = economy.town_growth_rate type = SLE_UINT8 -from = 54 +from = SLV_54 guiflags = SGF_MULTISTRING def = 2 min = 0 @@ -1431,7 +1431,7 @@ strval = STR_CONFIG_SETTING_TOWN_GROWTH_NONE base = GameSettings var = economy.larger_towns type = SLE_UINT8 -from = 54 +from = SLV_54 guiflags = SGF_0ISDISABLED def = 4 min = 0 @@ -1445,7 +1445,7 @@ strval = STR_CONFIG_SETTING_LARGER_TOWNS_VALUE base = GameSettings var = economy.initial_city_size type = SLE_UINT8 -from = 56 +from = SLV_56 def = 2 min = 1 max = 10 @@ -1457,20 +1457,20 @@ strval = STR_JUST_COMMA [SDT_BOOL] base = GameSettings var = economy.mod_road_rebuild -from = 77 +from = SLV_77 def = true cat = SC_EXPERT ; previously ai-new setting. [SDT_NULL] length = 1 -to = 107 +to = SLV_107 [SDT_OMANY] base = GameSettings var = script.settings_profile type = SLE_UINT8 -from = 178 +from = SLV_178 guiflags = SGF_MULTISTRING def = SP_EASY min = SP_EASY @@ -1521,7 +1521,7 @@ strhelp = STR_CONFIG_SETTING_AI_BUILDS_SHIPS_HELPTEXT base = GameSettings var = script.script_max_opcode_till_suspend type = SLE_UINT32 -from = 107 +from = SLV_107 guiflags = SGF_NEWGAME_ONLY def = 10000 min = 5000 @@ -1554,7 +1554,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.reverse_at_signals -from = 159 +from = SLV_159 def = false str = STR_CONFIG_SETTING_REVERSE_AT_SIGNALS strhelp = STR_CONFIG_SETTING_REVERSE_AT_SIGNALS_HELPTEXT @@ -1581,7 +1581,7 @@ cat = SC_EXPERT base = GameSettings var = economy.town_noise_population[0] type = SLE_UINT16 -from = 96 +from = SLV_96 def = 800 min = 200 max = 65535 @@ -1591,7 +1591,7 @@ cat = SC_EXPERT base = GameSettings var = economy.town_noise_population[1] type = SLE_UINT16 -from = 96 +from = SLV_96 def = 2000 min = 400 max = 65535 @@ -1601,7 +1601,7 @@ cat = SC_EXPERT base = GameSettings var = economy.town_noise_population[2] type = SLE_UINT16 -from = 96 +from = SLV_96 def = 4000 min = 800 max = 65535 @@ -1610,7 +1610,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = economy.infrastructure_maintenance -from = 166 +from = SLV_166 def = false str = STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE strhelp = STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT @@ -1622,7 +1622,7 @@ cat = SC_BASIC base = GameSettings var = pf.wait_for_pbs_path type = SLE_UINT8 -from = 100 +from = SLV_100 def = 30 min = 2 max = 255 @@ -1631,7 +1631,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.reserve_paths -from = 100 +from = SLV_100 def = false cat = SC_EXPERT @@ -1639,7 +1639,7 @@ cat = SC_EXPERT base = GameSettings var = pf.path_backoff_interval type = SLE_UINT8 -from = 100 +from = SLV_100 def = 20 min = 1 max = 255 @@ -1741,7 +1741,7 @@ cat = SC_EXPERT base = GameSettings var = pf.npf.npf_rail_pbs_cross_penalty type = SLE_UINT -from = 100 +from = SLV_100 def = 3 * NPF_TILE_LENGTH min = 0 max = 100000 @@ -1751,7 +1751,7 @@ cat = SC_EXPERT base = GameSettings var = pf.npf.npf_rail_pbs_signal_back_penalty type = SLE_UINT -from = 100 +from = SLV_100 def = 15 * NPF_TILE_LENGTH min = 0 max = 100000 @@ -1797,7 +1797,7 @@ cat = SC_EXPERT base = GameSettings var = pf.npf.npf_road_drive_through_penalty type = SLE_UINT -from = 47 +from = SLV_47 def = 8 * NPF_TILE_LENGTH min = 0 max = 100000 @@ -1807,7 +1807,7 @@ cat = SC_EXPERT base = GameSettings var = pf.npf.npf_road_dt_occupied_penalty type = SLE_UINT -from = 130 +from = SLV_130 def = 8 * NPF_TILE_LENGTH min = 0 max = 100000 @@ -1817,7 +1817,7 @@ cat = SC_EXPERT base = GameSettings var = pf.npf.npf_road_bay_occupied_penalty type = SLE_UINT -from = 130 +from = SLV_130 def = 15 * NPF_TILE_LENGTH min = 0 max = 100000 @@ -1827,7 +1827,7 @@ cat = SC_EXPERT base = GameSettings var = pf.npf.maximum_go_to_depot_penalty type = SLE_UINT -from = 131 +from = SLV_131 def = 20 * NPF_TILE_LENGTH min = 0 max = 1000000 @@ -1837,7 +1837,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.yapf.disable_node_optimization -from = 28 +from = SLV_28 def = false cat = SC_EXPERT @@ -1845,7 +1845,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.max_search_nodes type = SLE_UINT -from = 28 +from = SLV_28 def = 10000 min = 500 max = 1000000 @@ -1854,7 +1854,7 @@ cat = SC_EXPERT [SDT_BOOL] base = GameSettings var = pf.yapf.rail_firstred_twoway_eol -from = 28 +from = SLV_28 def = false cat = SC_EXPERT @@ -1862,7 +1862,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_firstred_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 10 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1872,7 +1872,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_firstred_exit_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 100 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1882,7 +1882,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_lastred_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 10 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1892,7 +1892,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_lastred_exit_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 100 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1902,7 +1902,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_station_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 10 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1912,7 +1912,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_slope_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 2 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1922,7 +1922,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_curve45_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 1 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1932,7 +1932,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_curve90_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 6 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1942,7 +1942,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_depot_reverse_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 50 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1952,7 +1952,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_crossing_penalty type = SLE_UINT -from = 28 +from = SLV_28 def = 3 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -1962,7 +1962,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_look_ahead_max_signals type = SLE_UINT -from = 28 +from = SLV_28 def = 10 min = 1 max = 100 @@ -1972,7 +1972,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_look_ahead_signal_p0 type = SLE_INT -from = 28 +from = SLV_28 def = 500 min = -1000000 max = 1000000 @@ -1982,7 +1982,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_look_ahead_signal_p1 type = SLE_INT -from = 28 +from = SLV_28 def = -100 min = -1000000 max = 1000000 @@ -1992,7 +1992,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_look_ahead_signal_p2 type = SLE_INT -from = 28 +from = SLV_28 def = 5 min = -1000000 max = 1000000 @@ -2002,7 +2002,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_pbs_cross_penalty type = SLE_UINT -from = 100 +from = SLV_100 def = 3 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2012,7 +2012,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_pbs_station_penalty type = SLE_UINT -from = 100 +from = SLV_100 def = 8 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2022,7 +2022,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_pbs_signal_back_penalty type = SLE_UINT -from = 100 +from = SLV_100 def = 15 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2032,7 +2032,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_doubleslip_penalty type = SLE_UINT -from = 100 +from = SLV_100 def = 1 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2042,7 +2042,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_longer_platform_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 8 * YAPF_TILE_LENGTH min = 0 max = 20000 @@ -2052,7 +2052,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_longer_platform_per_tile_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 0 * YAPF_TILE_LENGTH min = 0 max = 20000 @@ -2062,7 +2062,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_shorter_platform_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 40 * YAPF_TILE_LENGTH min = 0 max = 20000 @@ -2072,7 +2072,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.rail_shorter_platform_per_tile_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 0 * YAPF_TILE_LENGTH min = 0 max = 20000 @@ -2082,7 +2082,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.road_slope_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 2 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2092,7 +2092,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.road_curve_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 1 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2102,7 +2102,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.road_crossing_penalty type = SLE_UINT -from = 33 +from = SLV_33 def = 3 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2112,7 +2112,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.road_stop_penalty type = SLE_UINT -from = 47 +from = SLV_47 def = 8 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2122,7 +2122,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.road_stop_occupied_penalty type = SLE_UINT -from = 130 +from = SLV_130 def = 8 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2132,7 +2132,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.road_stop_bay_occupied_penalty type = SLE_UINT -from = 130 +from = SLV_130 def = 15 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2142,7 +2142,7 @@ cat = SC_EXPERT base = GameSettings var = pf.yapf.maximum_go_to_depot_penalty type = SLE_UINT -from = 131 +from = SLV_131 def = 20 * YAPF_TILE_LENGTH min = 0 max = 1000000 @@ -2153,7 +2153,7 @@ cat = SC_EXPERT base = GameSettings var = game_creation.land_generator type = SLE_UINT8 -from = 30 +from = SLV_30 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY def = 1 min = 0 @@ -2166,7 +2166,7 @@ strval = STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL base = GameSettings var = game_creation.oil_refinery_limit type = SLE_UINT8 -from = 30 +from = SLV_30 def = 32 min = 12 max = 48 @@ -2178,7 +2178,7 @@ strhelp = STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT base = GameSettings var = game_creation.tgen_smoothness type = SLE_UINT8 -from = 30 +from = SLV_30 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY def = 1 min = TGEN_SMOOTHNESS_BEGIN @@ -2192,7 +2192,7 @@ cat = SC_BASIC base = GameSettings var = game_creation.variety type = SLE_UINT8 -from = 197 +from = SLV_197 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY def = 0 min = 0 @@ -2205,7 +2205,7 @@ strval = STR_VARIETY_NONE base = GameSettings var = game_creation.generation_seed type = SLE_UINT32 -from = 30 +from = SLV_30 def = GENERATE_NEW_SEED min = 0 max = UINT32_MAX @@ -2215,7 +2215,7 @@ cat = SC_EXPERT base = GameSettings var = game_creation.tree_placer type = SLE_UINT8 -from = 30 +from = SLV_30 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO def = 2 min = 0 @@ -2273,7 +2273,7 @@ cat = SC_BASIC [SDT_BOOL] base = GameSettings var = construction.freeform_edges -from = 111 +from = SLV_111 def = true proc = CheckFreeformEdges cat = SC_EXPERT @@ -2282,7 +2282,7 @@ cat = SC_EXPERT base = GameSettings var = game_creation.water_borders type = SLE_UINT8 -from = 111 +from = SLV_111 def = 15 min = 0 max = 16 @@ -2291,7 +2291,7 @@ max = 16 base = GameSettings var = game_creation.custom_town_number type = SLE_UINT16 -from = 115 +from = SLV_115 def = 1 min = 1 max = 5000 @@ -2301,7 +2301,7 @@ cat = SC_BASIC base = GameSettings var = construction.extra_tree_placement type = SLE_UINT8 -from = 132 +from = SLV_132 guiflags = SGF_MULTISTRING def = 2 min = 0 @@ -2315,7 +2315,7 @@ cat = SC_BASIC base = GameSettings var = game_creation.custom_sea_level type = SLE_UINT8 -from = 149 +from = SLV_149 def = 1 min = 2 max = 90 @@ -2325,7 +2325,7 @@ cat = SC_BASIC base = GameSettings var = game_creation.min_river_length type = SLE_UINT8 -from = 163 +from = SLV_163 def = 16 min = 2 max = 255 @@ -2335,7 +2335,7 @@ cat = SC_EXPERT base = GameSettings var = game_creation.river_route_random type = SLE_UINT8 -from = 163 +from = SLV_163 def = 5 min = 1 max = 255 @@ -2345,7 +2345,7 @@ cat = SC_EXPERT base = GameSettings var = game_creation.amount_of_rivers type = SLE_UINT8 -from = 163 +from = SLV_163 guiflags = SGF_MULTISTRING | SGF_NEWGAME_ONLY def = 2 min = 0 @@ -2360,7 +2360,7 @@ strval = STR_RIVERS_NONE base = GameSettings var = locale.currency type = SLE_UINT8 -from = 97 +from = SLV_97 flags = SLF_NO_NETWORK_SYNC def = 0 max = CURRENCY_END - 1 @@ -2372,8 +2372,8 @@ cat = SC_BASIC name = ""units"" var = _old_units type = SLE_UINT8 -from = 97 -to = 184 +from = SLV_97 +to = SLV_184 flags = SLF_NOT_IN_CONFIG def = 1 max = 2 @@ -2385,7 +2385,7 @@ cat = SC_BASIC base = GameSettings var = locale.units_velocity type = SLE_UINT8 -from = 184 +from = SLV_184 flags = SLF_NO_NETWORK_SYNC guiflags = SGF_MULTISTRING def = 1 @@ -2401,7 +2401,7 @@ strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL base = GameSettings var = locale.units_power type = SLE_UINT8 -from = 184 +from = SLV_184 flags = SLF_NO_NETWORK_SYNC guiflags = SGF_MULTISTRING def = 1 @@ -2417,7 +2417,7 @@ strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_IMPERIAL base = GameSettings var = locale.units_weight type = SLE_UINT8 -from = 184 +from = SLV_184 flags = SLF_NO_NETWORK_SYNC guiflags = SGF_MULTISTRING def = 1 @@ -2433,7 +2433,7 @@ strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_IMPERIAL base = GameSettings var = locale.units_volume type = SLE_UINT8 -from = 184 +from = SLV_184 flags = SLF_NO_NETWORK_SYNC guiflags = SGF_MULTISTRING def = 1 @@ -2449,7 +2449,7 @@ strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_VOLUME_IMPERIAL base = GameSettings var = locale.units_force type = SLE_UINT8 -from = 184 +from = SLV_184 flags = SLF_NO_NETWORK_SYNC guiflags = SGF_MULTISTRING def = 2 @@ -2465,7 +2465,7 @@ strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE_IMPERIAL base = GameSettings var = locale.units_height type = SLE_UINT8 -from = 184 +from = SLV_184 flags = SLF_NO_NETWORK_SYNC guiflags = SGF_MULTISTRING def = 1 @@ -2481,7 +2481,7 @@ strval = STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_IMPERIAL base = GameSettings var = locale.digit_group_separator type = SLE_STRQ -from = 118 +from = SLV_118 flags = SLF_NO_NETWORK_SYNC def = NULL proc = RedrawScreen @@ -2491,7 +2491,7 @@ cat = SC_BASIC base = GameSettings var = locale.digit_group_separator_currency type = SLE_STRQ -from = 118 +from = SLV_118 flags = SLF_NO_NETWORK_SYNC def = NULL proc = RedrawScreen @@ -2501,7 +2501,7 @@ cat = SC_BASIC base = GameSettings var = locale.digit_decimal_separator type = SLE_STRQ -from = 126 +from = SLV_126 flags = SLF_NO_NETWORK_SYNC def = NULL proc = RedrawScreen diff --git a/src/table/win32_settings.ini b/src/table/win32_settings.ini index 70c18a424..bb241f50c 100644 --- a/src/table/win32_settings.ini +++ b/src/table/win32_settings.ini @@ -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 diff --git a/src/table/window_settings.ini b/src/table/window_settings.ini index ad77423d9..41223586a 100644 --- a/src/table/window_settings.ini +++ b/src/table/window_settings.ini @@ -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 |