7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 20:11:41 +00:00

Set default netclass priority explicitly in constructor

This currently only happens for migrated schematics. It's not
currently needed for netclass ordering, but will ensure the
priorities are orderable without special-casing the default
netclass should anybody require that functionality in the future.
This commit is contained in:
JamesJCode 2025-01-21 00:23:48 +00:00
parent a71b7e14d4
commit a50d3b5d1b

View File

@ -63,6 +63,7 @@ NET_SETTINGS::NET_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
{
m_defaultNetClass = std::make_shared<NETCLASS>( NETCLASS::Default, true );
m_defaultNetClass->SetDescription( _( "This is the default net class." ) );
m_defaultNetClass->SetPriority( std::numeric_limits<int>::max() );
auto saveNetclass =
[]( nlohmann::json& json_array, const std::shared_ptr<NETCLASS>& nc )
@ -670,7 +671,7 @@ std::shared_ptr<NETCLASS> NET_SETTINGS::GetEffectiveNetClass( const wxString& aN
if( ii == m_impicitNetClasses.end() )
{
std::shared_ptr<NETCLASS> nc = std::make_shared<NETCLASS>( netclass, false );
nc->SetPriority( std::numeric_limits<int>().max() - 1 ); // Priority > default netclass
nc->SetPriority( std::numeric_limits<int>::max() - 1 ); // Priority > default netclass
m_impicitNetClasses[netclass] = nc;
return nc;
}