mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-19 15:25:39 +00:00
Merge branch 'save_ext' into jgrpp
This commit is contained in:
commit
5db5581684
@ -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;
|
||||
|
||||
if (this->functor) return (*this->functor)(savegame_version, savegame_version_ok);
|
||||
|
||||
if (this->feature == XSLFI_NULL) return savegame_version_ok;
|
||||
|
||||
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
|
||||
*/
|
||||
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:
|
||||
uint16 min_version;
|
||||
uint16 max_version;
|
||||
SlXvFeatureIndex feature;
|
||||
SlXvFeatureTestOperator op;
|
||||
TestFunctorPtr functor = nullptr;
|
||||
|
||||
public:
|
||||
SlXvFeatureTest()
|
||||
@ -92,6 +95,9 @@ struct SlXvFeatureTest {
|
||||
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_) { }
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user