mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-07 10:22:22 +00:00
ExpressionParser: remove DummyExpression
This commit is contained in:
parent
f1ff1e3d08
commit
754efd75c5
@ -217,18 +217,6 @@ public:
|
|||||||
virtual operator std::string() const { return ""; }
|
virtual operator std::string() const { return ""; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DummyExpression : public ExpressionNode
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string name;
|
|
||||||
|
|
||||||
DummyExpression(const std::string& name_) : name(name_) {}
|
|
||||||
ControlState GetValue() const override { return 0.0; }
|
|
||||||
void SetValue(ControlState value) override {}
|
|
||||||
int CountNumControls() const override { return 0; }
|
|
||||||
operator std::string() const override { return "`" + name + "`"; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class ControlExpression : public ExpressionNode
|
class ControlExpression : public ExpressionNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -243,9 +231,13 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlState GetValue() const override { return control->ToInput()->GetState(); }
|
ControlState GetValue() const override { return control ? control->ToInput()->GetState() : 0.0; }
|
||||||
void SetValue(ControlState value) override { control->ToOutput()->SetState(value); }
|
void SetValue(ControlState value) override
|
||||||
int CountNumControls() const override { return 1; }
|
{
|
||||||
|
if (control)
|
||||||
|
control->ToOutput()->SetState(value);
|
||||||
|
}
|
||||||
|
int CountNumControls() const override { return control ? 1 : 0; }
|
||||||
operator std::string() const override { return "`" + static_cast<std::string>(qualifier) + "`"; }
|
operator std::string() const override { return "`" + static_cast<std::string>(qualifier) + "`"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -402,7 +394,7 @@ private:
|
|||||||
std::shared_ptr<Device> device = finder.FindDevice(tok.qualifier);
|
std::shared_ptr<Device> device = finder.FindDevice(tok.qualifier);
|
||||||
Device::Control* control = finder.FindControl(tok.qualifier);
|
Device::Control* control = finder.FindControl(tok.qualifier);
|
||||||
if (control == nullptr)
|
if (control == nullptr)
|
||||||
return {ParseStatus::NoDevice, std::make_unique<DummyExpression>(tok.qualifier)};
|
return {ParseStatus::NoDevice, std::make_unique<ControlExpression>(tok.qualifier, control)};
|
||||||
|
|
||||||
return {ParseStatus::Successful,
|
return {ParseStatus::Successful,
|
||||||
std::make_unique<ControlExpression>(tok.qualifier, std::move(device), control)};
|
std::make_unique<ControlExpression>(tok.qualifier, std::move(device), control)};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user