Fix crash in PNS walkaround

Placing via in walkaround mode and colliding with an arc triggered an
unneeded assertion.

Also fixes the bad assertion format that did not receive strings

(cherry picked from commit df9cf0a0c3)
This commit is contained in:
Seth Hillbrand 2022-07-28 09:36:31 -07:00
parent 753f2f3e4c
commit f6d2164cb0
2 changed files with 25 additions and 24 deletions

View File

@ -97,6 +97,11 @@ public:
return m_type;
}
wxString TypeName() const
{
return SHAPE_TYPE_asString( m_type );
}
virtual bool HasIndexableSubshapes() const
{
return false;

View File

@ -290,8 +290,8 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_LINE_CH
int aClearance, int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
int closest_dist = INT_MAX;
VECTOR2I nearest;
@ -372,8 +372,8 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_LINE_CHAIN_BASE& a
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
int closest_dist = INT_MAX;
VECTOR2I nearest;
@ -429,8 +429,8 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_SEGMENT& aB, int a
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
@ -445,8 +445,8 @@ static inline bool Collide( const SHAPE_SEGMENT& aA, const SHAPE_SEGMENT& aB, in
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
@ -461,8 +461,8 @@ static inline bool Collide( const SHAPE_LINE_CHAIN_BASE& aA, const SHAPE_SEGMENT
int aClearance, int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
@ -494,8 +494,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_RECT& aB, int aClea
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
const SHAPE_LINE_CHAIN lc( aA );
@ -511,10 +511,6 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_RECT& aB, int aClea
static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_CIRCLE& aB, int aClearance,
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
const SHAPE_LINE_CHAIN lc( aA );
bool rv = Collide( aB, lc, aClearance + aA.GetWidth() / 2, aActual, aLocation, aMTV );
@ -530,8 +526,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_LINE_CHAIN& aB, int
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
int closest_dist = INT_MAX;
VECTOR2I nearest;
@ -602,8 +598,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_SEGMENT& aB, int aC
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
const SHAPE_LINE_CHAIN lc( aA );
@ -620,8 +616,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_LINE_CHAIN_BASE& aB
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
int closest_dist = INT_MAX;
VECTOR2I nearest;
@ -677,8 +673,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_ARC& aB, int aClear
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
SHAPE_TYPE_asString( aA.Type() ),
SHAPE_TYPE_asString( aB.Type() ) ) );
aA.TypeName(),
aB.TypeName() ) );
SEG mediatrix( aA.GetCenter(), aB.GetCenter() );