Fix error in contour check

Correct mistake in bool() that prevented checking correct contour for
end of vertex list.
This commit is contained in:
Seth Hillbrand 2019-04-16 20:21:04 -07:00
parent 8cc3c6f159
commit 2a00fc962b
2 changed files with 7 additions and 4 deletions

View File

@ -165,9 +165,11 @@ class SHAPE_POLY_SET : public SHAPE
operator bool() const
{
return ( ( m_currentPolygon < m_lastPolygon ) ||
( m_currentPolygon == m_lastPolygon &&
m_currentVertex < m_poly->CPolygon( m_currentPolygon )[0].PointCount() ) );
return ( ( m_currentPolygon < m_lastPolygon ) || ( IsLastPolygon() &&
( m_currentContour < static_cast<int>( m_poly->CPolygon( m_currentPolygon ).size() ) ||
( IsEndContour() && m_currentVertex < m_poly->CPolygon( m_currentPolygon )[m_currentContour].PointCount() )
)
) );
}
/**

View File

@ -176,7 +176,8 @@ BOOST_AUTO_TEST_CASE( CollideVertex )
// Check that the set collides with the colliding points
for( const VECTOR2I& point : common.holeyPoints )
{
BOOST_CHECK( common.holeyPolySet.CollideVertex( point, cornerHit, 0 ) );
BOOST_CHECK_MESSAGE( common.holeyPolySet.CollideVertex( point, cornerHit, 0 ), " Point "
<< point.x << ", " << point.y << " does not collide with holeyPolySet polygon" );
}
}