diff --git a/src/openttd.cpp b/src/openttd.cpp index cc382bdbf0..85b56adc85 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -249,7 +249,20 @@ static void WriteSavegameInfo(const char *name) char buf[8192]; char *p = buf; p += seprintf(p, lastof(buf), "Name: %s\n", name); - p += seprintf(p, lastof(buf), "Savegame ver: %d\n", _sl_version); + const char *type = ""; + extern bool _sl_is_faked_ext; + extern bool _sl_is_ext_version; + if (_sl_is_faked_ext) { + type = " (fake extended)"; + } else if (_sl_is_ext_version) { + type = " (extended)"; + } + p += seprintf(p, lastof(buf), "Savegame ver: %d%s\n", _sl_version, type); + for (size_t i = 0; i < XSLFI_SIZE; i++) { + if (_sl_xv_feature_versions[i] > 0) { + p += seprintf(p, lastof(buf), " Feature: %s = %d\n", SlXvGetFeatureName((SlXvFeatureIndex) i), _sl_xv_feature_versions[i]); + } + } p += seprintf(p, lastof(buf), "NewGRF ver: 0x%08X\n", last_ottd_rev); p += seprintf(p, lastof(buf), "Modified: %d\n", ever_modified); diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index fb64afe2c9..7b083a7f21 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -86,6 +86,20 @@ bool SlXvIsFeaturePresent(SlXvFeatureIndex feature, uint16 min_version, uint16 m return _sl_xv_feature_versions[feature] >= min_version && _sl_xv_feature_versions[feature] <= max_version; } +/** + * Returns true if @p feature is present and has a version inclusively bounded by @p min_version and @p max_version + */ +const char *SlXvGetFeatureName(SlXvFeatureIndex feature) +{ + const SlxiSubChunkInfo *info = _sl_xv_sub_chunk_infos; + for (; info->index != XSLFI_NULL; ++info) { + if (info->index == feature) { + return info->name; + } + } + return "(unknown feature)"; +} + /** * Resets all extended feature versions to 0 */ diff --git a/src/saveload/extended_ver_sl.h b/src/saveload/extended_ver_sl.h index 39a03478c2..b495c60c4e 100644 --- a/src/saveload/extended_ver_sl.h +++ b/src/saveload/extended_ver_sl.h @@ -65,6 +65,8 @@ inline bool SlXvIsFeatureMissing(SlXvFeatureIndex feature) return !SlXvIsFeaturePresent(feature); } +const char *SlXvGetFeatureName(SlXvFeatureIndex feature); + /** * sub chunk flags, this is saved as-is * (XSCF_EXTRA_DATA_PRESENT and XSCF_CHUNK_ID_LIST_PRESENT must only be set by the save code, and read by the load code)