mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
ExpressionParser: Add optional 2nd argument to toggle function which clears state.
This commit is contained in:
parent
fd07ae8cec
commit
6a2096c419
@ -32,7 +32,8 @@ class ToggleExpression : public FunctionExpression
|
|||||||
private:
|
private:
|
||||||
virtual bool ValidateArguments(const std::vector<std::unique_ptr<Expression>>& args) override
|
virtual bool ValidateArguments(const std::vector<std::unique_ptr<Expression>>& args) override
|
||||||
{
|
{
|
||||||
return 1 == args.size();
|
// Optional 2nd argument for clearing state:
|
||||||
|
return 1 == args.size() || 2 == args.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlState GetValue() const override
|
ControlState GetValue() const override
|
||||||
@ -49,6 +50,11 @@ private:
|
|||||||
m_state ^= true;
|
m_state ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (2 == GetArgCount() && GetArg(1).GetValue() > CONDITION_THRESHOLD)
|
||||||
|
{
|
||||||
|
m_state = false;
|
||||||
|
}
|
||||||
|
|
||||||
return m_state;
|
return m_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,5 +263,10 @@ const Expression& FunctionExpression::GetArg(u32 number) const
|
|||||||
return *m_args[number];
|
return *m_args[number];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 FunctionExpression::GetArgCount() const
|
||||||
|
{
|
||||||
|
return u32(m_args.size());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ExpressionParser
|
} // namespace ExpressionParser
|
||||||
} // namespace ciface
|
} // namespace ciface
|
||||||
|
@ -30,6 +30,7 @@ protected:
|
|||||||
|
|
||||||
Expression& GetArg(u32 number);
|
Expression& GetArg(u32 number);
|
||||||
const Expression& GetArg(u32 number) const;
|
const Expression& GetArg(u32 number) const;
|
||||||
|
u32 GetArgCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<Expression>> m_args;
|
std::vector<std::unique_ptr<Expression>> m_args;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user