initialize 'success' and use for return value

This commit is contained in:
Andrew Meadows 2017-07-27 17:11:13 -07:00
parent 29daac83a4
commit 6b386000db

View file

@ -949,9 +949,11 @@ AACube SpatiallyNestable::getMaximumAACube(bool& success) const {
const float PARENTED_EXPANSION_FACTOR = 3.0f; const float PARENTED_EXPANSION_FACTOR = 3.0f;
bool SpatiallyNestable::checkAndMaybeUpdateQueryAACube() { bool SpatiallyNestable::checkAndMaybeUpdateQueryAACube() {
bool success; bool success = false;
AACube maxAACube = getMaximumAACube(success); AACube maxAACube = getMaximumAACube(success);
if (success && (!_queryAACubeSet || (_parentID.isNull() && _children.size() == 0) || !_queryAACube.contains(maxAACube))) { if (success) {
// maybe update _queryAACube
if (!_queryAACubeSet || (_parentID.isNull() && _children.size() == 0) || !_queryAACube.contains(maxAACube)) {
if (_parentJointIndex != INVALID_JOINT_INDEX || _children.size() > 0 ) { if (_parentJointIndex != INVALID_JOINT_INDEX || _children.size() > 0 ) {
// make an expanded AACube centered on the object // make an expanded AACube centered on the object
float scale = PARENTED_EXPANSION_FACTOR * maxAACube.getScale(); float scale = PARENTED_EXPANSION_FACTOR * maxAACube.getScale();
@ -961,9 +963,9 @@ bool SpatiallyNestable::checkAndMaybeUpdateQueryAACube() {
} }
getThisPointer()->forEachDescendant([&](SpatiallyNestablePointer descendant) { getThisPointer()->forEachDescendant([&](SpatiallyNestablePointer descendant) {
bool success; bool childSuccess;
AACube descendantAACube = descendant->getQueryAACube(success); AACube descendantAACube = descendant->getQueryAACube(childSuccess);
if (success) { if (childSuccess) {
if (_queryAACube.contains(descendantAACube)) { if (_queryAACube.contains(descendantAACube)) {
return; return;
} }
@ -972,11 +974,9 @@ bool SpatiallyNestable::checkAndMaybeUpdateQueryAACube() {
} }
}); });
_queryAACubeSet = true; _queryAACubeSet = true;
return true;
} else {
return false;
} }
}
return success;
} }
void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) { void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) {