mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Issue #219: Support for boolean select structs
This commit is contained in:
parent
b412ebd0af
commit
f5972a3080
@ -128,6 +128,7 @@ bool MWDialogue::Filter::testSelectStruct (const SelectWrapper& select) const
|
||||
case SelectWrapper::Type_None: return true;
|
||||
case SelectWrapper::Type_Integer: return select.selectCompare (getSelectStructInteger (select));
|
||||
case SelectWrapper::Type_Numeric: return testSelectStructNumeric (select);
|
||||
case SelectWrapper::Type_Boolean: return select.selectCompare (getSelectStructBoolean (select));
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -153,6 +154,16 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
||||
}
|
||||
}
|
||||
|
||||
bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) const
|
||||
{
|
||||
switch (select.getFunction())
|
||||
{
|
||||
default:
|
||||
|
||||
throw std::runtime_error ("unknown boolean select function");
|
||||
}
|
||||
}
|
||||
|
||||
MWDialogue::Filter::Filter (const MWWorld::Ptr& actor) : mActor (actor) {}
|
||||
|
||||
bool MWDialogue::Filter::operator() (const ESM::DialInfo& info) const
|
||||
|
@ -30,6 +30,8 @@ namespace MWDialogue
|
||||
bool testSelectStructNumeric (const SelectWrapper& select) const;
|
||||
|
||||
int getSelectStructInteger (const SelectWrapper& select) const;
|
||||
|
||||
bool getSelectStructBoolean (const SelectWrapper& select) const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -65,3 +65,8 @@ bool MWDialogue::SelectWrapper::selectCompare (float value) const
|
||||
{
|
||||
return selectCompareImp (mSelect, value)!=IsInverted(); // logic XOR
|
||||
}
|
||||
|
||||
bool MWDialogue::SelectWrapper::selectCompare (bool value) const
|
||||
{
|
||||
return selectCompareImp (mSelect, static_cast<int> (value))!=IsInverted(); // logic XOR
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ namespace MWDialogue
|
||||
{
|
||||
Type_None,
|
||||
Type_Integer,
|
||||
Type_Numeric
|
||||
Type_Numeric,
|
||||
Type_Boolean
|
||||
};
|
||||
|
||||
public:
|
||||
@ -36,6 +37,8 @@ namespace MWDialogue
|
||||
bool selectCompare (int value) const;
|
||||
|
||||
bool selectCompare (float value) const;
|
||||
|
||||
bool selectCompare (bool value) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user