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 AnyEndpoint::peek() const {
float result = 0;
for (auto& child : _children) { for (auto& child : _children) {
float childResult = child->peek(); result = std::max(result, child->peek());
if (childResult != 0.0f) {
return childResult;
}
} }
return 0.0f; return result;
} }
// Fetching the value must trigger any necessary side effects of value() on ALL the children. // Fetching the value must trigger any necessary side effects of value() on ALL the children.
float AnyEndpoint::value() { float AnyEndpoint::value() {
float result = 0; float result = 0;
for (auto& child : _children) { for (auto& child : _children) {
float childResult = child->value(); result = std::max(result, child->value());
if (childResult != 0.0f) {
result = childResult;
}
} }
return result; return result;
} }