From 9f29864f50e18a90079a2b40466a39bb54d03d6b Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 11 Jul 2017 05:36:00 +0200 Subject: [PATCH] lessen code duplication --- radiant/selection.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/radiant/selection.cpp b/radiant/selection.cpp index d078a3f9..9a50f12e 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -3787,6 +3787,7 @@ const SelectionIntersection& bestIntersection() const { class BestSelector : public Selector { +protected: SelectionIntersection m_intersection; Selectable* m_selectable; SelectionIntersection m_bestIntersection; @@ -3823,20 +3824,9 @@ const SelectionIntersection& bestIntersection() const { } }; -class DeepBestSelector : public Selector +class DeepBestSelector : public BestSelector // copy of class BestSelector with 2.f depthEpsilon { -SelectionIntersection m_intersection; -Selectable* m_selectable; -SelectionIntersection m_bestIntersection; -std::list m_bestSelectable; public: -DeepBestSelector() : m_bestIntersection( SelectionIntersection() ), m_bestSelectable( 0 ){ -} - -void pushSelectable( Selectable& selectable ){ - m_intersection = SelectionIntersection(); - m_selectable = &selectable; -} void popSelectable(){ if ( m_intersection.equalEpsilon( m_bestIntersection, 0.25f, 2.f ) ) { m_bestSelectable.push_back( m_selectable ); @@ -3849,13 +3839,6 @@ void popSelectable(){ } m_intersection = SelectionIntersection(); } -void addIntersection( const SelectionIntersection& intersection ){ - assign_if_closer( m_intersection, intersection ); -} - -std::list& best(){ - return m_bestSelectable; -} }; class BestPointSelector : public Selector