PR feedback

This commit is contained in:
Brad Davis 2015-10-31 13:24:26 -07:00
parent abbfe15395
commit 0e13348b5a

View file

@ -28,23 +28,18 @@ AnyEndpoint::AnyEndpoint(Endpoint::List children) : Endpoint(Input::INVALID_INPU
}
float AnyEndpoint::peek() const {
float result = 0;
for (auto& child : _children) {
float childResult = child->peek();
if (childResult != 0.0f) {
return childResult;
}
result = std::max(result, child->peek());
}
return 0.0f;
return result;
}
// Fetching the value must trigger any necessary side effects of value() on ALL the children.
float AnyEndpoint::value() {
float result = 0;
for (auto& child : _children) {
float childResult = child->value();
if (childResult != 0.0f) {
result = childResult;
}
result = std::max(result, child->value());
}
return result;
}