mirror of https://github.com/OpenTTD/OpenTTD
(svn r21282) -Codechange: Rename CheckSavegameVersionOldStyle() to IsSavegameVersionBefore().
parent
2974141641
commit
edef25d30c
|
@ -485,19 +485,19 @@ bool AfterLoadGame()
|
|||
}
|
||||
|
||||
/* in version 2.1 of the savegame, town owner was unified. */
|
||||
if (CheckSavegameVersionOldStyle(2, 1)) ConvertTownOwner();
|
||||
if (IsSavegameVersionBefore(2, 1)) ConvertTownOwner();
|
||||
|
||||
/* from version 4.1 of the savegame, exclusive rights are stored at towns */
|
||||
if (CheckSavegameVersionOldStyle(4, 1)) UpdateExclusiveRights();
|
||||
if (IsSavegameVersionBefore(4, 1)) UpdateExclusiveRights();
|
||||
|
||||
/* from version 4.2 of the savegame, currencies are in a different order */
|
||||
if (CheckSavegameVersionOldStyle(4, 2)) UpdateCurrencies();
|
||||
if (IsSavegameVersionBefore(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 (CheckSavegameVersionOldStyle(4, 3)) {
|
||||
if (IsSavegameVersionBefore(4, 3)) {
|
||||
for (TileIndex t = 0; t < map_size; t++) {
|
||||
if (IsTileType(t, MP_WATER) && GetTileOwner(t) >= MAX_COMPANIES) {
|
||||
SetTileOwner(t, OWNER_WATER);
|
||||
|
@ -576,7 +576,7 @@ bool AfterLoadGame()
|
|||
}
|
||||
|
||||
/* The value of _date_fract got divided, so make sure that old games are converted correctly. */
|
||||
if (CheckSavegameVersionOldStyle(11, 1) || (CheckSavegameVersion(147) && _date_fract > DAY_TICKS)) _date_fract /= 885;
|
||||
if (IsSavegameVersionBefore(11, 1) || (CheckSavegameVersion(147) && _date_fract > DAY_TICKS)) _date_fract /= 885;
|
||||
|
||||
/* Update current year
|
||||
* must be done before loading sprites as some newgrfs check it */
|
||||
|
@ -594,7 +594,7 @@ bool AfterLoadGame()
|
|||
|
||||
/* Connect front and rear engines of multiheaded trains and converts
|
||||
* subtype to the new format */
|
||||
if (CheckSavegameVersionOldStyle(17, 1)) ConvertOldMultiheadToNew();
|
||||
if (IsSavegameVersionBefore(17, 1)) ConvertOldMultiheadToNew();
|
||||
|
||||
/* Connect front and rear engines of multiheaded trains */
|
||||
ConnectMultiheadedTrains();
|
||||
|
@ -773,12 +773,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 (CheckSavegameVersionOldStyle(2, 2)) UpdateOldAircraft();
|
||||
if (IsSavegameVersionBefore(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 (CheckSavegameVersionOldStyle(6, 1)) {
|
||||
if (IsSavegameVersionBefore(6, 1)) {
|
||||
for (TileIndex t = 0; t < map_size; t++) {
|
||||
switch (GetTileType(t)) {
|
||||
case MP_HOUSE:
|
||||
|
@ -1101,7 +1101,7 @@ 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 (CheckSavegameVersionOldStyle(16, 1)) {
|
||||
if (IsSavegameVersionBefore(16, 1)) {
|
||||
Company *c;
|
||||
FOR_ALL_COMPANIES(c) c->settings.renew_keep_length = false;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ static void Save_ORDR()
|
|||
|
||||
static void Load_ORDR()
|
||||
{
|
||||
if (CheckSavegameVersionOldStyle(5, 2)) {
|
||||
if (IsSavegameVersionBefore(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();
|
||||
|
@ -148,7 +148,7 @@ static void Load_ORDR()
|
|||
}
|
||||
|
||||
free(orders);
|
||||
} else if (CheckSavegameVersionOldStyle(5, 2)) {
|
||||
} else if (IsSavegameVersionBefore(5, 2)) {
|
||||
len /= sizeof(uint32);
|
||||
uint32 *orders = MallocT<uint32>(len + 1);
|
||||
|
||||
|
@ -187,7 +187,7 @@ static void Load_ORDR()
|
|||
static void Ptrs_ORDR()
|
||||
{
|
||||
/* Orders from old savegames have pointers corrected in Load_ORDR */
|
||||
if (CheckSavegameVersionOldStyle(5, 2)) return;
|
||||
if (IsSavegameVersionBefore(5, 2)) return;
|
||||
|
||||
Order *o;
|
||||
|
||||
|
|
|
@ -1141,7 +1141,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 && !CheckSavegameVersionOldStyle(4, 4)) {
|
||||
if (rt == REF_VEHICLE_OLD && !IsSavegameVersionBefore(4, 4)) {
|
||||
rt = REF_VEHICLE;
|
||||
}
|
||||
|
||||
|
@ -1160,7 +1160,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 (CheckSavegameVersionOldStyle(5, 2)) return NULL;
|
||||
if (IsSavegameVersionBefore(5, 2)) return NULL;
|
||||
SlErrorCorrupt("Referencing invalid Order");
|
||||
|
||||
case REF_VEHICLE_OLD:
|
||||
|
|
|
@ -453,7 +453,7 @@ typedef SaveLoad SaveLoadGlobVarList;
|
|||
* @param minor Minor number of the version to check against.
|
||||
* @return Savegame version is less than the \a major version, or has equal \a major version and a smaller \a minor version.
|
||||
*/
|
||||
static inline bool CheckSavegameVersionOldStyle(uint16 major, byte minor)
|
||||
static inline bool IsSavegameVersionBefore(uint16 major, byte minor)
|
||||
{
|
||||
extern uint16 _sl_version;
|
||||
extern byte _sl_minor_version;
|
||||
|
|
|
@ -50,7 +50,7 @@ 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 (CheckSavegameVersionOldStyle(6, 1) || (CheckSavegameVersion(83) && si->owner == INVALID_OWNER)) {
|
||||
if (IsSavegameVersionBefore(6, 1) || (CheckSavegameVersion(83) && si->owner == INVALID_OWNER)) {
|
||||
si->owner = OWNER_NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,7 +275,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 (CheckSavegameVersionOldStyle(5, 2)) {
|
||||
if (IsSavegameVersionBefore(5, 2)) {
|
||||
v->AddToShared(v->orders.list->GetFirstSharedVehicle());
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,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 || CheckSavegameVersionOldStyle(2, 1))) {
|
||||
if ((v->vehstatus & VS_STOPPED) && (v->type != VEH_TRAIN || IsSavegameVersionBefore(2, 1))) {
|
||||
v->cur_speed = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue