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
This commit is contained in:
Seth Hillbrand 2022-07-28 09:36:31 -07:00
parent 3f448a7eaa
commit df9cf0a0c3
2 changed files with 25 additions and 24 deletions

View File

@ -96,6 +96,11 @@ public:
return m_type; return m_type;
} }
wxString TypeName() const
{
return SHAPE_TYPE_asString( m_type );
}
virtual bool HasIndexableSubshapes() const virtual bool HasIndexableSubshapes() const
{ {
return false; 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 ) int aClearance, int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
int closest_dist = INT_MAX; int closest_dist = INT_MAX;
VECTOR2I nearest; 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 ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
int closest_dist = INT_MAX; int closest_dist = INT_MAX;
VECTOR2I nearest; 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 ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation ); 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 ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation ); 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 ) int aClearance, int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation ); bool rv = aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2, aActual, aLocation );
@ -484,8 +484,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_RECT& aB, int aClea
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
const SHAPE_LINE_CHAIN lc( aA ); const SHAPE_LINE_CHAIN lc( aA );
@ -501,10 +501,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, static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_CIRCLE& aB, int aClearance,
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(),
aB.Type() ) );
const SHAPE_LINE_CHAIN lc( aA ); const SHAPE_LINE_CHAIN lc( aA );
bool rv = Collide( aB, lc, aClearance + aA.GetWidth() / 2, aActual, aLocation, aMTV ); bool rv = Collide( aB, lc, aClearance + aA.GetWidth() / 2, aActual, aLocation, aMTV );
@ -520,8 +516,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_LINE_CHAIN& aB, int
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
int closest_dist = INT_MAX; int closest_dist = INT_MAX;
VECTOR2I nearest; VECTOR2I nearest;
@ -592,8 +588,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_SEGMENT& aB, int aC
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
const SHAPE_LINE_CHAIN lc( aA ); const SHAPE_LINE_CHAIN lc( aA );
@ -610,8 +606,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_LINE_CHAIN_BASE& aB
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
int closest_dist = INT_MAX; int closest_dist = INT_MAX;
VECTOR2I nearest; VECTOR2I nearest;
@ -667,8 +663,8 @@ static inline bool Collide( const SHAPE_ARC& aA, const SHAPE_ARC& aB, int aClear
int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV ) int* aActual, VECTOR2I* aLocation, VECTOR2I* aMTV )
{ {
wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ), wxASSERT_MSG( !aMTV, wxString::Format( wxT( "MTV not implemented for %s : %s collisions" ),
aA.Type(), aA.TypeName(),
aB.Type() ) ); aB.TypeName() ) );
SEG mediatrix( aA.GetCenter(), aB.GetCenter() ); SEG mediatrix( aA.GetCenter(), aB.GetCenter() );