diff --git a/contrib/brushexport/export.cpp b/contrib/brushexport/export.cpp index 86a09f37..9678f25f 100644 --- a/contrib/brushexport/export.cpp +++ b/contrib/brushexport/export.cpp @@ -96,7 +96,7 @@ void ExportData::AddBrushFace( Face& f ){ GetShaderNameFromShaderPath( f.GetShader(), shadername ); // ignore faces from ignore list - if ( ignorelist.find( shadername ) != ignorelist.end() ) { + if ( ignorelist.contains( shadername ) ) { return; } diff --git a/contrib/meshtex/GenericMainMenu.cpp b/contrib/meshtex/GenericMainMenu.cpp index 0cf42362..8baa5b11 100644 --- a/contrib/meshtex/GenericMainMenu.cpp +++ b/contrib/meshtex/GenericMainMenu.cpp @@ -59,7 +59,7 @@ GenericMainMenu::Dispatch(const char *command) // The command key should always be in the map, since the set of commands // advertised to Radiant is the same as the set used to make the map. #if defined(_DEBUG) - ASSERT_MESSAGE(_dispatchMap.find(commandString) != _dispatchMap.end(), + ASSERT_MESSAGE(_dispatchMap.contains(commandString), "dispatched plugin command unknown"); #endif _dispatchMap[commandString](commandString); diff --git a/contrib/meshtex/GenericPluginUI.cpp b/contrib/meshtex/GenericPluginUI.cpp index ca5833d2..d0bf4fd9 100644 --- a/contrib/meshtex/GenericPluginUI.cpp +++ b/contrib/meshtex/GenericPluginUI.cpp @@ -145,7 +145,7 @@ GenericPluginUI::RegisterWidgetDependence(QAbstractButton *controller, QWidget *controllee) { // Make sure we get a callback when the controller is toggled. - if (_widgetControlMap.find(controller) == _widgetControlMap.end()) + if (!_widgetControlMap.contains(controller)) { QObject::connect( controller, &QAbstractButton::toggled, [this, controller]( bool checked ){ WidgetControlCallback( controller ); @@ -169,7 +169,7 @@ GenericPluginUI::RegisterWidgetAntiDependence(QAbstractButton *controller, QWidget *controllee) { // Make sure we get a callback when the controller is toggled. - if (_widgetControlMap.find(controller) == _widgetControlMap.end()) + if (!_widgetControlMap.contains(controller)) { QObject::connect( controller, &QAbstractButton::toggled, [this, controller]( bool checked ){ WidgetControlCallback( controller ); diff --git a/contrib/shaderplug/shaderplug.cpp b/contrib/shaderplug/shaderplug.cpp index 2bd3e23c..02ffe693 100644 --- a/contrib/shaderplug/shaderplug.cpp +++ b/contrib/shaderplug/shaderplug.cpp @@ -103,11 +103,8 @@ void LoadTextureFile( const char* filename ){ // append filename without trailing file extension (.tga or .jpg for example) strncat( buffer, filename, s_filename.length() - 4 ); - std::set::iterator iter; - iter = shaders.find( buffer ); - // a shader with this name already exists - if ( iter == shaders.end() ) { + if ( !shaders.contains( buffer ) ) { textures.insert( buffer ); } } diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index 281af621..c46730bb 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -98,14 +98,14 @@ bool Keys_press( PressedKeys::Keys& keys, int keyval ){ if ( keys.insert( keyval ).second ) { return AcceleratorMap_activate( g_keydown_accelerators, accelerator_for_event_key( keyval, {} ) ); } - return g_keydown_accelerators.find( accelerator_for_event_key( keyval, {} ) ) != g_keydown_accelerators.end(); + return g_keydown_accelerators.contains( accelerator_for_event_key( keyval, {} ) ); } bool Keys_release( PressedKeys::Keys& keys, int keyval ){ if ( keys.erase( keyval ) != 0 ) { return AcceleratorMap_activate( g_keyup_accelerators, accelerator_for_event_key( keyval, {} ) ); } - return g_keyup_accelerators.find( accelerator_for_event_key( keyval, {} ) ) != g_keyup_accelerators.end(); + return g_keyup_accelerators.contains( accelerator_for_event_key( keyval, {} ) ); } void Keys_releaseAll( PressedKeys::Keys& keys, Qt::KeyboardModifiers state ){ diff --git a/plugins/archivewad/archive.cpp b/plugins/archivewad/archive.cpp index 33cb9bc6..8d3a3d79 100644 --- a/plugins/archivewad/archive.cpp +++ b/plugins/archivewad/archive.cpp @@ -146,7 +146,7 @@ public: return 0; } bool containsFile( const char* name ){ - return m_files.find( name ) != m_files.end(); + return m_files.contains( name ); } void forEachFile( VisitorFunc visitor, const char* root ){ if ( root[0] == '\0' ) { diff --git a/radiant/eclass_xml.cpp b/radiant/eclass_xml.cpp index 1a9dd6a5..d14f5c37 100644 --- a/radiant/eclass_xml.cpp +++ b/radiant/eclass_xml.cpp @@ -277,7 +277,7 @@ bool attributeSupported( const char* name ){ typedef std::map ListAttributeTypes; bool listAttributeSupported( ListAttributeTypes& listTypes, const char* name ){ - return listTypes.find( name ) != listTypes.end(); + return listTypes.contains( name ); } diff --git a/radiant/modelwindow.cpp b/radiant/modelwindow.cpp index 6cfa66db..93c0935d 100644 --- a/radiant/modelwindow.cpp +++ b/radiant/modelwindow.cpp @@ -1191,7 +1191,7 @@ public: : m_modelExtensions( modelExtensions ), m_modelFS( modelFS ), m_modelFoldersMap( modelFoldersMap ){ } void visit( const char* name ) override { - if( m_modelExtensions.count( path_get_extension( name ) ) ){ + if( m_modelExtensions.contains( path_get_extension( name ) ) ){ m_modelFS.insert( name ); //% globalOutputStream() << name << " name\n"; } diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 365320d2..e6296867 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -3048,14 +3048,6 @@ public: typedef std::set PlaneSet; -inline void PlaneSet_insert( PlaneSet& self, const Plane3& plane ){ - self.insert( plane ); -} - -inline bool PlaneSet_contains( const PlaneSet& self, const Plane3& plane ){ - return self.find( plane ) != self.end(); -} - class SelectedPlaneSet : public SelectedPlanes { @@ -3066,10 +3058,10 @@ public: } void insert( const Plane3& plane ){ - PlaneSet_insert( m_selectedPlanes, plane ); + m_selectedPlanes.insert( plane ); } bool contains( const Plane3& plane ) const override { - return PlaneSet_contains( m_selectedPlanes, plane ); + return m_selectedPlanes.contains( plane ); } typedef MemberCaller1 InsertCaller; }; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 22d1f80a..6e46cb66 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -509,7 +509,7 @@ bool Texture_IsShown( IShader* shader, const TextureBrowser& textureBrowser ){ } if ( textureBrowser.m_searchedTags ) { - return textureBrowser.m_found_shaders.find( shader->getName() ) != textureBrowser.m_found_shaders.cend(); + return textureBrowser.m_found_shaders.contains( shader->getName() ); } else { if ( !shader_equal_prefix( shader_get_textureName( shader->getName() ), g_TextureBrowser_currentDirectory.c_str() ) ) { @@ -1380,7 +1380,7 @@ protected: const auto oldName = index.data( Qt::ItemDataRole::DisplayRole ).toByteArray(); if( oldName != newName // is changed - && g_TexBro.m_all_tags.find( newName.constData() ) != g_TexBro.m_all_tags.cend() ){ // & found in existing names + && g_TexBro.m_all_tags.contains( newName.constData() ) ){ // & found in existing names qt_MessageBox( g_TexBro.m_parent, "New tag name is already taken :0", newName.constData(), EMessageBoxType::Error ); } else{ @@ -1504,7 +1504,7 @@ void TextureBrowser_checkTagFile(){ void TextureBrowser_addTag(){ auto tag = StringStream<64>( "NewTag" ); int index = 0; - while( g_TexBro.m_all_tags.find( tag.c_str() ) != g_TexBro.m_all_tags.cend() ) + while( g_TexBro.m_all_tags.contains( tag.c_str() ) ) tag( "NewTag", ++index ); auto item = new QListWidgetItem( tag.c_str() ); diff --git a/tools/quake3/q3map2/autopk3.cpp b/tools/quake3/q3map2/autopk3.cpp index d4999679..17858f1b 100644 --- a/tools/quake3/q3map2/autopk3.cpp +++ b/tools/quake3/q3map2/autopk3.cpp @@ -533,10 +533,10 @@ int pk3BSPMain( Args& args ){ //wanted shaders from excluded .shaders Sys_Printf( "\n" ); for ( auto& s : pk3Shaders ){ - if ( !s.empty() && ( ExReasonShader.count( &s ) || ExReasonShaderFile.count( &s ) ) ){ + if ( !s.empty() && ( ExReasonShader.contains( &s ) || ExReasonShaderFile.contains( &s ) ) ){ Sys_FPrintf( SYS_WRN, " !FAIL! %s\n", s.c_str() ); packFAIL = true; - if ( ExReasonShader.count( &s ) ){ + if ( ExReasonShader.contains( &s ) ){ Sys_Printf( " reason: is located in %s,\n containing restricted shader %s\n", ExReasonShaderFile[&s].c_str(), ExReasonShader[&s].c_str() ); } else{