From 0e13348b5a3f4874552097cff8f58a122be72676 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sat, 31 Oct 2015 13:24:26 -0700 Subject: [PATCH] PR feedback --- .../src/controllers/impl/endpoints/AnyEndpoint.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libraries/controllers/src/controllers/impl/endpoints/AnyEndpoint.cpp b/libraries/controllers/src/controllers/impl/endpoints/AnyEndpoint.cpp index 0dd53fe78f..a3b719b2c1 100644 --- a/libraries/controllers/src/controllers/impl/endpoints/AnyEndpoint.cpp +++ b/libraries/controllers/src/controllers/impl/endpoints/AnyEndpoint.cpp @@ -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; }