Merge branch 'save_ext' into jgrpp
This commit is contained in:
@@ -95,6 +95,8 @@ bool SlXvFeatureTest::IsFeaturePresent(uint16 savegame_version, uint16 savegame_
|
|||||||
{
|
{
|
||||||
bool savegame_version_ok = savegame_version >= savegame_version_from && savegame_version <= savegame_version_to;
|
bool savegame_version_ok = savegame_version >= savegame_version_from && savegame_version <= savegame_version_to;
|
||||||
|
|
||||||
|
if (this->functor) return (*this->functor)(savegame_version, savegame_version_ok);
|
||||||
|
|
||||||
if (this->feature == XSLFI_NULL) return savegame_version_ok;
|
if (this->feature == XSLFI_NULL) return savegame_version_ok;
|
||||||
|
|
||||||
bool feature_ok = SlXvIsFeaturePresent(this->feature, this->min_version, this->max_version);
|
bool feature_ok = SlXvIsFeaturePresent(this->feature, this->min_version, this->max_version);
|
||||||
|
@@ -79,11 +79,14 @@ enum SlXvFeatureTestOperator {
|
|||||||
* Structure to describe an extended feature version test, and how it combines with a traditional savegame version test
|
* Structure to describe an extended feature version test, and how it combines with a traditional savegame version test
|
||||||
*/
|
*/
|
||||||
struct SlXvFeatureTest {
|
struct SlXvFeatureTest {
|
||||||
|
using TestFunctorPtr = bool (*)(uint16, bool); ///< Return true if feature present, first parameter is standard savegame version, second is whether standard savegame version is within bounds
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16 min_version;
|
uint16 min_version;
|
||||||
uint16 max_version;
|
uint16 max_version;
|
||||||
SlXvFeatureIndex feature;
|
SlXvFeatureIndex feature;
|
||||||
SlXvFeatureTestOperator op;
|
SlXvFeatureTestOperator op;
|
||||||
|
TestFunctorPtr functor = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SlXvFeatureTest()
|
SlXvFeatureTest()
|
||||||
@@ -92,6 +95,9 @@ struct SlXvFeatureTest {
|
|||||||
SlXvFeatureTest(SlXvFeatureTestOperator op_, SlXvFeatureIndex feature_, uint16 min_version_ = 1, uint16 max_version_ = 0xFFFF)
|
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_) { }
|
: min_version(min_version_), max_version(max_version_), feature(feature_), op(op_) { }
|
||||||
|
|
||||||
|
SlXvFeatureTest(TestFunctorPtr functor_)
|
||||||
|
: min_version(0), max_version(0), feature(XSLFI_NULL), op(XSLFTO_OR), functor(functor_) { }
|
||||||
|
|
||||||
bool IsFeaturePresent(uint16 savegame_version, uint16 savegame_version_from, uint16 savegame_version_to) const;
|
bool IsFeaturePresent(uint16 savegame_version, uint16 savegame_version_from, uint16 savegame_version_to) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user