Add extended version tag and feature versions to output of -q.
This commit is contained in:
@@ -249,7 +249,20 @@ static void WriteSavegameInfo(const char *name)
|
|||||||
char buf[8192];
|
char buf[8192];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
p += seprintf(p, lastof(buf), "Name: %s\n", name);
|
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), "NewGRF ver: 0x%08X\n", last_ottd_rev);
|
||||||
p += seprintf(p, lastof(buf), "Modified: %d\n", ever_modified);
|
p += seprintf(p, lastof(buf), "Modified: %d\n", ever_modified);
|
||||||
|
|
||||||
|
@@ -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;
|
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
|
* Resets all extended feature versions to 0
|
||||||
*/
|
*/
|
||||||
|
@@ -65,6 +65,8 @@ inline bool SlXvIsFeatureMissing(SlXvFeatureIndex feature)
|
|||||||
return !SlXvIsFeaturePresent(feature);
|
return !SlXvIsFeaturePresent(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *SlXvGetFeatureName(SlXvFeatureIndex feature);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sub chunk flags, this is saved as-is
|
* 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)
|
* (XSCF_EXTRA_DATA_PRESENT and XSCF_CHUNK_ID_LIST_PRESENT must only be set by the save code, and read by the load code)
|
||||||
|
Reference in New Issue
Block a user