diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj index 27c0897a28..8d1c9058fe 100644 --- a/projects/openttd_vs100.vcxproj +++ b/projects/openttd_vs100.vcxproj @@ -869,6 +869,8 @@ + + diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters index c8c74caeda..37c6b1559c 100644 --- a/projects/openttd_vs100.vcxproj.filters +++ b/projects/openttd_vs100.vcxproj.filters @@ -1836,6 +1836,12 @@ Save/Load handlers + + Save/Load handlers + + + Save/Load handlers + Tables diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj index f02bbcbd28..5c874a0801 100644 --- a/projects/openttd_vs80.vcproj +++ b/projects/openttd_vs80.vcproj @@ -2770,6 +2770,14 @@ RelativePath=".\..\src\saveload\waypoint_sl.cpp" > + + + + + + + + tile, RTSG_FENCES, IsHalftileSlope(ti->tileh) ? TCX_UPPER_HALFTILE : TCX_NORMAL); + SpriteID base_image = GetCustomRailSprite(rti, ti->tile, RTSG_FENCES, IsHalftileSlope(ti->tileh) ? TCX_UPPER_HALFTILE : TCX_NORMAL, &num_sprites); if (base_image == 0) { base_image = SPR_TRACK_FENCE_FLAT_X; num_sprites = 8; diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index cb66259ade..d1b759d429 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -61,13 +61,9 @@ bool SlXvFeatureTest::IsFeaturePresent(uint16 savegame_version, uint16 savegame_ { bool savegame_version_ok = savegame_version >= savegame_version_from && savegame_version <= savegame_version_to; - SlXvFeatureIndex feature = static_cast(GB(this->value, 0, 16)); - if (feature == XSLFI_NULL) return savegame_version_ok; + if (this->feature == XSLFI_NULL) return savegame_version_ok; - uint16 min_version = GB(this->value, 16, 16); - uint16 max_version = GB(this->value, 32, 16); - SlXvFeatureTestOperator op = static_cast(GB(this->value, 48, 16)); - bool feature_ok = SlXvIsFeaturePresent(feature, min_version, max_version); + bool feature_ok = SlXvIsFeaturePresent(this->feature, this->min_version, this->max_version); switch (op) { case XSLFTO_OR: @@ -109,7 +105,10 @@ void SlXvSetCurrentState() SlXvResetState(); _sl_is_ext_version = true; - // TODO: set versions for currently enabled features here + const SlxiSubChunkInfo *info = _sl_xv_sub_chunk_infos; + for (; info->index != XSLFI_NULL; ++info) { + _sl_xv_feature_versions[info->index] = info->save_version; + } } /** diff --git a/src/saveload/extended_ver_sl.h b/src/saveload/extended_ver_sl.h index 5532f1b6fd..35aa08968d 100644 --- a/src/saveload/extended_ver_sl.h +++ b/src/saveload/extended_ver_sl.h @@ -41,20 +41,17 @@ enum SlXvFeatureTestOperator { */ struct SlXvFeatureTest { private: - uint64 value; + uint16 min_version; + uint16 max_version; + SlXvFeatureIndex feature; + SlXvFeatureTestOperator op; public: SlXvFeatureTest() - : value(0) { } + : min_version(0), max_version(0), feature(XSLFI_NULL), op(XSLFTO_OR) { } - SlXvFeatureTest(SlXvFeatureTestOperator op, SlXvFeatureIndex feature, uint16 min_version = 1, uint16 max_version = 0xFFFF) - { - this->value = 0; - SB(this->value, 0, 16, feature); - SB(this->value, 16, 16, min_version); - SB(this->value, 32, 16, max_version); - SB(this->value, 48, 16, op); - } + SlXvFeatureTest(SlXvFeatureTestOperator op_, SlXvFeatureIndex feature_, uint16 min_version_ = 1, uint16 max_version_ = 0xFFFF) + : min_version(min_version_), max_version(max_version_), feature(feature_), op(op_) { } bool IsFeaturePresent(uint16 savegame_version, uint16 savegame_version_from, uint16 savegame_version_to) const; }; diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 7623b4ccd2..2e2d7e1465 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -2469,6 +2469,8 @@ static inline void ClearSaveLoadState() delete _sl.lf; _sl.lf = NULL; + + SlXvSetCurrentState(); } /** diff --git a/src/settings.cpp b/src/settings.cpp index b8e329ef5c..203dccbea0 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2293,7 +2293,7 @@ static void LoadSettingsPatx(const SettingDesc *sd, void *object) static const SaveLoad _settings_patx_desc[] = { SLE_VAR(SettingsPatxLoad, flags, SLE_UINT32), - SLE_STR(SettingsPatxLoad, name, SLE_STRB, 255), + SLE_STR(SettingsPatxLoad, name, SLE_STRB, 256), SLE_VAR(SettingsPatxLoad, setting_length, SLE_UINT32), SLE_END() };