Merge branch 'save_ext' into tracerestrict-sx
This commit is contained in:
@@ -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<SlXvFeatureIndex>(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<SlXvFeatureTestOperator>(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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -2469,6 +2469,8 @@ static inline void ClearSaveLoadState()
|
||||
|
||||
delete _sl.lf;
|
||||
_sl.lf = NULL;
|
||||
|
||||
SlXvSetCurrentState();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user