From 7fa4d16b501e436a7733454a7d1a4b277abb575f Mon Sep 17 00:00:00 2001 From: supermerill Date: Thu, 29 Nov 2018 17:31:41 +0100 Subject: [PATCH] replace some other dubious algo for comparing surface_type (Surface collection::filter_by_type) --- xs/src/libslic3r/SurfaceCollection.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/xs/src/libslic3r/SurfaceCollection.cpp b/xs/src/libslic3r/SurfaceCollection.cpp index 04f449dc2..cb58afaca 100644 --- a/xs/src/libslic3r/SurfaceCollection.cpp +++ b/xs/src/libslic3r/SurfaceCollection.cpp @@ -93,24 +93,26 @@ template bool SurfaceCollection::any_bottom_contains(const Polyline &i SurfacesPtr SurfaceCollection::filter_by_type(std::initializer_list types) { - size_t n {0}; - for (const auto& t : types) - n |= t; SurfacesPtr ss; - for (auto& s : this->surfaces) - if ((s.surface_type & n) == s.surface_type) ss.push_back(&s); + for (Surface& s : this->surfaces) + for (const SurfaceType& t : types) + if (s.surface_type == t) { + ss.push_back(&s); + break; + } return ss; } SurfacesConstPtr SurfaceCollection::filter_by_type(std::initializer_list types) const { - size_t n {0}; - for (const auto& t : types) - n |= t; SurfacesConstPtr ss; - for (auto& s : this->surfaces) - if ((s.surface_type & n) == s.surface_type) ss.push_back(&s); + for (Surface& s : this->surfaces) + for (const SurfaceType& t : types) + if (s.surface_type == t) { + ss.push_back(&s); + break; + } return ss; }