From 911a7cceebb9573d152cc3a2fcbd292e7eac4695 Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 3 Sep 2025 00:29:13 +0500 Subject: [PATCH] minor tweaks --- contrib/bobtoolz/DBrush.cpp | 8 +- contrib/bobtoolz/DPatch.cpp | 2 +- contrib/bobtoolz/DShape.cpp | 2 +- contrib/bobtoolz/DTrainDrawer.cpp | 11 +-- contrib/bobtoolz/DVisDrawer.cpp | 2 +- contrib/bobtoolz/DWinding.cpp | 10 +-- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 102 +++++++++++----------- contrib/bobtoolz/funchandlers-GTK.cpp | 2 +- contrib/bobtoolz/shapes.cpp | 4 +- contrib/bobtoolz/visfind.cpp | 2 +- contrib/brushexport/callbacks.cpp | 2 +- contrib/brushexport/interface.cpp | 32 +++---- contrib/meshtex/GeneralFunctionDialog.cpp | 70 +++++++-------- contrib/meshtex/GetInfoDialog.cpp | 14 +-- contrib/meshtex/SetScaleDialog.cpp | 80 ++++++++--------- contrib/prtview/ConfigDialog.cpp | 30 +++---- contrib/prtview/LoadPortalFileDialog.cpp | 6 +- contrib/prtview/portals.cpp | 2 +- contrib/shaderplug/shaderplug.cpp | 11 +-- contrib/sunplug/sunplug.cpp | 20 ++--- libs/dragplanes.h | 1 + libs/eclasslib.h | 2 +- libs/gtkutil/accelerator.cpp | 6 +- libs/gtkutil/clipboard.cpp | 4 +- libs/gtkutil/combobox.h | 2 +- libs/gtkutil/cursor.h | 2 +- libs/gtkutil/dialog.cpp | 10 +-- libs/gtkutil/filechooser.cpp | 2 +- libs/gtkutil/guisettings.cpp | 4 +- libs/gtkutil/lineedit.h | 2 +- libs/gtkutil/nonmodal.h | 4 +- libs/gtkutil/spinbox.h | 2 +- libs/gtkutil/widget.h | 2 +- libs/moduleobservers.h | 9 +- plugins/assmodel/mdlimage.cpp | 2 +- plugins/assmodel/model.cpp | 4 +- plugins/entity/skincache.cpp | 2 +- plugins/image/bmp.cpp | 2 +- plugins/image/dds.cpp | 2 +- plugins/image/jpeg.cpp | 2 +- plugins/image/ktx.cpp | 2 +- plugins/image/pcx.cpp | 2 +- plugins/image/tga.cpp | 2 +- plugins/imagehl/hlw.cpp | 2 +- plugins/imagehl/mip.cpp | 2 +- plugins/imagehl/sprite.cpp | 2 +- plugins/imagepng/plugin.cpp | 2 +- plugins/imageq2/wal.cpp | 2 +- plugins/imageq2/wal32.cpp | 2 +- plugins/md3model/md2.cpp | 4 +- plugins/md3model/md3.cpp | 4 +- plugins/md3model/md5.cpp | 2 +- plugins/md3model/mdc.cpp | 4 +- plugins/md3model/mdl.cpp | 4 +- plugins/md3model/mdlimage.cpp | 2 +- plugins/model/model.cpp | 6 +- plugins/spritemodel/spritemodel.cpp | 2 +- plugins/vfspk3/archive.cpp | 4 +- radiant/build.cpp | 4 +- radiant/commands.cpp | 14 +-- radiant/csg.cpp | 38 ++++---- radiant/dialog.cpp | 22 ++--- radiant/entityinspector.cpp | 66 +++++++------- radiant/entitylist.cpp | 4 +- radiant/filterbar.cpp | 2 +- radiant/findtexturedialog.cpp | 16 ++-- radiant/groupdialog.cpp | 2 +- radiant/gtkdlgs.cpp | 67 +++++++------- radiant/gtkmisc.cpp | 8 +- radiant/mainframe.cpp | 48 +++++----- radiant/map.cpp | 26 +++--- radiant/modelwindow.cpp | 20 ++--- radiant/patchmanip.cpp | 40 ++++----- radiant/preferences.cpp | 22 ++--- radiant/renderstate.cpp | 2 +- radiant/select.cpp | 12 +-- radiant/selection.cpp | 12 +-- radiant/server.cpp | 2 +- radiant/surfacedialog.cpp | 28 +++--- radiant/textures.cpp | 4 +- radiant/texwindow.cpp | 42 ++++----- radiant/watchbsp.cpp | 8 +- radiant/winding.cpp | 14 ++- radiant/windowobservers.cpp | 10 +-- tools/quake3/common/vfs.cpp | 17 ++-- tools/quake3/q3map2/autopk3.cpp | 4 +- tools/quake3/q3map2/bsp.cpp | 4 +- tools/quake3/q3map2/convert_json.cpp | 29 +++--- tools/quake3/q3map2/image.cpp | 2 +- tools/quake3/q3map2/light.cpp | 8 +- tools/quake3/q3map2/light_trace.cpp | 2 +- tools/quake3/q3map2/model.cpp | 3 +- tools/quake3/q3map2/portals.cpp | 2 +- tools/quake3/q3map2/prtfile.cpp | 9 +- tools/quake3/q3map2/shaders.cpp | 5 +- tools/quake3/q3map2/surface.cpp | 4 +- tools/quake3/q3map2/surface_meta.cpp | 23 +++-- tools/quake3/q3map2/tjunction.cpp | 19 ++-- 98 files changed, 594 insertions(+), 598 deletions(-) diff --git a/contrib/bobtoolz/DBrush.cpp b/contrib/bobtoolz/DBrush.cpp index 56af9dc8..fd8fd16d 100644 --- a/contrib/bobtoolz/DBrush.cpp +++ b/contrib/bobtoolz/DBrush.cpp @@ -66,7 +66,7 @@ DPlane* DBrush::AddFace( const vec3_t va, const vec3_t vb, const vec3_t vc, cons // Sys_Printf( "(%f %f %f) (%f %f %f) (%f %f %f)\n", va[0], va[1], va[2], vb[0], vb[1], vb[2], vc[0], vc[1], vc[2] ); #endif bBoundsBuilt = false; - DPlane* newFace = new DPlane( va, vb, vc, texData ); + auto *newFace = new DPlane( va, vb, vc, texData ); faceList.push_back( newFace ); return newFace; @@ -174,7 +174,7 @@ void DBrush::ClearFaces(){ } void DBrush::AddPoint( vec3_t pnt ){ - DPoint* newPoint = new DPoint; + auto *newPoint = new DPoint; VectorCopy( pnt, newPoint->_pnt ); pointList.push_back( newPoint ); } @@ -425,8 +425,8 @@ void DBrush::CutByPlane( DPlane *cutPlane, DBrush **newBrush1, DBrush **newBrush return; } - DBrush* b1 = new DBrush; - DBrush* b2 = new DBrush; + auto *b1 = new DBrush; + auto *b2 = new DBrush; for ( DPlane *plane : faceList ) { diff --git a/contrib/bobtoolz/DPatch.cpp b/contrib/bobtoolz/DPatch.cpp index 298e360d..601726e3 100644 --- a/contrib/bobtoolz/DPatch.cpp +++ b/contrib/bobtoolz/DPatch.cpp @@ -304,7 +304,7 @@ DPatch* DPatch::MergePatches( patch_merge_t merge_info, DPatch& p1, DPatch& p2 ) return 0; } - DPatch* newPatch = new DPatch(); + auto *newPatch = new DPatch(); newPatch->height = newHeight; newPatch->width = p1.width; diff --git a/contrib/bobtoolz/DShape.cpp b/contrib/bobtoolz/DShape.cpp index 3ec81e68..b7170733 100644 --- a/contrib/bobtoolz/DShape.cpp +++ b/contrib/bobtoolz/DShape.cpp @@ -256,7 +256,7 @@ void DShape::BuildBorderedPrism( vec3_t min, vec3_t max, int nSides, int nBorder } DBrush* DShape::GetBoundingCube_Ext( vec3_t min, vec3_t max, const char *textureName, bool* bUseFaces, bool detail ){ - DBrush* pB = new DBrush; + auto *pB = new DBrush; //----- Build Outer Bounds --------- vec3_t v1, v2, v3, v5, v6, v7; diff --git a/contrib/bobtoolz/DTrainDrawer.cpp b/contrib/bobtoolz/DTrainDrawer.cpp index d95578b9..8b6c068e 100644 --- a/contrib/bobtoolz/DTrainDrawer.cpp +++ b/contrib/bobtoolz/DTrainDrawer.cpp @@ -20,6 +20,7 @@ #include "DTrainDrawer.h" #include +#include #include "DPoint.h" #include "DPlane.h" @@ -269,13 +270,13 @@ void DTrainDrawer::BuildPaths() { } std::size_t count = pSP->m_pointList.size() + 2; - vec3_t* v = new vec3_t[count]; + auto *v = new vec3_t[count]; VectorCopy( pSP->point.vOrigin, v[0] ); int i = 1; - for ( std::list::reverse_iterator cp = pSP->m_pointList.rbegin(); cp != pSP->m_pointList.rend(); cp++ ) { - VectorCopy( ( *cp ).vOrigin, v[i] ); + for ( const auto& cp : std::ranges::reverse_view( pSP->m_pointList ) ) { + VectorCopy( cp.vOrigin, v[i] ); i++; } VectorCopy( pSP->pTarget->vOrigin, v[i] ); @@ -295,7 +296,7 @@ void DTrainDrawer::BuildPaths() { } void DTrainDrawer::AddControlPoint( const char* name, vec_t* origin ){ - controlPoint_t* pCP = new controlPoint_t; + auto *pCP = new controlPoint_t; strncpy( pCP->strName, name, std::size( pCP->strName ) - 1 ); pCP->strName[ std::size( pCP->strName ) - 1 ] = '\0'; @@ -305,7 +306,7 @@ void DTrainDrawer::AddControlPoint( const char* name, vec_t* origin ){ } splinePoint_t* DTrainDrawer::AddSplinePoint( const char* name, const char* target, vec_t* origin ){ - splinePoint_t* pSP = new splinePoint_t; + auto *pSP = new splinePoint_t; strncpy( pSP->point.strName, name, std::size( pSP->point.strName ) - 1 ); pSP->point.strName[ std::size( pSP->point.strName ) - 1 ] = '\0'; diff --git a/contrib/bobtoolz/DVisDrawer.cpp b/contrib/bobtoolz/DVisDrawer.cpp index 7116ef0d..a54f601e 100644 --- a/contrib/bobtoolz/DVisDrawer.cpp +++ b/contrib/bobtoolz/DVisDrawer.cpp @@ -172,7 +172,7 @@ void DVisDrawer::ui_create(){ m_dialog->setWindowTitle( "BSP leafs" ); { - auto vbox = new QVBoxLayout( m_dialog ); + auto *vbox = new QVBoxLayout( m_dialog ); { m_table = new QTableWidget( 0, 4 ); vbox->addWidget( m_table ); diff --git a/contrib/bobtoolz/DWinding.cpp b/contrib/bobtoolz/DWinding.cpp index 8dd300ab..7d1ee751 100644 --- a/contrib/bobtoolz/DWinding.cpp +++ b/contrib/bobtoolz/DWinding.cpp @@ -114,7 +114,7 @@ void DWinding::RemoveColinearPoints(){ } DPlane* DWinding::WindingPlane(){ - DPlane* newPlane = new DPlane( p[0], p[1], p[2], NULL ); + auto *newPlane = new DPlane( p[0], p[1], p[2], NULL ); return newPlane; } @@ -168,7 +168,7 @@ void DWinding::WindingCentroid( vec3_t centroid ) const { } DWinding* DWinding::CopyWinding(){ - DWinding* c = new DWinding; + auto *c = new DWinding; c->AllocWinding( numpoints ); memcpy( c->p, p, numpoints * sizeof( vec3_t ) ); return c; @@ -271,7 +271,7 @@ void DWinding::CheckWinding(){ } DWinding* DWinding::ReverseWinding(){ - DWinding* c = new DWinding; + auto *c = new DWinding; c->AllocWinding( numpoints ); for ( int i = 0; i < numpoints; i++ ) @@ -424,8 +424,8 @@ void DWinding::ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding ** int maxpts = numpoints + 4; // cant use counts[0]+2 because // of fp grouping errors - DWinding* f = new DWinding; - DWinding* b = new DWinding; + auto *f = new DWinding; + auto *b = new DWinding; f->AllocWinding( maxpts ); f->numpoints = 0; diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 0b860156..bc8b8cbb 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -66,7 +66,7 @@ bool DoIntersectBox( IntersectRS* rs ){ QCheckBox *check1, *check2; { - auto vbox = new QVBoxLayout( &dialog ); + auto *vbox = new QVBoxLayout( &dialog ); vbox->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { vbox->addWidget( radio1 = new QRadioButton( "Use Whole Map" ) ); @@ -74,7 +74,7 @@ bool DoIntersectBox( IntersectRS* rs ){ radio1->setChecked( true ); } { - auto line = new QFrame; + auto *line = new QFrame; line->setFrameShape( QFrame::Shape::HLine ); line->setFrameShadow( QFrame::Shadow::Raised ); vbox->addWidget( line ); @@ -84,7 +84,7 @@ bool DoIntersectBox( IntersectRS* rs ){ vbox->addWidget( check2 = new QCheckBox( "Select Duplicate Brushes Only" ) ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); vbox->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -110,28 +110,28 @@ bool DoPolygonBox( PolygonRS* rs ){ QCheckBox *check_border, *check_inverse, *check_align; { - auto hbox = new QHBoxLayout( &dialog ); + auto *hbox = new QHBoxLayout( &dialog ); hbox->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto form = new QFormLayout; + auto *form = new QFormLayout; hbox->addLayout( form ); { - auto spin = spin_sides = new SpinBox( 3, 128, 6 ); + auto *spin = spin_sides = new SpinBox( 3, 128, 6 ); form->addRow( new SpinBoxLabel( "Number Of Sides", spin ), spin ); } { - auto spin = spin_border = new SpinBox( 8, 256, 16 ); + auto *spin = spin_border = new SpinBox( 8, 256, 16 ); form->addRow( new SpinBoxLabel( "Border Width", spin ), spin ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); } } { - auto vbox = new QVBoxLayout; + auto *vbox = new QVBoxLayout; hbox->addLayout( vbox ); { vbox->addWidget( check_border = new QCheckBox( "Use Border" ) ); @@ -177,32 +177,32 @@ bool DoBuildStairsBox( BuildStairsRS* rs ){ QLineEdit *edit_mainTex, *edit_riserTex; { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto spin = spin_stairHeight = new SpinBox( 1, 1024, 8 ); + auto *spin = spin_stairHeight = new SpinBox( 1, 1024, 8 ); form->addRow( new SpinBoxLabel( "Stair Height", spin ), spin ); } { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; form->addRow( "Direction:", hbox ); group_direction = new QButtonGroup( form ); group_direction->addButton( new QRadioButton( "North" ), MOVE_NORTH ); group_direction->addButton( new QRadioButton( "South" ), MOVE_SOUTH ); group_direction->addButton( new QRadioButton( "East" ), MOVE_EAST ); group_direction->addButton( new QRadioButton( "West" ), MOVE_WEST ); - for( auto b : group_direction->buttons() ) + for( auto *b : group_direction->buttons() ) hbox->addWidget( b ); group_direction->button( MOVE_NORTH )->setChecked( true ); } { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; form->addRow( "Style:", hbox ); group_style = new QButtonGroup( form ); group_style->addButton( new QRadioButton( "Original" ), STYLE_ORIGINAL ); group_style->addButton( new QRadioButton( "Bob's Style" ), STYLE_BOB ); group_style->addButton( new QRadioButton( "Corner Style" ), STYLE_CORNER ); - for( auto b : group_style->buttons() ) + for( auto *b : group_style->buttons() ) hbox->addWidget( b ); group_style->button( STYLE_ORIGINAL )->setChecked( true ); } @@ -222,7 +222,7 @@ bool DoBuildStairsBox( BuildStairsRS* rs ){ edit_riserTex->setMaxLength( std::size( rs->riserTexture ) - 1 ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -253,7 +253,7 @@ bool DoDoorsBox( DoorRS* rs ){ QRadioButton *radioNS, *radioEW; { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { form->addRow( "Door Front/Back Texture", comboMain = new ComboBox ); @@ -288,7 +288,7 @@ bool DoDoorsBox( DoorRS* rs ){ radioNS->setChecked( true ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -333,7 +333,7 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ tabs->addTab( containerWidget, "From params" ); auto *form = new QFormLayout( containerWidget ); { - auto spin = spin_segments = new SpinBox( 3, 256, rs->segments ); + auto *spin = spin_segments = new SpinBox( 3, 256, rs->segments ); form->addRow( new SpinBoxLabel( "Number Of Segments", spin ), spin ); } { @@ -402,11 +402,11 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ form->addRow( "Main Texture", comboMain2 ); form->addRow( "Trim Texture", comboTrim2 ); { - auto spin = spin_innerDepth1 = new DoubleSpinBox( 0, 999999, rs->innerDepth1 ); + auto *spin = spin_innerDepth1 = new DoubleSpinBox( 0, 999999, rs->innerDepth1 ); form->addRow( new SpinBoxLabel( "Depth1", spin ), spin ); } { - auto spin = spin_innerDepth2 = new DoubleSpinBox( 0, 999999, rs->innerDepth2 ); + auto *spin = spin_innerDepth2 = new DoubleSpinBox( 0, 999999, rs->innerDepth2 ); form->addRow( new SpinBoxLabel( "Depth2", spin ), spin ); } { @@ -439,11 +439,11 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ checkSlopedSegmentsRoundize->setChecked( rs->slopedSegmentsRoundize ); } { - auto spin = spin_slopedDepth1 = new DoubleSpinBox( 0, 999999, rs->slopedDepth1 ); + auto *spin = spin_slopedDepth1 = new DoubleSpinBox( 0, 999999, rs->slopedDepth1 ); form->addRow( new SpinBoxLabel( "Depth1", spin ), spin ); } { - auto spin = spin_slopedDepth2 = new DoubleSpinBox( 0, 999999, rs->slopedDepth2 ); + auto *spin = spin_slopedDepth2 = new DoubleSpinBox( 0, 999999, rs->slopedDepth2 ); form->addRow( new SpinBoxLabel( "Depth2", spin ), spin ); } } @@ -482,7 +482,7 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ tabs->addTab( containerWidget, "Open time" ); auto *form = new QFormLayout( containerWidget ); { - auto spin = spin_time = new DoubleSpinBox( 0.001, 256, rs->time, 3, 0.1 ); + auto *spin = spin_time = new DoubleSpinBox( 0.001, 256, rs->time, 3, 0.1 ); form->addRow( new SpinBoxLabel( "Time", spin ), spin ); } } @@ -491,7 +491,7 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ tabs->addTab( containerWidget, "Open speed" ); auto *form = new QFormLayout( containerWidget ); { - auto spin = spin_speed = new DoubleSpinBox( -1, 999999, rs->speed ); // negative speed = infinite speed + auto *spin = spin_speed = new DoubleSpinBox( -1, 999999, rs->speed ); // negative speed = infinite speed form->addRow( new SpinBoxLabel( "Speed", spin ), spin ); } } @@ -507,7 +507,7 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ spin_distance->setEnabled( rs->distanceSet ); } { - auto spin = spin_openAngle = new DoubleSpinBox( -180, 180, rs->openAngle, 3 ); + auto *spin = spin_openAngle = new DoubleSpinBox( -180, 180, rs->openAngle, 3 ); auto *label = new SpinBoxLabel( "Open Angle *", spin ); form->addRow( label, spin ); const QString tip( "0 = seamless\n180 = seamless reverted\n90 = radially\n<0 = overlapping" ); @@ -519,12 +519,12 @@ bool DoApertureDoorsBox( ApertureDoorRS* rs ){ checkHealth->setChecked( rs->health ); } { - auto spin = spin_wait = new DoubleSpinBox( -1, 999999, rs->wait ); + auto *spin = spin_wait = new DoubleSpinBox( -1, 999999, rs->wait ); form->addRow( new SpinBoxLabel( "Wait", spin ), spin ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -582,19 +582,19 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ EMessageBoxReturn ret = eIDCANCEL; { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto spin = spin_pts = new SpinBox( 1, 200, 50 ); + auto *spin = spin_pts = new SpinBox( 1, 200, 50 ); form->addRow( new SpinBoxLabel( "Number Of Points", spin ), spin ); } { - auto spin = spin_mult = new DoubleSpinBox( 1, 10, 3 ); + auto *spin = spin_mult = new DoubleSpinBox( 1, 10, 3 ); form->addRow( new SpinBoxLabel( "Distance Multipler", spin ), spin ); spin->setToolTip( "Path Distance = dist(start -> apex) * multiplier" ); } { - auto spin = spin_grav = new DoubleSpinBox( -10000, -1, -800 ); + auto *spin = spin_grav = new DoubleSpinBox( -10000, -1, -800 ); form->addRow( new SpinBoxLabel( "Gravity", spin ), spin ); } { @@ -602,7 +602,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ form->addWidget( check2 = new QCheckBox( "Show Bounding Lines" ) ); } { - auto buttons = new QDialogButtonBox; + auto *buttons = new QDialogButtonBox; form->addWidget( buttons ); // rejection via dialog means will return DialogCode::Rejected (0), eID* > 0 QObject::connect( buttons->addButton( "Enable", QDialogButtonBox::ButtonRole::AcceptRole ), @@ -637,7 +637,7 @@ EMessageBoxReturn DoCTFColourChangeBox(){ EMessageBoxReturn ret = eIDCANCEL; { - auto buttons = new QDialogButtonBox; + auto *buttons = new QDialogButtonBox; // rejection via dialog means will return DialogCode::Rejected (0), eID* > 0 QObject::connect( buttons->addButton( "Red->Blue", QDialogButtonBox::ButtonRole::AcceptRole ), &QAbstractButton::clicked, [&dialog](){ dialog.done( eIDOK ); } ); @@ -668,17 +668,17 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ QDoubleSpinBox *spin_Rotation; { - auto vbox = new QVBoxLayout( &dialog ); + auto *vbox = new QVBoxLayout( &dialog ); { vbox->addWidget( new QLabel( QString( "Currently Selected Texture: " ) + GetCurrentTexture() ) ); } { - auto group = new QGroupBox( "Reset Texture Names" ); + auto *group = new QGroupBox( "Reset Texture Names" ); group->setCheckable( true ); group->setChecked( false ); vbox->addWidget( group ); { - auto form = new QFormLayout( group ); + auto *form = new QFormLayout( group ); { form->addRow( "Old Name: ", editTexOld = new QLineEdit( rs->textureName ) ); editTexOld->setMaxLength( std::size( rs->textureName ) - 1 ); @@ -690,58 +690,58 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ } } { - auto group = new QGroupBox( "New Horizontal Scale" ); + auto *group = new QGroupBox( "New Horizontal Scale" ); group->setCheckable( true ); group->setChecked( false ); vbox->addWidget( group ); { - auto spin = spin_ScaleHor = new DoubleSpinBox( -1024, 1024, .5, 3, .25 ); + auto *spin = spin_ScaleHor = new DoubleSpinBox( -1024, 1024, .5, 3, .25 ); ( new QFormLayout( group ) )->addWidget( spin ); } } { - auto group = new QGroupBox( "New Vertical Scale" ); + auto *group = new QGroupBox( "New Vertical Scale" ); group->setCheckable( true ); group->setChecked( false ); vbox->addWidget( group ); { - auto spin = spin_ScaleVert = new DoubleSpinBox( -1024, 1024, .5, 3, .25 ); + auto *spin = spin_ScaleVert = new DoubleSpinBox( -1024, 1024, .5, 3, .25 ); ( new QFormLayout( group ) )->addWidget( spin ); } } { - auto group = new QGroupBox( "New Horizontal Shift" ); + auto *group = new QGroupBox( "New Horizontal Shift" ); group->setCheckable( true ); group->setChecked( false ); vbox->addWidget( group ); { - auto spin = spin_ShiftHor = new DoubleSpinBox( -999999, 999999 ); + auto *spin = spin_ShiftHor = new DoubleSpinBox( -999999, 999999 ); ( new QFormLayout( group ) )->addWidget( spin ); } } { - auto group = new QGroupBox( "New Vertical Shift" ); + auto *group = new QGroupBox( "New Vertical Shift" ); group->setCheckable( true ); group->setChecked( false ); vbox->addWidget( group ); { - auto spin = spin_ShiftVert = new DoubleSpinBox( -999999, 999999 ); + auto *spin = spin_ShiftVert = new DoubleSpinBox( -999999, 999999 ); ( new QFormLayout( group ) )->addWidget( spin ); } } { - auto group = new QGroupBox( "New Rotation Value" ); + auto *group = new QGroupBox( "New Rotation Value" ); group->setCheckable( true ); group->setChecked( false ); vbox->addWidget( group ); { - auto spin = spin_Rotation = new DoubleSpinBox( -360, 360, 0, 2, 1, true ); + auto *spin = spin_Rotation = new DoubleSpinBox( -360, 360, 0, 2, 1, true ); ( new QFormLayout( group ) )->addWidget( spin ); } } { - auto buttons = new QDialogButtonBox; + auto *buttons = new QDialogButtonBox; vbox->addWidget( buttons ); // rejection via dialog means will return DialogCode::Rejected (0), eID* > 0 QObject::connect( buttons->addButton( "Use Selected Brushes", QDialogButtonBox::ButtonRole::AcceptRole ), @@ -790,10 +790,10 @@ bool DoMakeChainBox( MakeChainRS* rs ){ QLineEdit *edit_linkName; { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto spin = spin_linkNum = new SpinBox( 1, 1000 ); + auto *spin = spin_linkNum = new SpinBox( 1, 1000 ); form->addRow( new SpinBoxLabel( "Number of elements in chain", spin ), spin ); } { @@ -801,7 +801,7 @@ bool DoMakeChainBox( MakeChainRS* rs ){ edit_linkName->setMaxLength( std::size( rs->linkName ) - 1 ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); diff --git a/contrib/bobtoolz/funchandlers-GTK.cpp b/contrib/bobtoolz/funchandlers-GTK.cpp index 159003b9..562fe092 100644 --- a/contrib/bobtoolz/funchandlers-GTK.cpp +++ b/contrib/bobtoolz/funchandlers-GTK.cpp @@ -527,7 +527,7 @@ void DoMergePatches(){ } } - for( auto instance : patches.instances_erase ) + for( auto *instance : patches.instances_erase ) { scene::Instance* parent = instance->parent(); Path_deleteTop( instance->path() ); diff --git a/contrib/bobtoolz/shapes.cpp b/contrib/bobtoolz/shapes.cpp index 0b9f76f5..e4d893fe 100644 --- a/contrib/bobtoolz/shapes.cpp +++ b/contrib/bobtoolz/shapes.cpp @@ -958,8 +958,8 @@ void MakeBevel( vec3_t vMin, vec3_t vMax ){ } void BuildCornerStairs( vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTexture, const char* riserTex ){ - vec3_t* topPoints = new vec3_t[nSteps + 1]; - vec3_t* botPoints = new vec3_t[nSteps + 1]; + auto *topPoints = new vec3_t[nSteps + 1]; + auto *botPoints = new vec3_t[nSteps + 1]; //bool bFacesUse[6] = {true, true, false, true, false, false}; diff --git a/contrib/bobtoolz/visfind.cpp b/contrib/bobtoolz/visfind.cpp index ee58845b..cae49c11 100644 --- a/contrib/bobtoolz/visfind.cpp +++ b/contrib/bobtoolz/visfind.cpp @@ -306,7 +306,7 @@ public: TraceCluster( TraceCluster&& ) noexcept = delete; DMetaSurfaces* doTraceCluster( int leafnum, bool colorPerSurf ) const { - DMetaSurfaces* pointlist = new DMetaSurfaces; + auto *pointlist = new DMetaSurfaces; repeatlist_clear(); diff --git a/contrib/brushexport/callbacks.cpp b/contrib/brushexport/callbacks.cpp index c833387a..a25b3e6b 100644 --- a/contrib/brushexport/callbacks.cpp +++ b/contrib/brushexport/callbacks.cpp @@ -98,7 +98,7 @@ void OnAddMaterial(){ const char* name = path_get_filename_start( text.constData() ); if ( strlen( name ) > 0 ) { - auto item = new QListWidgetItem( name ); + auto *item = new QListWidgetItem( name ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren ); g_dialog.t_materialist->addItem( item ); } diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index 082e5a9c..e68eda7a 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -34,39 +34,39 @@ protected: }; QWidget* create_w_plugplug2(){ - auto window = g_dialog.window = new QWidget( g_pRadiantWnd, Qt::Dialog | Qt::WindowCloseButtonHint ); + auto *window = g_dialog.window = new QWidget( g_pRadiantWnd, Qt::Dialog | Qt::WindowCloseButtonHint ); window->setWindowTitle( "BrushExport-Plugin 3.0 by namespace" ); qt_connect_shortcut_override( window ); { - auto grid = new QGridLayout( window ); + auto *grid = new QGridLayout( window ); { - auto r_collapse = g_dialog.r_collapse = new QRadioButton( "Collapse mesh" ); + auto *r_collapse = g_dialog.r_collapse = new QRadioButton( "Collapse mesh" ); r_collapse->setToolTip( "Collapse all brushes into a single group" ); grid->addWidget( r_collapse, 0, 0 ); - auto r_collapsebymaterial = g_dialog.r_collapsebymaterial = new QRadioButton( "Collapse by material" ); + auto *r_collapsebymaterial = g_dialog.r_collapsebymaterial = new QRadioButton( "Collapse by material" ); r_collapsebymaterial->setToolTip( "Collapse into groups by material" ); grid->addWidget( r_collapsebymaterial, 1, 0 ); - auto r_nocollapse = g_dialog.r_nocollapse = new QRadioButton( "Don't collapse" ); + auto *r_nocollapse = g_dialog.r_nocollapse = new QRadioButton( "Don't collapse" ); r_nocollapse->setToolTip( "Every brush is stored in its own group" ); grid->addWidget( r_nocollapse, 2, 0 ); r_nocollapse->setChecked( true ); } { - auto b_export = g_dialog.b_export = new QPushButton( "Save" ); + auto *b_export = g_dialog.b_export = new QPushButton( "Save" ); grid->addWidget( b_export, 0, 1 ); b_export->setDisabled( true ); QObject::connect( b_export, &QAbstractButton::clicked, callbacks::OnExportClicked ); - auto b_exportAs = new QPushButton( "Save As" ); + auto *b_exportAs = new QPushButton( "Save As" ); grid->addWidget( b_exportAs, 1, 1 ); QObject::connect( b_exportAs, &QAbstractButton::clicked, [](){ callbacks::OnExportClicked( true ); } ); - auto b_close = new QPushButton( "Cancel" ); + auto *b_close = new QPushButton( "Cancel" ); grid->addWidget( b_close, 2, 1 ); QObject::connect( b_close, &QAbstractButton::clicked, window, &QWidget::hide ); } @@ -74,37 +74,37 @@ QWidget* create_w_plugplug2(){ grid->addWidget( new QLabel( "Ignored materials:" ), 3, 0, 1, 2, Qt::AlignmentFlag::AlignHCenter ); } { - auto t_materialist = g_dialog.t_materialist = new Del_QListWidget; + auto *t_materialist = g_dialog.t_materialist = new Del_QListWidget; grid->addWidget( t_materialist, 4, 0, 1, 2 ); t_materialist->setEditTriggers( QAbstractItemView::EditTrigger::DoubleClicked | QAbstractItemView::EditTrigger::EditKeyPressed ); } { - auto ed_materialname = g_dialog.ed_materialname = new QLineEdit; + auto *ed_materialname = g_dialog.ed_materialname = new QLineEdit; grid->addWidget( ed_materialname, 5, 0, 1, 2 ); QObject::connect( ed_materialname, &QLineEdit::returnPressed, callbacks::OnAddMaterial ); } { - auto b_addmaterial = new QPushButton( "Add" ); + auto *b_addmaterial = new QPushButton( "Add" ); grid->addWidget( b_addmaterial, 6, 0 ); QObject::connect( b_addmaterial, &QAbstractButton::clicked, callbacks::OnAddMaterial ); - auto b_removematerial = new QPushButton( "Remove" ); + auto *b_removematerial = new QPushButton( "Remove" ); grid->addWidget( b_removematerial, 6, 1 ); QObject::connect( b_removematerial, &QAbstractButton::clicked, callbacks::OnRemoveMaterial ); } { - auto t_limitmatnames = g_dialog.t_limitmatnames = new QCheckBox( "Use short material names (max. 20 chars)" ); + auto *t_limitmatnames = g_dialog.t_limitmatnames = new QCheckBox( "Use short material names (max. 20 chars)" ); grid->addWidget( t_limitmatnames, 7, 0, 1, 2 ); - auto t_objects = g_dialog.t_objects = new QCheckBox( "Create (o)bjects instead of (g)roups" ); + auto *t_objects = g_dialog.t_objects = new QCheckBox( "Create (o)bjects instead of (g)roups" ); grid->addWidget( t_objects, 8, 0, 1, 2 ); - auto t_weld = g_dialog.t_weld = new QCheckBox( "Weld vertices" ); + auto *t_weld = g_dialog.t_weld = new QCheckBox( "Weld vertices" ); grid->addWidget( t_weld, 9, 0, 1, 2 ); t_weld->setToolTip( "inside groups/objects" ); t_weld->setChecked( true ); - auto t_exportmaterials = g_dialog.t_exportmaterials = new QCheckBox( "Create material information (.mtl file)" ); + auto *t_exportmaterials = g_dialog.t_exportmaterials = new QCheckBox( "Create material information (.mtl file)" ); grid->addWidget( t_exportmaterials, 10, 0, 1, 2 ); t_exportmaterials->setChecked( true ); } diff --git a/contrib/meshtex/GeneralFunctionDialog.cpp b/contrib/meshtex/GeneralFunctionDialog.cpp index 66c8eb42..cb424e35 100644 --- a/contrib/meshtex/GeneralFunctionDialog.cpp +++ b/contrib/meshtex/GeneralFunctionDialog.cpp @@ -98,23 +98,23 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : // Create the contained widgets. { - auto grid = new QGridLayout( _dialog ); // 6 x 13 + auto *grid = new QGridLayout( _dialog ); // 6 x 13 grid->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); grid->setColumnStretch( 0, 1 ); grid->setColumnStretch( 3, 1 ); { // Mutually exclusive "Surface values" and "Control values" radio buttons. { - auto radio = surface = new QRadioButton( DIALOG_GEN_FUNC_SURFACE_VALUES ); + auto *radio = surface = new QRadioButton( DIALOG_GEN_FUNC_SURFACE_VALUES ); grid->addWidget( radio, 0, 1 ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_GEN_FUNC_CONTROL_VALUES ); + auto *radio = new QRadioButton( DIALOG_GEN_FUNC_CONTROL_VALUES ); grid->addWidget( radio, 0, 2 ); } { - auto line = new QFrame; + auto *line = new QFrame; line->setFrameShape( QFrame::Shape::HLine ); line->setFrameShadow( QFrame::Shadow::Raised ); grid->addWidget( line, 1, 0, 1, 4 ); @@ -123,18 +123,18 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : // will have a dependence registered on this checkbox; i.e. they will only // be active when it is checked. { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; grid->addLayout( hbox, 2, 0, 1, 4 ); - auto check = s_apply = new QCheckBox; + auto *check = s_apply = new QCheckBox; check->setChecked( true ); hbox->addWidget( check ); - auto container = new QWidget; + auto *container = new QWidget; hbox->addWidget( container ); UIInstance().RegisterWidgetDependence( check, container ); - auto container_hbox = new QHBoxLayout( container ); + auto *container_hbox = new QHBoxLayout( container ); container_hbox->setContentsMargins( 0, 0, 0, 0 ); { const struct{ const char* name; QDoubleSpinBox *&spin; } data[] = { @@ -157,18 +157,18 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : // will have a dependence registered on this checkbox; i.e. they will only // be active when it is checked. { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; grid->addLayout( hbox, 3, 0, 1, 4 ); - auto check = t_apply = new QCheckBox; + auto *check = t_apply = new QCheckBox; check->setChecked( true ); hbox->addWidget( check ); - auto container = new QWidget; + auto *container = new QWidget; hbox->addWidget( container ); UIInstance().RegisterWidgetDependence( check, container ); - auto container_hbox = new QHBoxLayout( container ); + auto *container_hbox = new QHBoxLayout( container ); container_hbox->setContentsMargins( 0, 0, 0, 0 ); { const struct{ const char* name; QDoubleSpinBox *&spin; } data[] = { @@ -189,100 +189,100 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : } { // Widgets for specifying the alignment column. - auto group = new QGroupBox( DIALOG_GEN_FUNC_COL_ALIGN_FRAME_LABEL ); + auto *group = new QGroupBox( DIALOG_GEN_FUNC_COL_ALIGN_FRAME_LABEL ); grid->addWidget( group, 4, 1 ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = col_num_align = new SpinBox( 0, 30 ); + auto *spin = col_num_align = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } } { // Widgets for specifying the reference row & usage. - auto group = row_ref = new QGroupBox( DIALOG_GEN_FUNC_REF_ROW_FRAME_LABEL ); + auto *group = row_ref = new QGroupBox( DIALOG_GEN_FUNC_REF_ROW_FRAME_LABEL ); group->setCheckable( true ); group->setChecked( true ); grid->addWidget( group, 5, 1 ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = row_num_ref = new SpinBox( 0, 30 ); + auto *spin = row_num_ref = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } { - auto check = row_ref_total = new QCheckBox( DIALOG_GEN_FUNC_REF_TOTAL_OPT_LABEL ); + auto *check = row_ref_total = new QCheckBox( DIALOG_GEN_FUNC_REF_TOTAL_OPT_LABEL ); grid->addWidget( check, 1, 0, 1, 3 ); check->setChecked( true ); } } { // Widgets for specifying the alignment row. - auto group = new QGroupBox( DIALOG_GEN_FUNC_ROW_ALIGN_FRAME_LABEL ); + auto *group = new QGroupBox( DIALOG_GEN_FUNC_ROW_ALIGN_FRAME_LABEL ); grid->addWidget( group, 4, 2 ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = row_num_align = new SpinBox( 0, 30 ); + auto *spin = row_num_align = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } } { // Widgets for specifying the reference column & usage. - auto group = col_ref = new QGroupBox( DIALOG_GEN_FUNC_REF_COL_FRAME_LABEL ); + auto *group = col_ref = new QGroupBox( DIALOG_GEN_FUNC_REF_COL_FRAME_LABEL ); group->setCheckable( true ); group->setChecked( true ); grid->addWidget( group, 5, 2 ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = col_num_ref = new SpinBox( 0, 30 ); + auto *spin = col_num_ref = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_GEN_FUNC_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } { - auto check = col_ref_total = new QCheckBox( DIALOG_GEN_FUNC_REF_TOTAL_OPT_LABEL ); + auto *check = col_ref_total = new QCheckBox( DIALOG_GEN_FUNC_REF_TOTAL_OPT_LABEL ); grid->addWidget( check, 1, 0, 1, 3 ); check->setChecked( true ); } } { - auto buttons = new QDialogButtonBox; + auto *buttons = new QDialogButtonBox; grid->addWidget( buttons, 6, 0, 1, 4 ); CreateOkButtonCallback( buttons->addButton( QDialogButtonBox::StandardButton::Ok ) ); CreateApplyButtonCallback( buttons->addButton( QDialogButtonBox::StandardButton::Apply ) ); diff --git a/contrib/meshtex/GetInfoDialog.cpp b/contrib/meshtex/GetInfoDialog.cpp index 6c3eba05..9076174e 100644 --- a/contrib/meshtex/GetInfoDialog.cpp +++ b/contrib/meshtex/GetInfoDialog.cpp @@ -91,31 +91,31 @@ GetInfoDialog::GetInfoDialog(const std::string& key, // Create the contained widgets. { - auto form = new QFormLayout( _dialog ); + auto *form = new QFormLayout( _dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { // Widgets for specifying the reference row if any. - auto check = new QCheckBox( DIALOG_GET_INFO_S_ROW_HEADER ); + auto *check = new QCheckBox( DIALOG_GET_INFO_S_ROW_HEADER ); check->setChecked( true ); - auto spin = s_ref_row = new SpinBox( 0, 30 ); + auto *spin = s_ref_row = new SpinBox( 0, 30 ); form->addRow( check, spin ); UIInstance().RegisterWidgetDependence( check, spin ); } { // Widgets for specifying the reference column if any. - auto check = new QCheckBox( DIALOG_GET_INFO_T_COL_HEADER ); + auto *check = new QCheckBox( DIALOG_GET_INFO_T_COL_HEADER ); check->setChecked( true ); - auto spin = t_ref_col = new SpinBox( 0, 30 ); + auto *spin = t_ref_col = new SpinBox( 0, 30 ); form->addRow( check, spin ); UIInstance().RegisterWidgetDependence( check, spin ); } { // Checkbox to enable the callbacks to Set S/T Scale. - auto check = check_transfer = new QCheckBox( DIALOG_GET_INFO_XFER_OPT_LABEL ); + auto *check = check_transfer = new QCheckBox( DIALOG_GET_INFO_XFER_OPT_LABEL ); form->addRow( check ); } { - auto buttons = new QDialogButtonBox; + auto *buttons = new QDialogButtonBox; form->addWidget( buttons ); CreateOkButtonCallback( buttons->addButton( QDialogButtonBox::StandardButton::Ok ) ); CreateApplyButtonCallback( buttons->addButton( QDialogButtonBox::StandardButton::Apply ) ); diff --git a/contrib/meshtex/SetScaleDialog.cpp b/contrib/meshtex/SetScaleDialog.cpp index 1014e78e..1ee3b55a 100644 --- a/contrib/meshtex/SetScaleDialog.cpp +++ b/contrib/meshtex/SetScaleDialog.cpp @@ -91,36 +91,36 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : // Create the contained widgets. { - auto dialog_grid = new QGridLayout( _dialog ); + auto *dialog_grid = new QGridLayout( _dialog ); dialog_grid->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { // Checkbox for the "S" grouping of widgets. All the widgets in that // grouping will have a dependence registered on this checkbox; i.e. they // will only be active when it is checked. - auto group = s_apply = new QGroupBox( DIALOG_SET_SCALE_S_ACTIVE_OPT_LABEL ); + auto *group = s_apply = new QGroupBox( DIALOG_SET_SCALE_S_ACTIVE_OPT_LABEL ); dialog_grid->addWidget( group, 0, 0 ); group->setCheckable( true ); group->setChecked( true ); { - auto vbox = new QVBoxLayout( group ); + auto *vbox = new QVBoxLayout( group ); { // Widgets for specifying S scaling. - auto group = new QGroupBox( DIALOG_SET_SCALE_METHOD_FRAME_TITLE ); + auto *group = new QGroupBox( DIALOG_SET_SCALE_METHOD_FRAME_TITLE ); vbox->addWidget( group ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); { - auto radio = new QRadioButton( DIALOG_SET_SCALE_NATURAL_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_NATURAL_OPT_LABEL ); grid->addWidget( radio, 0, 0 ); - auto spin = s_scale = new DoubleSpinBox( -999, 999, 1, 3 ); + auto *spin = s_scale = new DoubleSpinBox( -999, 999, 1, 3 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_SET_SCALE_TILES_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_TILES_OPT_LABEL ); grid->addWidget( radio, 1, 0 ); - auto spin = s_tiles = new DoubleSpinBox( -999, 999, 1, 3 ); + auto *spin = s_tiles = new DoubleSpinBox( -999, 999, 1, 3 ); grid->addWidget( spin, 1, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); spin->setEnabled( false ); @@ -128,47 +128,47 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : } { // Widgets for specifying the alignment column. - auto group = new QGroupBox( DIALOG_SET_SCALE_S_ALIGN_FRAME_TITLE ); + auto *group = new QGroupBox( DIALOG_SET_SCALE_S_ALIGN_FRAME_TITLE ); vbox->addWidget( group ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = col_num_align = new SpinBox( 0, 30 ); + auto *spin = col_num_align = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } } { // Widgets for specifying the reference row & usage. - auto group = row_ref = new QGroupBox( DIALOG_SET_SCALE_S_REF_ROW_OPT_LABEL ); + auto *group = row_ref = new QGroupBox( DIALOG_SET_SCALE_S_REF_ROW_OPT_LABEL ); group->setCheckable( true ); group->setChecked( true ); vbox->addWidget( group ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = row_num_ref = new SpinBox( 0, 30 ); + auto *spin = row_num_ref = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } { - auto check = row_ref_total = new QCheckBox( DIALOG_SET_SCALE_REF_TOTAL_OPT_LABEL ); + auto *check = row_ref_total = new QCheckBox( DIALOG_SET_SCALE_REF_TOTAL_OPT_LABEL ); grid->addWidget( check, 1, 0, 1, 3 ); check->setChecked( true ); } @@ -179,30 +179,30 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : // Checkbox for the "T" grouping of widgets. All the widgets in that // grouping will have a dependence registered on this checkbox; i.e. they // will only be active when it is checked. - auto group = t_apply = new QGroupBox( DIALOG_SET_SCALE_T_ACTIVE_OPT_LABEL ); + auto *group = t_apply = new QGroupBox( DIALOG_SET_SCALE_T_ACTIVE_OPT_LABEL ); dialog_grid->addWidget( group, 0, 1 ); group->setCheckable( true ); group->setChecked( true ); { - auto vbox = new QVBoxLayout( group ); + auto *vbox = new QVBoxLayout( group ); { // Widgets for specifying T scaling. - auto group = new QGroupBox( DIALOG_SET_SCALE_METHOD_FRAME_TITLE ); + auto *group = new QGroupBox( DIALOG_SET_SCALE_METHOD_FRAME_TITLE ); vbox->addWidget( group ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); { - auto radio = new QRadioButton( DIALOG_SET_SCALE_NATURAL_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_NATURAL_OPT_LABEL ); grid->addWidget( radio, 0, 0 ); - auto spin = t_scale = new DoubleSpinBox( -999, 999, 1, 3 ); + auto *spin = t_scale = new DoubleSpinBox( -999, 999, 1, 3 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_SET_SCALE_TILES_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_TILES_OPT_LABEL ); grid->addWidget( radio, 1, 0 ); - auto spin = t_tiles = new DoubleSpinBox( -999, 999, 1, 3 ); + auto *spin = t_tiles = new DoubleSpinBox( -999, 999, 1, 3 ); grid->addWidget( spin, 1, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); spin->setEnabled( false ); @@ -210,47 +210,47 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : } { // Widgets for specifying the alignment row. - auto group = new QGroupBox( DIALOG_SET_SCALE_T_ALIGN_FRAME_TITLE ); + auto *group = new QGroupBox( DIALOG_SET_SCALE_T_ALIGN_FRAME_TITLE ); vbox->addWidget( group ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = row_num_align = new SpinBox( 0, 30 ); + auto *spin = row_num_align = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } } { // Widgets for specifying the reference column & usage. - auto group = col_ref = new QGroupBox( DIALOG_SET_SCALE_T_REF_COL_OPT_LABEL ); + auto *group = col_ref = new QGroupBox( DIALOG_SET_SCALE_T_REF_COL_OPT_LABEL ); group->setCheckable( true ); group->setChecked( true ); vbox->addWidget( group ); - auto grid = new QGridLayout( group ); + auto *grid = new QGridLayout( group ); grid->setColumnStretch( 2, 1 ); { - auto radio = new QRadioButton; + auto *radio = new QRadioButton; grid->addWidget( radio, 0, 0 ); - auto spin = col_num_ref = new SpinBox( 0, 30 ); + auto *spin = col_num_ref = new SpinBox( 0, 30 ); grid->addWidget( spin, 0, 1 ); UIInstance().RegisterWidgetDependence( radio, spin ); radio->setChecked( true ); } { - auto radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); + auto *radio = new QRadioButton( DIALOG_SET_SCALE_MAX_OPT_LABEL ); grid->addWidget( radio, 0, 2, Qt::AlignmentFlag::AlignRight ); } { - auto check = col_ref_total = new QCheckBox( DIALOG_SET_SCALE_REF_TOTAL_OPT_LABEL ); + auto *check = col_ref_total = new QCheckBox( DIALOG_SET_SCALE_REF_TOTAL_OPT_LABEL ); grid->addWidget( check, 1, 0, 1, 3 ); check->setChecked( true ); } @@ -258,7 +258,7 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : } } { - auto buttons = new QDialogButtonBox; + auto *buttons = new QDialogButtonBox; dialog_grid->addWidget( buttons, 1, 0, 1, 2 ); CreateOkButtonCallback( buttons->addButton( QDialogButtonBox::StandardButton::Ok ) ); CreateApplyButtonCallback( buttons->addButton( QDialogButtonBox::StandardButton::Apply ) ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index a5c2a242..7e0fbd0d 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -48,20 +48,20 @@ static void OnColor( PackedColour& clr ){ } static void form_add_color( QFormLayout *form, PackedColour& color ){ - auto button = new QPushButton( "Color" ); + auto *button = new QPushButton( "Color" ); QObject::connect( button, &QAbstractButton::clicked, [&color](){ OnColor( color ); } ); - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; form->addRow( hbox ); hbox->addStretch(); hbox->addWidget( button ); } static void form_add_slider( QFormLayout *form, int& param, int min, int max, const char *prefix, const char *suffix, bool changeShaders ){ - auto slider = new QSlider( Qt::Orientation::Horizontal ); + auto *slider = new QSlider( Qt::Orientation::Horizontal ); slider->setRange( min, max ); - auto label = new QLabel; + auto *label = new QLabel; label->setMinimumWidth( label->fontMetrics().horizontalAdvance( QString( prefix ) + QString::number( max ) + suffix ) ); const auto label_set_text = [label, prefix, suffix]( int value ){ label->setText( QString( prefix ) + QString::number( value ) + suffix ); @@ -80,7 +80,7 @@ static void form_add_slider( QFormLayout *form, int& param, int min, int max, co } static QGroupBox* vbox_add_group( QVBoxLayout *vbox, const char *name, bool& param, bool changeShaders ){ - auto group = new QGroupBox( name ); + auto *group = new QGroupBox( name ); vbox->addWidget( group ); group->setCheckable( true ); group->setChecked( param ); @@ -95,7 +95,7 @@ static QGroupBox* vbox_add_group( QVBoxLayout *vbox, const char *name, bool& par } static QCheckBox* new_checkbox( const char *name, bool& param ){ - auto check = new QCheckBox( name ); + auto *check = new QCheckBox( name ); check->setChecked( param ); QObject::connect( check, &QAbstractButton::toggled, [¶m]( bool checked ){ param = checked; @@ -105,34 +105,34 @@ static QCheckBox* new_checkbox( const char *name, bool& param ){ } void DoConfigDialog(){ - auto dialog = new QDialog( g_pRadiantWnd, Qt::Dialog | Qt::WindowCloseButtonHint ); + auto *dialog = new QDialog( g_pRadiantWnd, Qt::Dialog | Qt::WindowCloseButtonHint ); dialog->setWindowTitle( "Portal Viewer Configuration" ); dialog->setAttribute( Qt::WidgetAttribute::WA_DeleteOnClose ); { - auto dialog_vbox = new QVBoxLayout( dialog ); + auto *dialog_vbox = new QVBoxLayout( dialog ); dialog_vbox->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto vbox = new QVBoxLayout( vbox_add_group( dialog_vbox, "3D View", portals.show_3d, false ) ); + auto *vbox = new QVBoxLayout( vbox_add_group( dialog_vbox, "3D View", portals.show_3d, false ) ); { - auto form = new QFormLayout( vbox_add_group( vbox, "Lines", portals.lines, false ) ); + auto *form = new QFormLayout( vbox_add_group( vbox, "Lines", portals.lines, false ) ); form_add_slider( form, portals.width_3d, 1, 10, "Width = ", "", true ); form_add_color( form, portals.color_3d ); } { - auto form = new QFormLayout( vbox_add_group( vbox, "Polygons", portals.polygons, false ) ); + auto *form = new QFormLayout( vbox_add_group( vbox, "Polygons", portals.polygons, false ) ); form_add_slider( form, portals.opacity_3d, 0, 100, "Opacity = ", "%", false ); } { - auto form = new QFormLayout( vbox_add_group( vbox, "Fog", portals.fog, true ) ); + auto *form = new QFormLayout( vbox_add_group( vbox, "Fog", portals.fog, true ) ); form_add_color( form, portals.color_fog ); } { - auto form = new QFormLayout( vbox_add_group( vbox, "Cubic clipper", portals.clip, false ) ); + auto *form = new QFormLayout( vbox_add_group( vbox, "Cubic clipper", portals.clip, false ) ); form_add_slider( form, portals.clip_range, 64, 8192, "Clip range = ", "", false ); } { - auto combo = new ComboBox; + auto *combo = new ComboBox; vbox->addWidget( combo ); combo->addItem( "Z-Buffer Test and Write (recommended for solid or no polygons)" ); combo->addItem( "Z-Buffer Test Only (recommended for transparent polygons)" ); @@ -150,7 +150,7 @@ void DoConfigDialog(){ dialog_vbox->addWidget( new_checkbox( "Draw Regular Portals", portals.draw_nonhints ), 0, Qt::AlignmentFlag::AlignHCenter ); } { - auto form = new QFormLayout( vbox_add_group( dialog_vbox, "2D View Lines", portals.show_2d, false ) ); + auto *form = new QFormLayout( vbox_add_group( dialog_vbox, "2D View Lines", portals.show_2d, false ) ); form_add_slider( form, portals.width_2d, 1, 10, "Width = ", "", true ); form_add_color( form, portals.color_2d ); } diff --git a/contrib/prtview/LoadPortalFileDialog.cpp b/contrib/prtview/LoadPortalFileDialog.cpp index 7165d057..d67673ad 100644 --- a/contrib/prtview/LoadPortalFileDialog.cpp +++ b/contrib/prtview/LoadPortalFileDialog.cpp @@ -48,10 +48,10 @@ bool DoLoadPortalFileDialog(){ QCheckBox *check3d, *check2d; { - auto vbox = new QVBoxLayout( &dialog ); + auto *vbox = new QVBoxLayout( &dialog ); { vbox->addWidget( line = new QLineEdit ); - auto button = line->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition ); + auto *button = line->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition ); QObject::connect( button, &QAction::triggered, [line](){ if ( const char* filename = GlobalRadiant().m_pfnFileDialog( g_pRadiantWnd, true, "Locate portal (.prt) file", line->text().toLatin1().constData(), 0, true, false, false ) ) line->setText( filename ); @@ -62,7 +62,7 @@ bool DoLoadPortalFileDialog(){ vbox->addWidget( check2d = new QCheckBox( "Show 2D" ) ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); vbox->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); diff --git a/contrib/prtview/portals.cpp b/contrib/prtview/portals.cpp index 0ae278bc..57f3bd2b 100644 --- a/contrib/prtview/portals.cpp +++ b/contrib/prtview/portals.cpp @@ -475,7 +475,7 @@ void CPortalsDrawSolid::render( RenderStateFlags state ) const { return a->dist < b->dist; } ); - for ( const auto prt : portals.portal_sort ) + for ( const auto *prt : portals.portal_sort ) { if( ( !prt->hint && portals.draw_nonhints ) || ( prt->hint && portals.draw_hints ) ) diff --git a/contrib/shaderplug/shaderplug.cpp b/contrib/shaderplug/shaderplug.cpp index 9ec55aa5..1826e27e 100644 --- a/contrib/shaderplug/shaderplug.cpp +++ b/contrib/shaderplug/shaderplug.cpp @@ -23,6 +23,7 @@ #include "debugging/debugging.h" +#include #include #include "string/string.h" #include "modulesystem/singletonmodule.h" @@ -141,14 +142,14 @@ void CreateTagFile(){ TagBuilder.CreateXmlDocument(); - for ( auto r_iter = textures.crbegin(); r_iter != textures.crend(); ++r_iter ) + for ( const auto& texture : std::ranges::reverse_view( textures ) ) { - TagBuilder.AddShaderNode( r_iter->c_str(), TextureType::STOCK, NodeShaderType::TEXTURE ); + TagBuilder.AddShaderNode( texture.c_str(), TextureType::STOCK, NodeShaderType::TEXTURE ); } - for ( auto r_iter = shaders.crbegin(); r_iter != shaders.crend(); ++r_iter ) + for ( const auto& shader : std::ranges::reverse_view( shaders ) ) { - TagBuilder.AddShaderNode( r_iter->c_str(), TextureType::STOCK, NodeShaderType::SHADER ); + TagBuilder.AddShaderNode( shader.c_str(), TextureType::STOCK, NodeShaderType::SHADER ); } // Get the tag file @@ -178,7 +179,7 @@ void CreateTagFile(){ EMessageBoxType::Error, 0 ); } } -} // namespace +} // namespace Shaderplug class ShaderPluginModule { diff --git a/contrib/sunplug/sunplug.cpp b/contrib/sunplug/sunplug.cpp index 1813fa71..6a8e149d 100644 --- a/contrib/sunplug/sunplug.cpp +++ b/contrib/sunplug/sunplug.cpp @@ -212,19 +212,19 @@ void MapCoordinator(){ QDialog dialog( SunPlug::main_window, Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "ET-MapCoordinator" ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto spin_minX = new SpinBox( -65536, 65536, min.x() ); - auto spin_minY = new SpinBox( -65536, 65536, min.y() ); - auto spin_maxX = new SpinBox( -65536, 65536, max.x() ); - auto spin_maxY = new SpinBox( -65536, 65536, max.y() ); + auto *spin_minX = new SpinBox( -65536, 65536, min.x() ); + auto *spin_minY = new SpinBox( -65536, 65536, min.y() ); + auto *spin_maxX = new SpinBox( -65536, 65536, max.x() ); + auto *spin_maxY = new SpinBox( -65536, 65536, max.y() ); spin_minX->setPrefix( "X: " ); spin_minY->setPrefix( "Y: " ); spin_maxX->setPrefix( "X: " ); spin_maxY->setPrefix( "Y: " ); { - auto button = new QPushButton( "Get optimal mapcoords" ); + auto *button = new QPushButton( "Get optimal mapcoords" ); form->addWidget( button ); QObject::connect( button, &QPushButton::clicked, [&, calc_min = calc_min, calc_max = calc_max](){ spin_minX->setValue( calc_min.x() ); @@ -234,25 +234,25 @@ void MapCoordinator(){ } ); } { - auto line = new QFrame; + auto *line = new QFrame; line->setFrameShape( QFrame::Shape::HLine ); line->setFrameShadow( QFrame::Shadow::Raised ); form->addRow( line ); } { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; hbox->addWidget( spin_minX ); hbox->addWidget( spin_minY ); form->addRow( new QLabel( "MapCoordsMins" ), hbox ); } { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; hbox->addWidget( spin_maxX ); hbox->addWidget( spin_maxY ); form->addRow( new QLabel( "MapCoordsMaxs" ), hbox ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); diff --git a/libs/dragplanes.h b/libs/dragplanes.h index fc074671..b491a445 100644 --- a/libs/dragplanes.h +++ b/libs/dragplanes.h @@ -26,6 +26,7 @@ #include "selectionlib.h" #include "math/aabb.h" #include "math/line.h" +#include "math/frustum.h" // local must be a pure rotation inline Vector3 translation_to_local( const Vector3& translation, const Matrix4& local ){ diff --git a/libs/eclasslib.h b/libs/eclasslib.h index 7e250176..c7112abf 100644 --- a/libs/eclasslib.h +++ b/libs/eclasslib.h @@ -254,7 +254,7 @@ inline void eclass_release_state( EntityClass* eclass ){ // eclass constructor inline EntityClass* Eclass_Alloc(){ - EntityClass* e = new EntityClass; + auto *e = new EntityClass; e->fixedsize = false; e->unknown = false; diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index 5f54f376..1c8cc50d 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -137,21 +137,21 @@ class PressedKeysHandler : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( PressedKeys_key_press( keyEvent, g_pressedKeys ) ){ // note autorepeat fires this too event->accept(); return true; } } else if( event->type() == QEvent::KeyPress ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( PressedKeys_key_press( keyEvent, g_pressedKeys ) ){ // note autorepeat fires this too event->accept(); return true; } } else if( event->type() == QEvent::KeyRelease ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( !keyEvent->isAutoRepeat() && PressedKeys_key_release( keyEvent, g_pressedKeys ) ){ event->accept(); return true; diff --git a/libs/gtkutil/clipboard.cpp b/libs/gtkutil/clipboard.cpp index 584158df..2c24caa5 100644 --- a/libs/gtkutil/clipboard.cpp +++ b/libs/gtkutil/clipboard.cpp @@ -43,13 +43,13 @@ void clipboard_copy( ClipboardCopyFunc copy ){ *reinterpret_cast( array.data() ) = length; memcpy( array.data() + sizeof( std::size_t ), ostream.data(), length ); - auto mimedata = new QMimeData; + auto *mimedata = new QMimeData; mimedata->setData( c_clipboard_format, array ); QGuiApplication::clipboard()->setMimeData( mimedata ); } void clipboard_paste( ClipboardPasteFunc paste ){ - if( const auto mimedata = QGuiApplication::clipboard()->mimeData() ){ + if( const auto *mimedata = QGuiApplication::clipboard()->mimeData() ){ if( const auto array = mimedata->data( c_clipboard_format ); !array.isEmpty() ){ /* 32 & 64 bit radiants use the same clipboard signature 👀 handle varying sizeof( std::size_t ), also try to be safe diff --git a/libs/gtkutil/combobox.h b/libs/gtkutil/combobox.h index f177a5dd..eb0891ea 100644 --- a/libs/gtkutil/combobox.h +++ b/libs/gtkutil/combobox.h @@ -48,7 +48,7 @@ protected: // it very bad, can interact with the editor while in modal dialog and crash it // filter them all besides ones, taken by the other filter if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() != Qt::Key_Return && keyEvent->key() != Qt::Key_Enter && !keyEvent->matches( QKeySequence::Cancel ) ){ diff --git a/libs/gtkutil/cursor.h b/libs/gtkutil/cursor.h index 4c8d044b..44138e02 100644 --- a/libs/gtkutil/cursor.h +++ b/libs/gtkutil/cursor.h @@ -144,7 +144,7 @@ class FreezePointer : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::MouseMove ) { - QMouseEvent *mouseEvent = static_cast( event ); + auto *mouseEvent = static_cast( event ); const QPoint center = getCenter(); /* QCursor::setPos( center ) effect may happen not immediately; suspend processing till then, otherwise start dash will happen */ if( !m_trackingEstablished ){ diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index 983666dc..dc04fec4 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -33,12 +33,12 @@ RadioHBox RadioHBox_new( StringArrayRange names ){ - auto hbox = new QHBoxLayout; - auto group = new QButtonGroup( hbox ); + auto *hbox = new QHBoxLayout; + auto *group = new QButtonGroup( hbox ); for ( size_t i = 0; i < names.size(); ++i ) { - auto button = new QRadioButton( names[i] ); + auto *button = new QRadioButton( names[i] ); group->addButton( button, i ); // set ids 0+, default ones are negative hbox->addWidget( button ); } @@ -48,8 +48,8 @@ RadioHBox RadioHBox_new( StringArrayRange names ){ PathEntry PathEntry_new(){ - auto entry = new QLineEdit; - auto button = entry->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition ); + auto *entry = new QLineEdit; + auto *button = entry->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition ); return PathEntry( entry, button ); } diff --git a/libs/gtkutil/filechooser.cpp b/libs/gtkutil/filechooser.cpp index 96de5bc5..700f67fe 100644 --- a/libs/gtkutil/filechooser.cpp +++ b/libs/gtkutil/filechooser.cpp @@ -164,7 +164,7 @@ const char* file_dialog( QWidget* parent, bool open, const char* title, const ch const char* extension = path_get_extension( g_file_dialog_file.constData() ); if( !string_empty( extension ) ){ // validate it const auto check = [extension]( const CopiedString& filter ){ return extension_equal( extension, path_get_extension( filter.c_str() ) ); }; - if( !std::any_of( masks.m_filters.cbegin(), masks.m_filters.cend(), check ) ) { + if( !std::ranges::any_of( masks.m_filters, check ) ) { qt_MessageBox( parent, StringStream<64>( makeQuoted( extension ), " is unsupported file type for requested operation\n" ), extension, EMessageBoxType::Error ); g_file_dialog_file.clear(); } diff --git a/libs/gtkutil/guisettings.cpp b/libs/gtkutil/guisettings.cpp index 15529be2..36dfd838 100644 --- a/libs/gtkutil/guisettings.cpp +++ b/libs/gtkutil/guisettings.cpp @@ -121,11 +121,11 @@ public: GuiSettings::~GuiSettings(){ - for( auto setting : m_settings ) + for( const auto *setting : m_settings ) delete setting; } void GuiSettings::save(){ - for( const auto setting : m_settings ) + for( const auto *setting : m_settings ) setting->save(); } void GuiSettings::addWindow( QWidget *window, const char *path, int w /* = 0 */, int h /* = 0 */, int x /* = 0 */, int y /* = 0 */ ){ diff --git a/libs/gtkutil/lineedit.h b/libs/gtkutil/lineedit.h index 64caf0f5..48d269c0 100644 --- a/libs/gtkutil/lineedit.h +++ b/libs/gtkutil/lineedit.h @@ -34,7 +34,7 @@ class LineEdit : public QLineEdit protected: bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent == QKeySequence::StandardKey::Undo || keyEvent == QKeySequence::StandardKey::Redo ) return false; diff --git a/libs/gtkutil/nonmodal.h b/libs/gtkutil/nonmodal.h index 1b4c4c1d..42985855 100644 --- a/libs/gtkutil/nonmodal.h +++ b/libs/gtkutil/nonmodal.h @@ -48,7 +48,7 @@ public: protected: bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Escape ){ m_editing = false; m_cancel(); @@ -92,7 +92,7 @@ public: } bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Escape ){ m_editing = false; m_cancel(); diff --git a/libs/gtkutil/spinbox.h b/libs/gtkutil/spinbox.h index 576d6565..17f21795 100644 --- a/libs/gtkutil/spinbox.h +++ b/libs/gtkutil/spinbox.h @@ -46,7 +46,7 @@ public: protected: bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); // don't pass undo/redo to be eaten by underlying lineedit // it's more useful to have working undo of editor if( keyEvent == QKeySequence::StandardKey::Undo diff --git a/libs/gtkutil/widget.h b/libs/gtkutil/widget.h index cbab67fa..4b9acd5d 100644 --- a/libs/gtkutil/widget.h +++ b/libs/gtkutil/widget.h @@ -97,7 +97,7 @@ protected: if( event->type() == QEvent::Close ) { m_shownDeferred = false; /* HACK */ //. because widget isVisible() at this point - const auto tmp = std::exchange( m_widget, nullptr ); + auto *tmp = std::exchange( m_widget, nullptr ); update(); m_widget = tmp; } diff --git a/libs/moduleobservers.h b/libs/moduleobservers.h index 43aa5b2f..2be03bdb 100644 --- a/libs/moduleobservers.h +++ b/libs/moduleobservers.h @@ -23,6 +23,7 @@ #include "debugging/debugging.h" #include +#include #include "moduleobserver.h" class ModuleObservers @@ -42,15 +43,15 @@ public: ASSERT_MESSAGE( erased, "ModuleObservers::detach: cannot detach observer" ); } void realise(){ - for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i ) + for ( auto *o : m_observers ) { - ( *i )->realise(); + o->realise(); } } void unrealise(){ - for ( Observers::reverse_iterator i = m_observers.rbegin(); i != m_observers.rend(); ++i ) + for ( auto *o : std::ranges::reverse_view( m_observers ) ) { - ( *i )->unrealise(); + o->unrealise(); } } }; diff --git a/plugins/assmodel/mdlimage.cpp b/plugins/assmodel/mdlimage.cpp index d0e11154..d5d3e369 100644 --- a/plugins/assmodel/mdlimage.cpp +++ b/plugins/assmodel/mdlimage.cpp @@ -32,7 +32,7 @@ Image* LoadMDLImage( Assimp::Importer& importer, ArchiveFile& file ){ if( scene != nullptr && scene->HasTextures() ){ const aiTexture *tex = scene->mTextures[0]; if( tex->mWidth != 0 ){ // not compressed - RGBAImage* image = new RGBAImage( tex->mWidth, tex->mHeight ); + auto *image = new RGBAImage( tex->mWidth, tex->mHeight ); unsigned char* pRGBA = image->getRGBAPixels(); const aiTexel *texel = tex->pcData; for( size_t i = 0; i < tex->mWidth * tex->mHeight; ++i, ++texel ){ diff --git a/plugins/assmodel/model.cpp b/plugins/assmodel/model.cpp index 99f2f29a..3d2429eb 100644 --- a/plugins/assmodel/model.cpp +++ b/plugins/assmodel/model.cpp @@ -429,7 +429,7 @@ private: for( size_t n = 0; n < node->mNumMeshes; ++n ){ const aiMesh *mesh = scene.m_scene->mMeshes[node->mMeshes[n]]; if( mesh->mPrimitiveTypes & aiPrimitiveType_TRIANGLE ){ - PicoSurface* picosurface = new PicoSurface( scene, mesh ); + auto *picosurface = new PicoSurface( scene, mesh ); aabb_extend_by_aabb_safe( m_aabb_local, picosurface->localAABB() ); m_surfaces.push_back( picosurface ); } @@ -441,7 +441,7 @@ private: } } void constructNull(){ - PicoSurface* picosurface = new PicoSurface(); + auto *picosurface = new PicoSurface(); m_aabb_local = picosurface->localAABB(); m_surfaces.push_back( picosurface ); } diff --git a/plugins/entity/skincache.cpp b/plugins/entity/skincache.cpp index ab8b377a..294e1890 100644 --- a/plugins/entity/skincache.cpp +++ b/plugins/entity/skincache.cpp @@ -225,7 +225,7 @@ class Doom3ModelSkinCache final : public ModelSkinCache, public ModuleObserver : m_cache( cache ){ } Doom3ModelSkinCacheElement* construct( const CopiedString& name ){ - Doom3ModelSkinCacheElement* skin = new Doom3ModelSkinCacheElement; + auto *skin = new Doom3ModelSkinCacheElement; if ( m_cache.realised() ) { skin->realise( name.c_str() ); } diff --git a/plugins/image/bmp.cpp b/plugins/image/bmp.cpp index 1fe00a92..e626fc77 100644 --- a/plugins/image/bmp.cpp +++ b/plugins/image/bmp.cpp @@ -164,7 +164,7 @@ Image* LoadBMPBuff( PointerInputStream& inputStream, std::size_t length ){ rows = -rows; } - RGBAImage* image = new RGBAImage( columns, rows ); + auto *image = new RGBAImage( columns, rows ); switch ( bmpHeader.bitsPerPixel ) { diff --git a/plugins/image/dds.cpp b/plugins/image/dds.cpp index 2a6f0666..b38ccbdf 100644 --- a/plugins/image/dds.cpp +++ b/plugins/image/dds.cpp @@ -37,7 +37,7 @@ Image* LoadDDSBuff( const byte* buffer ){ return 0; } - RGBAImage* image = new RGBAImage( width, height ); + auto *image = new RGBAImage( width, height ); if ( DDSDecompress( reinterpret_cast( const_cast( buffer ) ), image->getRGBAPixels() ) == -1 ) { image->release(); diff --git a/plugins/image/jpeg.cpp b/plugins/image/jpeg.cpp index a55c2e1b..4bdc07ae 100644 --- a/plugins/image/jpeg.cpp +++ b/plugins/image/jpeg.cpp @@ -368,7 +368,7 @@ static Image* LoadJPGBuff_( const void *src_buffer, int src_size ){ int row_stride = cinfo.output_width * cinfo.output_components; - RGBAImage* image = new RGBAImage( cinfo.output_width, cinfo.output_height ); + auto *image = new RGBAImage( cinfo.output_width, cinfo.output_height ); JSAMPARRAY buffer = ( *cinfo.mem->alloc_sarray )( ( j_common_ptr ) & cinfo, JPOOL_IMAGE, row_stride, 1 ); diff --git a/plugins/image/ktx.cpp b/plugins/image/ktx.cpp index 378ceda1..e12fc36a 100644 --- a/plugins/image/ktx.cpp +++ b/plugins/image/ktx.cpp @@ -321,7 +321,7 @@ Image* LoadKTXBuff( PointerInputStream& istream ){ } istream.seek( bytesOfKeyValueData + sizeof( uint32_t ) ); - RGBAImage* image = new RGBAImage( width, height ); + auto *image = new RGBAImage( width, height ); if ( type ) { KTX_Decoder* decoder = NULL; diff --git a/plugins/image/pcx.cpp b/plugins/image/pcx.cpp index 2f77e075..15d72390 100644 --- a/plugins/image/pcx.cpp +++ b/plugins/image/pcx.cpp @@ -192,7 +192,7 @@ Image* LoadPCX32Buff( byte* buffer, std::size_t length ){ return 0; } - RGBAImage* image = new RGBAImage( width, height ); + auto *image = new RGBAImage( width, height ); c = ( width ) * ( height ); pic32 = image->getRGBAPixels(); for ( i = 0; i < c; i++ ) diff --git a/plugins/image/tga.cpp b/plugins/image/tga.cpp index 3cdd308e..8fded71d 100644 --- a/plugins/image/tga.cpp +++ b/plugins/image/tga.cpp @@ -282,7 +282,7 @@ inline void targa_header_read_istream( TargaHeader& targa_header, PointerInputSt template Image* Targa_decodeImageData( const TargaHeader& targa_header, PointerInputStream& istream, const Flip& flip ){ - RGBAImage* image = new RGBAImage( targa_header.width, targa_header.height ); + auto *image = new RGBAImage( targa_header.width, targa_header.height ); if ( targa_header.image_type == 2 || targa_header.image_type == 3 ) { switch ( targa_header.pixel_size ) diff --git a/plugins/imagehl/hlw.cpp b/plugins/imagehl/hlw.cpp index baf25128..da88a1a8 100644 --- a/plugins/imagehl/hlw.cpp +++ b/plugins/imagehl/hlw.cpp @@ -109,7 +109,7 @@ Image* LoadHLWBuff( byte* buffer ){ columns = lpMip->width; rows = lpMip->height; - RGBAImage* image = new RGBAImage( columns, rows ); + auto *image = new RGBAImage( columns, rows ); for ( row = 0; row < rows; row++ ) { diff --git a/plugins/imagehl/mip.cpp b/plugins/imagehl/mip.cpp index 8e328e94..31f9f72d 100644 --- a/plugins/imagehl/mip.cpp +++ b/plugins/imagehl/mip.cpp @@ -173,7 +173,7 @@ Image* LoadMIPBuff( byte* buffer ){ numPixels = columns * rows; - RGBAImage* image = new RGBAImage( columns, rows ); + auto *image = new RGBAImage( columns, rows ); //Sys_Printf( "lpMip->width = %i, lpMip->height = %i, lpMip->offsets[0] = %i, lpMip->offsets[1] = %i, lpMip->offsets[2] = %i, lpMip->offsets[3] = %i, numPixels = %i\n", lpMip->width, lpMip->height, lpMip->offsets[0], lpMip->offsets[1], lpMip->offsets[2], lpMip->offsets[3], numPixels ); //for ( i = 0; i < sizeof( *lpMip ); i++ ) diff --git a/plugins/imagehl/sprite.cpp b/plugins/imagehl/sprite.cpp index 23b1c05a..4ee8b7c5 100644 --- a/plugins/imagehl/sprite.cpp +++ b/plugins/imagehl/sprite.cpp @@ -159,7 +159,7 @@ Image* LoadIDSPBuff( byte *buffer ){ // palette = buffer+mipdatasize+2; // buf_p = buffer+lpMip->offsets[0]; - RGBAImage* image = new RGBAImage( columns, rows ); + auto *image = new RGBAImage( columns, rows ); #ifdef DEBUG frametype = spriteframetype_t( pframetype->type ); diff --git a/plugins/imagepng/plugin.cpp b/plugins/imagepng/plugin.cpp index a395094f..4b335074 100644 --- a/plugins/imagepng/plugin.cpp +++ b/plugins/imagepng/plugin.cpp @@ -144,7 +144,7 @@ Image* LoadPNGBuff( unsigned char* fbuffer ){ int height = png_get_image_height( png_ptr, info_ptr ); // allocate the pixel buffer, and the row pointers - RGBAImage* image = new RGBAImage( width, height ); + auto *image = new RGBAImage( width, height ); row_pointers = (png_byte**) malloc( ( height ) * sizeof( png_byte* ) ); diff --git a/plugins/imageq2/wal.cpp b/plugins/imageq2/wal.cpp index ce63341d..93ecca21 100644 --- a/plugins/imageq2/wal.cpp +++ b/plugins/imageq2/wal.cpp @@ -128,7 +128,7 @@ Image* LoadMipTex( byte* buffer, byte TypeofTex ){ source = buffer + offset; } - RGBAImageFlags* image = new RGBAImageFlags( w, h, flags, contents, value ); + auto *image = new RGBAImageFlags( w, h, flags, contents, value ); byte* dest = image->getRGBAPixels(); byte* end = source + ( w * h ); diff --git a/plugins/imageq2/wal32.cpp b/plugins/imageq2/wal32.cpp index 4195b759..a9a25193 100644 --- a/plugins/imageq2/wal32.cpp +++ b/plugins/imageq2/wal32.cpp @@ -75,7 +75,7 @@ Image* LoadM32Buff( byte* buffer ){ int contents = istream_read_uint32_le( inputStream ); int value = istream_read_uint32_le( inputStream ); - RGBAImageFlags* image = new RGBAImageFlags( w, h, flags, contents, value ); + auto *image = new RGBAImageFlags( w, h, flags, contents, value ); const byte* source = buffer + offset; std::copy( source, source + ( w * h * 4 ), image->getRGBAPixels() ); diff --git a/plugins/md3model/md2.cpp b/plugins/md3model/md2.cpp index d78cac5d..465a3d3e 100644 --- a/plugins/md3model/md2.cpp +++ b/plugins/md3model/md2.cpp @@ -269,13 +269,13 @@ void MD2Model_read( Model& model, const byte* buffer, ArchiveFile& file ){ } scene::Node& MD2Model_new( const byte* buffer, ArchiveFile& file ){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); MD2Model_read( modelNode->model(), buffer, file ); return modelNode->node(); } scene::Node& MD2Model_default(){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); Model_constructNull( modelNode->model() ); return modelNode->node(); } diff --git a/plugins/md3model/md3.cpp b/plugins/md3model/md3.cpp index 3249dc4b..7c3bab1e 100644 --- a/plugins/md3model/md3.cpp +++ b/plugins/md3model/md3.cpp @@ -295,13 +295,13 @@ void MD3Model_read( Model& model, unsigned char* buffer ){ } scene::Node& MD3Model_new( unsigned char* buffer ){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); MD3Model_read( modelNode->model(), buffer ); return modelNode->node(); } scene::Node& MD3Model_default(){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); Model_constructNull( modelNode->model() ); return modelNode->node(); } diff --git a/plugins/md3model/md5.cpp b/plugins/md3model/md5.cpp index 7c18e84d..87a323be 100644 --- a/plugins/md3model/md5.cpp +++ b/plugins/md3model/md5.cpp @@ -429,7 +429,7 @@ void MD5Model_construct( Model& model, TextInputStream& inputStream ){ } scene::Node& MD5Model_new( TextInputStream& inputStream ){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); MD5Model_construct( modelNode->model(), inputStream ); return modelNode->node(); } diff --git a/plugins/md3model/mdc.cpp b/plugins/md3model/mdc.cpp index 8434d5c9..f10b4872 100644 --- a/plugins/md3model/mdc.cpp +++ b/plugins/md3model/mdc.cpp @@ -250,13 +250,13 @@ void MDCModel_read( Model& model, const byte* buffer ){ } scene::Node& MDCModel_new( const byte* buffer ){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); MDCModel_read( modelNode->model(), buffer ); return modelNode->node(); } scene::Node& MDCModel_default(){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); Model_constructNull( modelNode->model() ); return modelNode->node(); } diff --git a/plugins/md3model/mdl.cpp b/plugins/md3model/mdl.cpp index 9586155d..ca09dd5f 100644 --- a/plugins/md3model/mdl.cpp +++ b/plugins/md3model/mdl.cpp @@ -206,13 +206,13 @@ void MDLModel_read( Model& model, const byte* buffer, const char* name ){ } scene::Node& MDLModel_new( const byte* buffer, const char* name ){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); MDLModel_read( modelNode->model(), buffer, name ); return modelNode->node(); } scene::Node& MDLModel_default(){ - ModelNode* modelNode = new ModelNode(); + auto *modelNode = new ModelNode(); Model_constructNull( modelNode->model() ); return modelNode->node(); } diff --git a/plugins/md3model/mdlimage.cpp b/plugins/md3model/mdlimage.cpp index 5e8b6a5c..55998e7f 100644 --- a/plugins/md3model/mdlimage.cpp +++ b/plugins/md3model/mdlimage.cpp @@ -128,7 +128,7 @@ Image* LoadMDLImageBuff( byte* buffer ){ break; } - RGBAImage* image = new RGBAImage( skinwidth, skinheight ); + auto *image = new RGBAImage( skinwidth, skinheight ); unsigned char* pRGBA = image->getRGBAPixels(); for ( int i = 0; i < ( skinheight ); i++ ) diff --git a/plugins/model/model.cpp b/plugins/model/model.cpp index dfa210b5..fee7e346 100644 --- a/plugins/model/model.cpp +++ b/plugins/model/model.cpp @@ -386,13 +386,13 @@ private: /* fix the surface's normals */ PicoFixSurfaceNormals( surface ); - PicoSurface* picosurface = new PicoSurface( surface ); + auto *picosurface = new PicoSurface( surface ); aabb_extend_by_aabb_safe( m_aabb_local, picosurface->localAABB() ); m_surfaces.push_back( picosurface ); } } void constructNull(){ - PicoSurface* picosurface = new PicoSurface(); + auto *picosurface = new PicoSurface(); m_aabb_local = picosurface->localAABB(); m_surfaces.push_back( picosurface ); } @@ -926,7 +926,7 @@ size_t picoInputStreamReam( void* inputStream, unsigned char* buffer, size_t len scene::Node& loadPicoModel( const picoModule_t* module, ArchiveFile& file ){ picoModel_t* model = PicoModuleLoadModelStream( module, &file.getInputStream(), picoInputStreamReam, file.size(), 0, file.getName() ); - PicoModelNode* modelNode = new PicoModelNode( model ); + auto *modelNode = new PicoModelNode( model ); PicoFreeModel( model ); return modelNode->node(); } diff --git a/plugins/spritemodel/spritemodel.cpp b/plugins/spritemodel/spritemodel.cpp index f1fc4119..5ac78199 100644 --- a/plugins/spritemodel/spritemodel.cpp +++ b/plugins/spritemodel/spritemodel.cpp @@ -38,7 +38,7 @@ void LoadSpriteModel( entity_interfaces_t *interfaces, const char *name ){ return; // NULL; } - CSpriteModel *model = new CSpriteModel(); + auto *model = new CSpriteModel(); model->Construct( pShader ); interfaces->pRender = (IRender*)model; interfaces->pRender->IncRef(); diff --git a/plugins/vfspk3/archive.cpp b/plugins/vfspk3/archive.cpp index 0dfab637..68dd0eb0 100644 --- a/plugins/vfspk3/archive.cpp +++ b/plugins/vfspk3/archive.cpp @@ -53,7 +53,7 @@ public: virtual ArchiveFile* openFile( const char* name ) override { UnixPath path( m_root.c_str() ); path.push_filename( name ); - DirectoryArchiveFile* file = new DirectoryArchiveFile( name, path.c_str() ); + auto *file = new DirectoryArchiveFile( name, path.c_str() ); if ( !file->failed() ) { return file; } @@ -63,7 +63,7 @@ public: virtual ArchiveTextFile* openTextFile( const char* name ) override { UnixPath path( m_root.c_str() ); path.push_filename( name ); - DirectoryArchiveTextFile* file = new DirectoryArchiveTextFile( name, path.c_str() ); + auto *file = new DirectoryArchiveTextFile( name, path.c_str() ); if ( !file->failed() ) { return file; } diff --git a/radiant/build.cpp b/radiant/build.cpp index b427a7e0..34855416 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -239,7 +239,7 @@ public: XMLElementParser& pushElement( const XMLElement& element ) override { if ( string_equal( element.name(), "cond" ) ) { flush(); - auto* conditional = new Conditional( VariableString( element.attribute( "value" ) ) ); + auto *conditional = new Conditional( VariableString( element.attribute( "value" ) ) ); m_tool.push_back( conditional ); m_conditional = new ConditionalXMLConstructor( *conditional ); return *m_conditional; @@ -1023,7 +1023,7 @@ public: EMessageBoxReturn BuildMenuDialog_construct( ProjectList& projectList ){ static auto [dialog, rootLayout] = [](){ - QDialog *dialog = new QDialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); + auto *dialog = new QDialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog->setWindowTitle( "Build Menu" ); g_guiSettings.addWindow( dialog, "BuildMenu/geometry", 700, 500 ); auto *rootLayout = new QHBoxLayout( dialog ); diff --git a/radiant/commands.cpp b/radiant/commands.cpp index 00904def..5fe33f75 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -317,7 +317,7 @@ protected: }; void accelerator_edit( QTreeWidgetItem *item ){ - auto edit = new Single_QKeySequenceEdit; + auto *edit = new Single_QKeySequenceEdit; QObject::connect( edit, &QKeySequenceEdit::editingFinished, [item, edit](){ const QKeySequence accelerator = edit->keySequence(); item->treeWidget()->setItemWidget( item, 1, nullptr ); @@ -332,9 +332,9 @@ void DoCommandListDlg(){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Mapped Commands" ); - auto grid = new QGridLayout( &dialog ); + auto *grid = new QGridLayout( &dialog ); - auto tree = new QTreeWidget; + auto *tree = new QTreeWidget; grid->addWidget( tree, 1, 0, 1, 2 ); tree->setColumnCount( 2 ); tree->setSortingEnabled( true ); @@ -361,7 +361,7 @@ void DoCommandListDlg(){ for( const auto&[ name, value ] : g_shortcuts ) { - auto item = new QTreeWidgetItem( tree, { name.c_str(), value.accelerator.toString() } ); + auto *item = new QTreeWidgetItem( tree, { name.c_str(), value.accelerator.toString() } ); accelerator_item_set_icon( item, value ); if ( !commandList.failed() ) { @@ -375,12 +375,12 @@ void DoCommandListDlg(){ } { - auto commandLine = new QLineEdit; + auto *commandLine = new QLineEdit; grid->addWidget( commandLine, 0, 0 ); commandLine->setClearButtonEnabled( true ); commandLine->setPlaceholderText( QString::fromUtf8( "🔍 by command name" ) ); - auto keyLine = new QLineEdit; + auto *keyLine = new QLineEdit; grid->addWidget( keyLine, 0, 1 ); keyLine->setClearButtonEnabled( true ); keyLine->setPlaceholderText( QString::fromUtf8( "🔍 by keys" ) ); @@ -396,7 +396,7 @@ void DoCommandListDlg(){ } { - auto buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); + auto *buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); grid->addWidget( buttons, 1, 2, 1, 1 ); QPushButton *editbutton = buttons->addButton( "Edit", QDialogButtonBox::ButtonRole::ActionRole ); diff --git a/radiant/csg.cpp b/radiant/csg.cpp index e3f829d2..8e6301f1 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -332,13 +332,13 @@ public: if( !m_settings.m_removeInner && m_settings.m_caulk ) { Brush_forEachFace( *brush, CaulkFace( m_settings ) ); } - Brush* tmpbrush = new Brush( *brush ); + auto *tmpbrush = new Brush( *brush ); tmpbrush->removeEmptyFaces(); Brush_forEachFace( *tmpbrush, FaceMakeBrush( *tmpbrush, out, m_settings ) ); delete tmpbrush; } else if( m_settings.m_hollowType == eDiag ) { - Brush* tmpbrush = new Brush( *brush ); + auto *tmpbrush = new Brush( *brush ); Brush_forEachFace( *tmpbrush, FaceOffset( m_settings ) ); tmpbrush->evaluateBRep(); brush_extrudeDiag( *brush, *tmpbrush, out, m_settings ); @@ -657,7 +657,7 @@ public: [thebrush]( const Brush *b ){ return aabb_intersects_aabb( thebrush->localAABB(), b->localAABB() ); } ) ) { brush_vector_t buffer[2]; bool swap = false; - Brush* original = new Brush( *thebrush ); + auto *original = new Brush( *thebrush ); buffer[swap].push_back( original ); for ( size_t i = 0; i < m_brushlist.size(); ++i ) @@ -1491,39 +1491,39 @@ void CSG_Tool(){ g_guiSettings.addWindow( g_csgtool_dialog.window, "CSGTool/geometry" ); { - auto grid = new QGridLayout( g_csgtool_dialog.window ); // 3 x 8 + auto *grid = new QGridLayout( g_csgtool_dialog.window ); // 3 x 8 grid->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto spin = g_csgtool_dialog.spin = new DoubleSpinBox( 0, 9999, 16, 3, 16 ); + auto *spin = g_csgtool_dialog.spin = new DoubleSpinBox( 0, 9999, 16, 3, 16 ); spin->setToolTip( "Thickness" ); grid->addWidget( spin, 0, 1 ); } { - auto label = new CSG_SpinBoxLabel( "Grid->", g_csgtool_dialog.spin ); + auto *label = new CSG_SpinBoxLabel( "Grid->", g_csgtool_dialog.spin ); grid->addWidget( label, 0, 0 ); } { //radio button group for choosing the exclude axis - auto radFaces = g_csgtool_dialog.radFaces = new QRadioButton( "-faces" ); + auto *radFaces = g_csgtool_dialog.radFaces = new QRadioButton( "-faces" ); radFaces->setToolTip( "Exclude selected faces" ); grid->addWidget( radFaces, 0, 2 ); - auto radPlusFaces = g_csgtool_dialog.radPlusFaces = new QRadioButton( "+faces" ); + auto *radPlusFaces = g_csgtool_dialog.radPlusFaces = new QRadioButton( "+faces" ); radPlusFaces->setToolTip( "Only process selected faces" ); grid->addWidget( radPlusFaces, 0, 3 ); - auto radProj = g_csgtool_dialog.radProj = new QRadioButton( "-proj" ); + auto *radProj = g_csgtool_dialog.radProj = new QRadioButton( "-proj" ); radProj->setToolTip( "Exclude faces, most orthogonal to active projection" ); grid->addWidget( radProj, 0, 4 ); - auto radCam = g_csgtool_dialog.radCam = new QRadioButton( "-cam" ); + auto *radCam = g_csgtool_dialog.radCam = new QRadioButton( "-cam" ); radCam->setToolTip( "Exclude faces, most orthogonal to camera view" ); grid->addWidget( radCam, 0, 5 ); radFaces->setChecked( true ); } { - auto button = g_csgtool_dialog.caulk = new QToolButton; + auto *button = g_csgtool_dialog.caulk = new QToolButton; auto pix = new_local_image( "f-caulk.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1533,7 +1533,7 @@ void CSG_Tool(){ grid->addWidget( button, 0, 6 ); } { - auto button = g_csgtool_dialog.removeInner = new QToolButton; + auto *button = g_csgtool_dialog.removeInner = new QToolButton; auto pix = new_local_image( "csgtool_removeinner.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1543,13 +1543,13 @@ void CSG_Tool(){ grid->addWidget( button, 0, 7 ); } { - auto line = new QFrame; + auto *line = new QFrame; line->setFrameShape( QFrame::Shape::HLine ); line->setFrameShadow( QFrame::Shadow::Raised ); grid->addWidget( line, 1, 0, 1, 8 ); } { - auto button = new QToolButton; + auto *button = new QToolButton; auto pix = new_local_image( "csgtool_shrink.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1558,7 +1558,7 @@ void CSG_Tool(){ QObject::connect( button, &QAbstractButton::clicked, CSGdlg_BrushShrink ); } { - auto button = new QToolButton; + auto *button = new QToolButton; auto pix = new_local_image( "csgtool_expand.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1567,7 +1567,7 @@ void CSG_Tool(){ QObject::connect( button, &QAbstractButton::clicked, CSGdlg_BrushExpand ); } { - auto button = new QToolButton; + auto *button = new QToolButton; auto pix = new_local_image( "csgtool_diagonal.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1576,7 +1576,7 @@ void CSG_Tool(){ QObject::connect( button, &QAbstractButton::clicked, [](){ CSG_Hollow( eDiag, "brushHollow::Diag", g_csgtool_dialog ); } ); } { - auto button = new QToolButton; + auto *button = new QToolButton; auto pix = new_local_image( "csgtool_wrap.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1585,7 +1585,7 @@ void CSG_Tool(){ QObject::connect( button, &QAbstractButton::clicked, [](){ CSG_Hollow( eWrap, "brushHollow::Wrap", g_csgtool_dialog ); } ); } { - auto button = new QToolButton; + auto *button = new QToolButton; auto pix = new_local_image( "csgtool_extrude.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); @@ -1594,7 +1594,7 @@ void CSG_Tool(){ QObject::connect( button, &QAbstractButton::clicked, [](){ CSG_Hollow( eExtrude, "brushHollow::Extrude", g_csgtool_dialog ); } ); } { - auto button = new QToolButton; + auto *button = new QToolButton; auto pix = new_local_image( "csgtool_pull.png" ); button->setIcon( pix ); button->setIconSize( pix.size() + QSize( 8, 8 ) ); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 6500d603..aa110283 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -63,7 +63,7 @@ struct DialogSliderRow m_slider->setSingleStep( step_increment ); m_slider->setPageStep( page_increment ); - auto label = new QLabel; + auto *label = new QLabel; label->setMinimumWidth( label->fontMetrics().horizontalAdvance( QString::number( upper ) ) ); QObject::connect( m_slider, &QSlider::valueChanged, [label]( int value ){ @@ -81,7 +81,7 @@ struct DialogSliderRow m_slider->setSingleStep( step_increment * 10 ); m_slider->setPageStep( page_increment * 10 ); - auto label = new QLabel; + auto *label = new QLabel; label->setMinimumWidth( label->fontMetrics().horizontalAdvance( QString::number( upper, 'f', 1 ) ) ); QObject::connect( m_slider, &QSlider::valueChanged, [label]( int value ){ @@ -398,7 +398,7 @@ QDialog::DialogCode Dialog::DoModal(){ QCheckBox* Dialog::addCheckBox( QGridLayout* grid, const char* name, const char* flag, const BoolImportCallback& importViewer, const BoolExportCallback& exportViewer ){ - auto check = new QCheckBox( flag ); + auto *check = new QCheckBox( flag ); AddBoolToggleData( *check, importViewer, exportViewer ); DialogGrid_packRow( grid, check, name ); return check; @@ -409,7 +409,7 @@ QCheckBox* Dialog::addCheckBox( QGridLayout* grid, const char* name, const char* } QComboBox* Dialog::addCombo( QGridLayout* grid, const char* name, StringArrayRange values, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){ - auto combo = new ComboBox; + auto *combo = new ComboBox; for ( const char *value : values ) combo->addItem( value ); @@ -453,16 +453,16 @@ void Dialog::addRadio( QGridLayout* grid, const char* name, int& data, StringArr } void Dialog::addRadioIcons( QGridLayout* grid, const char* name, StringArrayRange icons, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){ - auto subgrid = new QGridLayout; - auto buttons = new QButtonGroup( subgrid ); + auto *subgrid = new QGridLayout; + auto *buttons = new QButtonGroup( subgrid ); for ( size_t i = 0; i < icons.size(); ++i ) { - auto label = new QLabel; + auto *label = new QLabel; label->setPixmap( new_local_image( icons[i] ) ); subgrid->addWidget( label, 0, i, Qt::AlignmentFlag::AlignHCenter ); - auto button = new QRadioButton; + auto *button = new QRadioButton; buttons->addButton( button, i ); // set ids 0+, default ones are negative subgrid->addWidget( button, 1, i, Qt::AlignmentFlag::AlignHCenter ); } @@ -477,7 +477,7 @@ void Dialog::addRadioIcons( QGridLayout* grid, const char* name, int& data, Stri } QWidget* Dialog::addTextEntry( QGridLayout* grid, const char* name, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){ - auto entry = new QLineEdit; + auto *entry = new QLineEdit; AddTextEntryData( *entry, importViewer, exportViewer ); DialogGrid_packRow( grid, entry, name ); @@ -502,7 +502,7 @@ void Dialog::addPathEntry( QGridLayout* grid, const char* name, CopiedString& da } QWidget* Dialog::addSpinner( QGridLayout* grid, const char* name, int lower, int upper, const IntImportCallback& importViewer, const IntExportCallback& exportViewer ){ - auto spin = new SpinBox( lower, upper ); + auto *spin = new SpinBox( lower, upper ); spin->setStepType( QAbstractSpinBox::StepType::AdaptiveDecimalStepType ); AddIntSpinnerData( *spin, importViewer, exportViewer ); DialogGrid_packRow( grid, spin, new SpinBoxLabel( name, spin ) ); @@ -514,7 +514,7 @@ QWidget* Dialog::addSpinner( QGridLayout* grid, const char* name, int& data, int } QWidget* Dialog::addSpinner( QGridLayout* grid, const char* name, double lower, double upper, const FloatImportCallback& importViewer, const FloatExportCallback& exportViewer, int decimals ){ - auto spin = new DoubleSpinBox( lower, upper, 0, decimals ); + auto *spin = new DoubleSpinBox( lower, upper, 0, decimals ); spin->setStepType( QAbstractSpinBox::StepType::AdaptiveDecimalStepType ); AddFloatSpinnerData( *spin, importViewer, exportViewer ); DialogGrid_packRow( grid, spin, new SpinBoxLabel( name, spin ) ); diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index e9f1b4bc..60ad0fab 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -244,7 +244,7 @@ public: m_key( key ), m_entry( new NonModalEntry( ApplyCaller( *this ), UpdateCaller( *this ) ) ){ m_entry->setValidator( new KeyValueValidator( m_entry ) ); - auto button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_ArrowRight ), QLineEdit::ActionPosition::TrailingPosition ); + auto *button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_ArrowRight ), QLineEdit::ActionPosition::TrailingPosition ); QObject::connect( button, &QAction::triggered, [this](){ browse(); } ); } void release() override { @@ -283,7 +283,7 @@ public: m_key( key ), m_entry( new NonModalEntry( ApplyCaller( *this ), UpdateCaller( *this ) ) ){ m_entry->setValidator( new KeyValueValidator( m_entry ) ); - auto button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition ); + auto *button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_DialogOpenButton ), QLineEdit::ActionPosition::TrailingPosition ); QObject::connect( button, &QAction::triggered, [this](){ browse(); } ); } void release() override { @@ -347,7 +347,7 @@ public: m_key( key ), m_entry( new NonModalEntry( ApplyCaller( *this ), UpdateCaller( *this ) ) ){ m_entry->setValidator( new KeyValueValidator( m_entry ) ); - auto button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_MediaVolume ), QLineEdit::ActionPosition::TrailingPosition ); + auto *button = m_entry->addAction( QApplication::style()->standardIcon( QStyle::SP_MediaVolume ), QLineEdit::ActionPosition::TrailingPosition ); QObject::connect( button, &QAction::triggered, [this](){ browse(); } ); } void release() override { @@ -396,8 +396,8 @@ public: }; inline QWidget *new_container_widget(){ - QWidget *w = new QWidget; - auto l = new QHBoxLayout( w ); + auto *w = new QWidget; + auto *l = new QHBoxLayout( w ); l->setContentsMargins( 0, 0, 0, 0 ); return w; } @@ -823,7 +823,7 @@ public: EntityClassListStoreAppend( QTreeWidget* tree_ ) : tree( tree_ ){ } void visit( EntityClass* e ) override { - auto item = new QTreeWidgetItem( tree ); + auto *item = new QTreeWidgetItem( tree ); item->setData( 0, Qt::ItemDataRole::DisplayRole, e->name() ); item->setData( 0, Qt::ItemDataRole::UserRole, QVariant::fromValue( e ) ); } @@ -919,7 +919,7 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){ void EntityInspector_appendAttribute( const EntityClassAttributePair& attributePair, EntityAttribute& attribute ){ const char* keyname = attributePair.first.c_str(); //EntityClassAttributePair_getName( attributePair ); - auto label = new QLabel( keyname ); + auto *label = new QLabel( keyname ); EntityAttribute_setTooltip( label, attributePair.second.m_name.c_str(), attributePair.second.m_description.c_str() ); DialogGrid_packRow( g_attributeBox, attribute.getWidget(), label ); } @@ -1103,7 +1103,7 @@ void EntityInspector_applyKeyValue(){ void EntityInspector_clearKeyValue(){ // Get current selection text - if( const auto item = g_entprops_store->currentItem() ){ + if( const auto *item = g_entprops_store->currentItem() ){ const auto key = item->text( 0 ).toLatin1(); if ( !string_equal( key.constData(), "classname" ) ) { @@ -1119,7 +1119,7 @@ class : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Delete ){ EntityInspector_clearKeyValue(); event->accept(); @@ -1164,7 +1164,7 @@ class : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Tab @@ -1194,14 +1194,14 @@ void EntityInspector_destroyWindow(){ } QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ - auto splitter = new QSplitter( Qt::Vertical ); + auto *splitter = new QSplitter( Qt::Vertical ); QObject::connect( splitter, &QObject::destroyed, EntityInspector_destroyWindow ); splitter->installEventFilter( &g_pressedKeysFilter ); { // class list - auto tree = g_entityClassList = new QTreeWidget; + auto *tree = g_entityClassList = new QTreeWidget; tree->setColumnCount( 1 ); tree->setSortingEnabled( true ); tree->sortByColumn( 0, Qt::SortOrder::AscendingOrder ); @@ -1223,25 +1223,25 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ splitter->addWidget( tree ); } { - auto text = g_entityClassComment = new QPlainTextEdit; + auto *text = g_entityClassComment = new QPlainTextEdit; text->setReadOnly( true ); text->setUndoRedoEnabled( false ); splitter->addWidget( text ); } { - QWidget *containerWidget = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget + auto *containerWidget = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget splitter->addWidget( containerWidget ); - auto vbox = new QVBoxLayout( containerWidget ); + auto *vbox = new QVBoxLayout( containerWidget ); vbox->setContentsMargins( 0, 0, 0, 0 ); { // Spawnflags (4 colums wide max, or window gets too wide.) - auto grid = g_spawnflagsTable = new QGridLayout; + auto *grid = g_spawnflagsTable = new QGridLayout; grid->setAlignment( Qt::AlignmentFlag::AlignLeft ); vbox->addLayout( grid ); for ( int i = 0; i < MAX_FLAGS; i++ ) { - auto check = g_entitySpawnflagsCheck[i] = new QCheckBox; + auto *check = g_entitySpawnflagsCheck[i] = new QCheckBox; grid->addWidget( check, i / 4, i % 4 ); check->hide(); QObject::connect( check, &QAbstractButton::clicked, EntityInspector_applySpawnflags ); @@ -1249,7 +1249,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ } { // key/value list - auto tree = g_entprops_store = new QTreeWidget; + auto *tree = g_entprops_store = new QTreeWidget; tree->setColumnCount( 2 ); tree->setUniformRowHeights( true ); // optimization tree->setHorizontalScrollBarPolicy( Qt::ScrollBarPolicy::ScrollBarAlwaysOff ); @@ -1266,7 +1266,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ { // key/value entry - auto grid = new QGridLayout; + auto *grid = new QGridLayout; grid->setContentsMargins( 4, 0, 4, 0 ); vbox->addLayout( grid ); { @@ -1274,21 +1274,21 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ grid->addWidget( new QLabel( "Value" ), 1, 0 ); } { - auto line = g_entityKeyEntry = new LineEdit; + auto *line = g_entityKeyEntry = new LineEdit; grid->addWidget( line, 0, 1 ); QObject::connect( line, &QLineEdit::returnPressed, [](){ g_entityValueEntry->setFocus(); g_entityValueEntry->selectAll(); } ); line->setValidator( new KeyNameValidator( line ) ); } { - auto line = g_entityValueEntry = new LineEdit; + auto *line = g_entityValueEntry = new LineEdit; grid->addWidget( line, 1, 1 ); QObject::connect( line, &QLineEdit::returnPressed, [](){ EntityInspector_applyKeyValue(); } ); line->setValidator( new KeyValueValidator( line ) ); } /* select by key/value buttons */ { - auto b = new QToolButton; + auto *b = new QToolButton; b->setText( "+" ); b->setToolTip( "Select by key" ); grid->addWidget( b, 0, 2 ); @@ -1297,7 +1297,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ } ); } { - auto b = new QToolButton; + auto *b = new QToolButton; b->setText( "+" ); b->setToolTip( "Select by value" ); grid->addWidget( b, 1, 2 ); @@ -1306,7 +1306,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ } ); } { - auto b = new QToolButton; + auto *b = new QToolButton; b->setText( "+" ); b->setToolTip( "Select by key + value" ); grid->addWidget( b, 0, 3, 2, 1 ); @@ -1316,42 +1316,42 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ } } { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; hbox->setContentsMargins( 4, 0, 4, 0 ); vbox->addLayout( hbox ); { - auto b = new QPushButton( "Clear All" ); + auto *b = new QPushButton( "Clear All" ); hbox->addWidget( b ); QObject::connect( b, &QAbstractButton::clicked, EntityInspector_clearAllKeyValues ); } { - auto b = new QPushButton( "Delete Key" ); + auto *b = new QPushButton( "Delete Key" ); hbox->addWidget( b ); QObject::connect( b, &QAbstractButton::clicked, EntityInspector_clearKeyValue ); } { - auto b = new QToolButton; + auto *b = new QToolButton; hbox->addWidget( b ); b->setText( "<" ); b->setToolTip( "Select targeting entities" ); QObject::connect( b, &QAbstractButton::clicked, [](){ Select_ConnectedEntities( true, false, g_focusToggleButton->isChecked() ); } ); } { - auto b = new QToolButton; + auto *b = new QToolButton; hbox->addWidget( b ); b->setText( ">" ); b->setToolTip( "Select targets" ); QObject::connect( b, &QAbstractButton::clicked, [](){ Select_ConnectedEntities( false, true, g_focusToggleButton->isChecked() ); } ); } { - auto b = new QToolButton; + auto *b = new QToolButton; hbox->addWidget( b ); b->setText( "<->" ); b->setToolTip( "Select connected entities" ); QObject::connect( b, &QAbstractButton::clicked, [](){ Select_ConnectedEntities( true, true, g_focusToggleButton->isChecked() ); } ); } { - auto b = g_focusToggleButton = new QToolButton; + auto *b = g_focusToggleButton = new QToolButton; hbox->addWidget( b ); b->setText( "👀" ); b->setToolTip( "AutoFocus on Selection" ); @@ -1361,12 +1361,12 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ } } { - auto scroll = new QScrollArea; + auto *scroll = new QScrollArea; scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarPolicy::ScrollBarAlwaysOff ); scroll->setWidgetResizable( true ); splitter->addWidget( scroll ); - QWidget *containerWidget = new QWidget; // Adding a QLayout to a QScrollArea is not supported, use proxy widget + auto *containerWidget = new QWidget; // Adding a QLayout to a QScrollArea is not supported, use proxy widget g_attributeBox = new QGridLayout( containerWidget ); g_attributeBox->setAlignment( Qt::AlignmentFlag::AlignTop ); g_attributeBox->setColumnStretch( 0, 111 ); diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index baa37ea4..2ce3152c 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -197,7 +197,7 @@ protected: } bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Escape ){ clear(); event->accept(); @@ -274,7 +274,7 @@ void DetachEntityTreeModel(){ void EntityList_constructWindow( QWidget* main_window ){ ASSERT_MESSAGE( getEntityList().m_window == 0, "error" ); - auto window = getEntityList().m_window = new QWidget( main_window, Qt::Dialog | Qt::WindowCloseButtonHint ); + auto *window = getEntityList().m_window = new QWidget( main_window, Qt::Dialog | Qt::WindowCloseButtonHint ); window->setWindowTitle( "Entity List" ); g_guiSettings.addWindow( window, "EntityList/geometry", 350, 500 ); diff --git a/radiant/filterbar.cpp b/radiant/filterbar.cpp index 8b294dc8..7924cc0d 100644 --- a/radiant/filterbar.cpp +++ b/radiant/filterbar.cpp @@ -99,7 +99,7 @@ class FilterToolbarHandler : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick ){ - QMouseEvent *mouseEvent = static_cast( event ); + auto *mouseEvent = static_cast( event ); if( mouseEvent->button() == Qt::MouseButton::RightButton ){ QAction *action = m_toolbar->actionAt( mouseEvent->pos() ); if( action != nullptr ){ diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index e902562c..b5cc5021 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -108,7 +108,7 @@ class : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Tab ){ event->accept(); } @@ -137,20 +137,20 @@ void FindTextureDialog::BuildDialog(){ g_guiSettings.addWindow( GetWidget(), "TextureBrowser/FindReplace" ); - auto hbox = new QHBoxLayout( GetWidget() ); - auto form = new QFormLayout; + auto *hbox = new QHBoxLayout( GetWidget() ); + auto *form = new QFormLayout; hbox->addLayout( form ); { - auto entry = new LineEdit; + auto *entry = new LineEdit; form->addRow( "Find:", entry ); AddDialogData( *entry, m_strFind ); entry->installEventFilter( &s_find_focus_in ); GlobalTextureEntryCompletion::instance().connect( entry ); } { - auto entry = new LineEdit; - auto label = new QLabel( "Replace:" ); + auto *entry = new LineEdit; + auto *label = new QLabel( "Replace:" ); form->addRow( label, entry ); entry->setPlaceholderText( "Empty = search mode" ); AddDialogData( *entry, m_strReplace ); @@ -158,13 +158,13 @@ void FindTextureDialog::BuildDialog(){ GlobalTextureEntryCompletion::instance().connect( entry ); } { - auto check = new QCheckBox( "Within selected brushes only" ); + auto *check = new QCheckBox( "Within selected brushes only" ); form->addWidget( check ); AddDialogData( *check, m_bSelectedOnly ); } { - auto buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); + auto *buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); hbox->addWidget( buttons ); QObject::connect( buttons->addButton( QDialogButtonBox::StandardButton::Apply ), &QPushButton::clicked, [](){ g_FindTextureDialog.exportData(); diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index caaa9c37..efef3600 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -85,7 +85,7 @@ void GroupDlg::Create( QWidget* parent ){ g_guiSettings.addWindow( m_window, "GroupDlg/geometry", 444, 777 ); { - auto box = new QVBoxLayout( m_window ); + auto *box = new QVBoxLayout( m_window ); box->setContentsMargins( 0, 0, 0, 0 ); m_pNotebook = new QTabWidget; m_pNotebook->setTabPosition( QTabWidget::TabPosition::South ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index e9d698dd..2fd999c2 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -273,10 +273,10 @@ void DoSides( EBrushPrefab type ){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Arbitrary sides" ); - auto spin = new SpinBox; - auto check = new QCheckBox( "Truncate" ); + auto *spin = new SpinBox; + auto *check = new QCheckBox( "Truncate" ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); QLabel* label = new SpinBoxLabel( "Sides:", spin ); @@ -311,7 +311,7 @@ void DoSides( EBrushPrefab type ){ } spin->selectAll(); { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -333,18 +333,18 @@ void DoAbout(){ dialog.setWindowTitle( "About NetRadiant" ); { - auto vbox = new QVBoxLayout( &dialog ); + auto *vbox = new QVBoxLayout( &dialog ); { - auto hbox = new QHBoxLayout; + auto *hbox = new QHBoxLayout; vbox->addLayout( hbox ); { - auto label = new QLabel; + auto *label = new QLabel; label->setPixmap( new_local_image( "logo.png" ) ); hbox->addWidget( label ); } { - auto label = new QLabel( "NetRadiant " RADIANT_VERSION "\n" + auto *label = new QLabel( "NetRadiant " RADIANT_VERSION "\n" __DATE__ "\n\n" RADIANT_ABOUTMSG "\n\n" "This program is free software\n" @@ -354,42 +354,42 @@ void DoAbout(){ } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok, Qt::Orientation::Vertical ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok, Qt::Orientation::Vertical ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); hbox->addWidget( buttons ); { - auto button = buttons->addButton( "Credits", QDialogButtonBox::ButtonRole::NoRole ); + auto *button = buttons->addButton( "Credits", QDialogButtonBox::ButtonRole::NoRole ); QObject::connect( button, &QPushButton::clicked, [](){ OpenURL( StringStream( AppPath_get(), "credits.html" ) ); } ); button->setEnabled( false ); } { - auto button = buttons->addButton( "Changelog", QDialogButtonBox::ButtonRole::NoRole ); + auto *button = buttons->addButton( "Changelog", QDialogButtonBox::ButtonRole::NoRole ); QObject::connect( button, &QPushButton::clicked, [](){ OpenURL( StringStream( AppPath_get(), "docs/changelog-custom.txt" ) ); } ); } { - auto button = buttons->addButton( "About Qt", QDialogButtonBox::ButtonRole::NoRole ); + auto *button = buttons->addButton( "About Qt", QDialogButtonBox::ButtonRole::NoRole ); QObject::connect( button, &QPushButton::clicked, &QApplication::aboutQt ); } } } { { - auto frame = new QGroupBox( "OpenGL Properties" ); + auto *frame = new QGroupBox( "OpenGL Properties" ); vbox->addWidget( frame ); { - auto form = new QFormLayout( frame ); + auto *form = new QFormLayout( frame ); form->addRow( "Vendor:", new QLabel( reinterpret_cast( gl().glGetString( GL_VENDOR ) ) ) ); form->addRow( "Version:", new QLabel( reinterpret_cast( gl().glGetString( GL_VERSION ) ) ) ); form->addRow( "Renderer:", new QLabel( reinterpret_cast( gl().glGetString( GL_RENDERER ) ) ) ); } } { - auto frame = new QGroupBox( "OpenGL Extensions" ); + auto *frame = new QGroupBox( "OpenGL Extensions" ); vbox->addWidget( frame ); { - auto textView = new QPlainTextEdit( reinterpret_cast( gl().glGetString( GL_EXTENSIONS ) ) ); + auto *textView = new QPlainTextEdit( reinterpret_cast( gl().glGetString( GL_EXTENSIONS ) ) ); textView->setReadOnly( true ); - auto box = new QVBoxLayout( frame ); + auto *box = new QVBoxLayout( frame ); box->addWidget( textView ); } } @@ -411,20 +411,20 @@ bool DoLightIntensityDlg( int *intensity ){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Set Light intensity" ); - auto spin = new SpinBox( -99999, 99999, *intensity ); + auto *spin = new SpinBox( -99999, 99999, *intensity ); - auto check = new QCheckBox( "Don't show this dialog until restart" ); + auto *check = new QCheckBox( "Don't show this dialog until restart" ); QObject::connect( check, &QCheckBox::toggled, []( bool checked ){ g_dontDoLightIntensityDlg = checked; } ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); form->addRow( new QLabel( "Tip: ESC for default, ENTER to validate" ) ); form->addRow( new SpinBoxLabel( "Intensity:", spin ), spin ); form->addWidget( check ); { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -1398,7 +1398,7 @@ ShaderHighlighter::ShaderHighlighter( QTextDocument *parent ) else if( string_equal_prefix( c, "%s" ) ){ // string ++c; pattern += ")((?:"; // extra inner non capturing group, as space may be added - for( const auto value : format.values ){ + for( const auto *value : format.values ){ pattern += value; pattern += '|'; } @@ -1612,7 +1612,7 @@ public: protected: bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); // fix leaking keys if( keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return @@ -1810,7 +1810,7 @@ public: protected: bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); // fix leaking shortcuts if( keyEvent->key() == Qt::Key_PageUp || keyEvent->key() == Qt::Key_PageDown @@ -2111,7 +2111,7 @@ private: }; if( i < tokens.size() ){ // token is available if( tokens[i] == "%s" ){ - for( const auto value : format.values ){ + for( const auto *value : format.values ){ push_token( value ); } } @@ -2133,11 +2133,10 @@ private: } }; - const auto values_contain = []( const std::vector values, const QString& string ){ - for( const auto value : values ) - if( string.compare( value, Qt::CaseSensitivity::CaseInsensitive ) == 0 ) - return true; - return false; + const auto values_contain = []( const std::vector& values, const QString& string ){ + return std::ranges::any_of( values, [&string]( const char *value ){ + return string.compare( value, Qt::CaseSensitivity::CaseInsensitive ) == 0; + } ); }; if( i == line.size() - 1 ){ // last word, partial match is okay @@ -2147,7 +2146,7 @@ private: } else{ // partial match if( !selectedText.back().isSpace() ){ - for( const auto v : format.values ){ + for( const auto *v : format.values ){ QString value( v ); if( value.startsWith( word, Qt::CaseSensitivity::CaseInsensitive ) ){ if( i + 1 < tokens.size() ) // there is next token, add space @@ -2294,7 +2293,7 @@ class TextEditor : public QObject QObject::connect( m_button, &QAbstractButton::clicked, [this](){ editor_save(); } ); { - QLabel *label = new QLabel; + auto *label = new QLabel; // label->setOpenExternalLinks( true ); hbox->addWidget( label ); QObject::connect( label, &QLabel::linkActivated, []( const QString& link ){ @@ -2326,7 +2325,7 @@ class TextEditor : public QObject else if( page.back() == '$' ){ // no explicit id, id = one of values page.back() = '#'; const QString txt = m_textView->textCursor().block().text(); - for( const auto value : shaderFormat->values ){ + for( const auto *value : shaderFormat->values ){ if( txt.contains( QRegularExpression( QString( "\\b" ) + value + "\\b" ) ) ){ page += value; break; @@ -2421,7 +2420,7 @@ protected: } } if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent == QKeySequence::StandardKey::Save ){ if( !keyEvent->isAutoRepeat() && m_textView->document()->isModified() ) editor_save(); diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index f8b7a940..0fa9064d 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -115,14 +115,14 @@ void toggle_remove_accelerator( const char* name ){ QAction* create_check_menu_item_with_mnemonic( QMenu* menu, const char* mnemonic, const char* commandName ){ - auto action = toggle_add_accelerator_( commandName ); + auto *action = toggle_add_accelerator_( commandName ); action->setText( mnemonic ); menu->addAction( action ); return action; } QAction* create_menu_item_with_mnemonic( QMenu *menu, const char *mnemonic, const char* commandName ){ - auto action = command_connect_accelerator_( commandName ); + auto *action = command_connect_accelerator_( commandName ); action->setText( mnemonic ); menu->addAction( action ); return action; @@ -149,7 +149,7 @@ static void toolbar_action_set_tooltip( QAction *action, const char *description } QAction* toolbar_append_button( QToolBar* toolbar, const char* description, const char* icon, const char* commandName ){ - auto action = command_connect_accelerator_( commandName ); + auto *action = command_connect_accelerator_( commandName ); action->setIcon( new_local_icon( icon ) ); toolbar_action_set_tooltip( action, description ); toolbar->addAction( action ); @@ -157,7 +157,7 @@ QAction* toolbar_append_button( QToolBar* toolbar, const char* description, cons } QAction* toolbar_append_toggle_button( QToolBar* toolbar, const char* description, const char* icon, const char* commandName ){ - auto action = toggle_add_accelerator_( commandName ); + auto *action = toggle_add_accelerator_( commandName ); action->setIcon( new_local_icon( icon ) ); toolbar_action_set_tooltip( action, description ); toolbar->addAction( action ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index cd1fb0ba..2f9a3d8c 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -223,7 +223,7 @@ void HomePaths_Realise(){ g_qeglobals.m_userEnginePath = EnginePath_get(); } - while ( 0 ); + while ( false ); Q_mkdir( g_qeglobals.m_userEnginePath.c_str() ); @@ -422,12 +422,12 @@ public: void BuildDialog() override { GetWidget()->setWindowTitle( "Engine Path Configuration" ); - auto vbox = new QVBoxLayout( GetWidget() ); + auto *vbox = new QVBoxLayout( GetWidget() ); { - auto frame = new QGroupBox( "Path settings" ); + auto *frame = new QGroupBox( "Path settings" ); vbox->addWidget( frame ); - auto grid = new QGridLayout( frame ); + auto *grid = new QGridLayout( frame ); grid->setAlignment( Qt::AlignmentFlag::AlignTop ); grid->setColumnStretch( 0, 111 ); grid->setColumnStretch( 1, 333 ); @@ -451,7 +451,7 @@ public: } } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok ); vbox->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, GetWidget(), &QDialog::accept ); } @@ -760,20 +760,20 @@ WaitDialog create_wait_dialog( const char* title, const char* text ){ /* Qt::Tool window type doesn't steal focus, which saves e.g. from losing freelook camera mode on autosave or entity menu from hiding, while clicked with ctrl, by tex/model loading popup. Qt::WidgetAttribute::WA_ShowWithoutActivating is implied, but lets have it set too. */ - auto window = new QWidget( MainFrame_getWindow(), Qt::Tool | Qt::WindowTitleHint ); + auto *window = new QWidget( MainFrame_getWindow(), Qt::Tool | Qt::WindowTitleHint ); window->setWindowTitle( title ); window->setWindowModality( Qt::WindowModality::ApplicationModal ); window->setAttribute( Qt::WidgetAttribute::WA_ShowWithoutActivating ); - auto label = new QLabel( text ); + auto *label = new QLabel( text ); { - auto box = new QHBoxLayout( window ); + auto *box = new QHBoxLayout( window ); box->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); box->setContentsMargins( 20, 5, 20, 3 ); box->addWidget( label ); label->setMinimumWidth( 200 ); } - return WaitDialog{ window, label }; + return WaitDialog{ .m_window = window, .m_label = label }; } namespace @@ -1442,7 +1442,7 @@ void create_main_toolbar( QToolBar *toolbar, MainFrame::EViewStyle style ){ void create_main_statusbar( QStatusBar *statusbar, QLabel *pStatusLabel[c_status__count] ){ statusbar->setSizeGripEnabled( false ); { - QLabel *label = new QLabel; + auto *label = new QLabel; statusbar->addPermanentWidget( label, 1 ); pStatusLabel[c_status_command] = label; } @@ -1450,13 +1450,13 @@ void create_main_statusbar( QStatusBar *statusbar, QLabel *pStatusLabel[c_status for ( int i = 1; i < c_status__count; ++i ) { if( i == c_status_brushcount ){ - QWidget *widget = new QWidget; - QHBoxLayout *hbox = new QHBoxLayout( widget ); + auto *widget = new QWidget; + auto *hbox = new QHBoxLayout( widget ); hbox->setMargin( 0 ); statusbar->addPermanentWidget( widget, 0 ); const char* imgs[3] = { "status_brush.png", "patch_wireframe.png", "status_entity.png" }; for( ; i < c_status_brushcount + 3; ++i ){ - QLabel *label = new QLabel(); + auto *label = new QLabel(); label->setPixmap( new_local_image( imgs[i - c_status_brushcount] ) ); hbox->addWidget( label ); @@ -1468,7 +1468,7 @@ void create_main_statusbar( QStatusBar *statusbar, QLabel *pStatusLabel[c_status --i; } else{ - QLabel *label = new QLabel; + auto *label = new QLabel; if( i == c_status_grid ){ statusbar->addPermanentWidget( label, 0 ); label->setToolTip( " G: Grid size
F: map Format
C: camera Clip distance
L: texture Lock" ); @@ -1583,7 +1583,7 @@ public: } } void toggle(){ - return m_maximized ? unmaximize() : maximize(); + m_maximized ? unmaximize() : maximize(); } }; @@ -1613,7 +1613,7 @@ protected: QSplashScreen *create_splash(){ - QSplashScreen *splash = new QSplashScreen( new_local_image( "splash.png" ) ); + auto *splash = new QSplashScreen( new_local_image( "splash.png" ) ); splash->show(); return splash; } @@ -1736,7 +1736,7 @@ void MainFrame::Create(){ } else if ( CurrentStyle() == eFloating ) { { - QWidget* window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); + auto *window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); window->setWindowTitle( "Camera" ); g_guiSettings.addWindow( window, "floating/cam", 400, 300, 50, 100 ); @@ -1744,7 +1744,7 @@ void MainFrame::Create(){ GlobalCamera_setCamWnd( *m_pCamWnd ); { - auto box = new QHBoxLayout( window ); + auto *box = new QHBoxLayout( window ); box->setContentsMargins( 1, 1, 1, 1 ); box->addWidget( CamWnd_getWidget( *m_pCamWnd ) ); } @@ -1756,7 +1756,7 @@ void MainFrame::Create(){ } { - QWidget* window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); + auto *window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); g_guiSettings.addWindow( window, "floating/xy", 400, 300, 500, 100 ); m_pXYWnd = new XYWnd(); @@ -1764,7 +1764,7 @@ void MainFrame::Create(){ m_pXYWnd->SetViewType( XY ); { - auto box = new QHBoxLayout( window ); + auto *box = new QHBoxLayout( window ); box->setContentsMargins( 1, 1, 1, 1 ); box->addWidget( m_pXYWnd->GetWidget() ); } @@ -1774,7 +1774,7 @@ void MainFrame::Create(){ } { - QWidget* window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); + auto *window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); g_guiSettings.addWindow( window, "floating/xz", 400, 300, 500, 450 ); m_pXZWnd = new XYWnd(); @@ -1782,7 +1782,7 @@ void MainFrame::Create(){ m_pXZWnd->SetViewType( XZ ); { - auto box = new QHBoxLayout( window ); + auto *box = new QHBoxLayout( window ); box->setContentsMargins( 1, 1, 1, 1 ); box->addWidget( m_pXZWnd->GetWidget() ); } @@ -1792,7 +1792,7 @@ void MainFrame::Create(){ } { - QWidget* window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); + auto *window = new QWidget( m_window, Qt::Dialog | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint ); g_guiSettings.addWindow( window, "floating/yz", 400, 300, 50, 450 ); m_pYZWnd = new XYWnd(); @@ -1800,7 +1800,7 @@ void MainFrame::Create(){ m_pYZWnd->SetViewType( YZ ); { - auto box = new QHBoxLayout( window ); + auto *box = new QHBoxLayout( window ); box->setContentsMargins( 1, 1, 1, 1 ); box->addWidget( m_pYZWnd->GetWidget() ); } diff --git a/radiant/map.cpp b/radiant/map.cpp index 9c194ad7..b2c164a7 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -908,14 +908,14 @@ void DoMapInfo(){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Map Info" ); - auto w_brushes = new QLabel; - auto w_patches = new QLabel; - auto w_ents = new QLabel; - auto w_ents_ingame = new QLabel; - auto w_groupents = new QLabel; - auto w_groupents_ingame = new QLabel; + auto *w_brushes = new QLabel; + auto *w_patches = new QLabel; + auto *w_ents = new QLabel; + auto *w_ents_ingame = new QLabel; + auto *w_groupents = new QLabel; + auto *w_groupents_ingame = new QLabel; - auto tree = new QTreeWidget; + auto *tree = new QTreeWidget; tree->setColumnCount( 2 ); tree->setSortingEnabled( true ); tree->sortByColumn( 0, Qt::SortOrder::AscendingOrder ); @@ -928,7 +928,7 @@ void DoMapInfo(){ tree->setHeaderLabels( { "Entity", "Count" } ); { - auto grid = new QGridLayout( &dialog ); + auto *grid = new QGridLayout( &dialog ); grid->addWidget( new QLabel( "Total Brushes:" ), 0, 0 ); grid->addWidget( w_brushes, 0, 1 ); @@ -956,7 +956,7 @@ void DoMapInfo(){ for ( const auto&[name, count] : entitymap ) { - auto item = new QTreeWidgetItem( tree ); + auto *item = new QTreeWidgetItem( tree ); item->setData( 0, Qt::ItemDataRole::DisplayRole, name.c_str() ); item->setData( 1, Qt::ItemDataRole::DisplayRole, int( count ) ); } @@ -2085,18 +2085,18 @@ void DoFind(){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Find Brush" ); - auto entity = new SpinBox( 0, 999999 ); + auto *entity = new SpinBox( 0, 999999 ); entity->setButtonSymbols( QAbstractSpinBox::ButtonSymbols::NoButtons ); - auto brush = new SpinBox( 0, 999999 ); + auto *brush = new SpinBox( 0, 999999 ); brush->setButtonSymbols( QAbstractSpinBox::ButtonSymbols::NoButtons ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); form->addRow( new SpinBoxLabel( "Entity number", entity ), entity ); form->addRow( new SpinBoxLabel( "Brush number", brush ), brush ); { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Close ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Close ); buttons->addButton( "Find", QDialogButtonBox::ButtonRole::AcceptRole ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); diff --git a/radiant/modelwindow.cpp b/radiant/modelwindow.cpp index d1dfc9d9..96028d0f 100644 --- a/radiant/modelwindow.cpp +++ b/radiant/modelwindow.cpp @@ -1111,7 +1111,7 @@ static void TreeView_onRowActivated( const QModelIndex& index ){ for( const CopiedString& filename : g_ModelBrowser.m_currentFolder->m_files ){ sstream( g_ModelBrowser.m_currentFolderPath, filename ); - ModelNode *modelNode = new ModelNode; + auto *modelNode = new ModelNode; modelNode->setModel( sstream ); NodeSmartReference node( modelNode->node() ); Node_getTraversable( g_modelGraph->root() )->insert( node ); @@ -1142,7 +1142,7 @@ void modelFS_traverse( const ModelFS& modelFS ){ } #endif void ModelBrowser_constructTreeModel( const ModelFS& modelFS, QStandardItemModel* model, QStandardItem* parent ){ - auto item = new QStandardItem( modelFS.m_folderName.c_str() ); + auto *item = new QStandardItem( modelFS.m_folderName.c_str() ); parent->appendRow( item ); for( const ModelFS& m : modelFS.m_folders ) ModelBrowser_constructTreeModel( m, model, item ); //recursion @@ -1241,7 +1241,7 @@ void ModelBrowser_constructTree(){ //% modelFS_traverse( g_ModelBrowser.m_modelFS ); - auto model = new QStandardItemModel( g_ModelBrowser.m_treeView ); //. ? delete old or clear() & reuse + auto *model = new QStandardItemModel( g_ModelBrowser.m_treeView ); //. ? delete old or clear() & reuse { if( !g_ModelBrowser.m_modelFS.m_files.empty() ){ // models in the root: add blank item for access @@ -1270,13 +1270,13 @@ protected: QWidget* ModelBrowser_constructWindow( QWidget* toplevel ){ g_ModelBrowser.m_parent = toplevel; - QSplitter *splitter = new QSplitter; - QWidget *containerWidgetLeft = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget - QWidget *containerWidgetRight = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget + auto *splitter = new QSplitter; + auto *containerWidgetLeft = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget + auto *containerWidgetRight = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget splitter->addWidget( containerWidgetLeft ); splitter->addWidget( containerWidgetRight ); - QVBoxLayout *vbox = new QVBoxLayout( containerWidgetLeft ); - QHBoxLayout *hbox = new QHBoxLayout( containerWidgetRight ); + auto *vbox = new QVBoxLayout( containerWidgetLeft ); + auto *hbox = new QHBoxLayout( containerWidgetRight ); hbox->setContentsMargins( 0, 0, 0, 0 ); vbox->setContentsMargins( 0, 0, 0, 0 ); @@ -1284,7 +1284,7 @@ QWidget* ModelBrowser_constructWindow( QWidget* toplevel ){ vbox->setSpacing( 0 ); { // menu bar - QToolBar* toolbar = new QToolBar; + auto *toolbar = new QToolBar; vbox->addWidget( toolbar ); toolbar_append_button( toolbar, "Reload Model Folders Tree View", "texbro_refresh.png", FreeCaller() ); @@ -1311,7 +1311,7 @@ QWidget* ModelBrowser_constructWindow( QWidget* toplevel ){ hbox->addWidget( g_ModelBrowser.m_gl_widget ); } { // gl_widget scrollbar - auto scroll = g_ModelBrowser.m_gl_scroll = new QScrollBar; + auto *scroll = g_ModelBrowser.m_gl_scroll = new QScrollBar; hbox->addWidget( scroll ); QObject::connect( scroll, &QAbstractSlider::valueChanged, []( int value ){ diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 80057061..3e73f976 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -134,7 +134,7 @@ public: void Scene_PatchDoCap_Selected( scene::Graph& graph, const char* shader, EPatchCap type ){ InstanceVector instances; Scene_forEachVisibleSelectedPatchInstance( PatchStoreInstance( instances ) ); - for ( auto i : instances ) + for ( auto *i : instances ) { Patch_makeCaps( *Node_getPatch( i->path().top() ), *i, type, shader ); } @@ -156,7 +156,7 @@ void Scene_PatchDeform( scene::Graph& graph, const int deform, const int axis ) { InstanceVector instances; Scene_forEachVisibleSelectedPatchInstance( PatchStoreInstance( instances ) ); - for ( auto i : instances ) + for ( auto *i : instances ) { Patch_deform( *Node_getPatch( i->path().top() ), *i, deform, axis ); } @@ -231,7 +231,7 @@ void Scene_PatchThicken( scene::Graph& graph, const int thickness, bool seams, c { InstanceVector instances; Scene_forEachVisibleSelectedPatchInstance( PatchStoreInstance( instances ) ); - for ( auto i : instances ) + for ( auto *i : instances ) { Patch_thicken( *Node_getPatch( i->path().top() ), *i, thickness, seams, axis ); } @@ -830,12 +830,12 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Patch density" ); - auto width = new ComboBox; - auto height = new ComboBox; - auto redisperseCheckBox = new QCheckBox( "Square" ); + auto *width = new ComboBox; + auto *height = new ComboBox; + auto *redisperseCheckBox = new QCheckBox( "Square" ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { { @@ -885,7 +885,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, } } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -909,18 +909,18 @@ void DoPatchDeformDlg(){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Patch deform" ); - auto spin = new SpinBox( -9999, 9999, 64 ); + auto *spin = new SpinBox( -9999, 9999, 64 ); RadioHBox radioBox = RadioHBox_new( (const char*[]){ "X", "Y", "Z" } ); radioBox.m_radio->button( 2 )->setChecked( true ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); form->addRow( new SpinBoxLabel( "Max deform:", spin ), spin ); form->addRow( "", radioBox.m_hbox ); { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -940,9 +940,9 @@ void DoCapDlg(){ QDialog dialog( MainFrame_getWindow(), Qt::Dialog | Qt::WindowCloseButtonHint ); dialog.setWindowTitle( "Cap" ); - auto group = new QButtonGroup( &dialog ); + auto *group = new QButtonGroup( &dialog ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { const char* iconlabel[][2] = { { "cap_bevel.png", "Bevel" }, @@ -952,9 +952,9 @@ void DoCapDlg(){ { "cap_cylinder.png", "Cylinder" } }; for( size_t i = 0; i < std::size( iconlabel ); ++i ){ const auto [ stricon, strlabel ] = iconlabel[i]; - auto label = new QLabel; + auto *label = new QLabel; label->setPixmap( new_local_image( stricon ) ); - auto button = new QRadioButton( strlabel ); + auto *button = new QRadioButton( strlabel ); group->addButton( button, i ); // set ids 0+, default ones are negative form->addRow( label, button ); } @@ -962,7 +962,7 @@ void DoCapDlg(){ form->itemAt( i )->setAlignment( Qt::AlignmentFlag::AlignVCenter ); } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); @@ -983,22 +983,22 @@ void DoPatchThickenDlg(){ dialog.setWindowTitle( "Patch thicken" ); const int grid = std::max( GetGridSize(), 1.f ); - auto spin = new SpinBox( -9999, 9999, grid, 2, grid ); + auto *spin = new SpinBox( -9999, 9999, grid, 2, grid ); RadioHBox radioBox = RadioHBox_new( (const char*[]){ "X", "Y", "Z", "Normal" } ); radioBox.m_radio->button( 3 )->setChecked( true ); - auto check = new QCheckBox( "Side walls" ); + auto *check = new QCheckBox( "Side walls" ); check->setChecked( true ); { - auto form = new QFormLayout( &dialog ); + auto *form = new QFormLayout( &dialog ); form->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); form->addRow( new SpinBoxLabel( "Thickness:", spin ), spin ); form->addRow( "", radioBox.m_hbox ); form->addWidget( check ); { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); form->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject ); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index bca6fbab..f27d86c7 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -284,13 +284,13 @@ void CGameDialog::CreateGlobalFrame( PreferencesPage& page, bool global ){ void CGameDialog::BuildDialog(){ GetWidget()->setWindowTitle( "Global Preferences" ); - auto vbox = new QVBoxLayout( GetWidget() ); + auto *vbox = new QVBoxLayout( GetWidget() ); vbox->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto frame = new QGroupBox( "Game settings" ); + auto *frame = new QGroupBox( "Game settings" ); vbox->addWidget( frame ); - auto grid = new QGridLayout( frame ); + auto *grid = new QGridLayout( frame ); grid->setAlignment( Qt::AlignmentFlag::AlignTop ); grid->setColumnStretch( 0, 111 ); grid->setColumnStretch( 1, 333 ); @@ -301,7 +301,7 @@ void CGameDialog::BuildDialog(){ } } { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok ); vbox->addWidget( buttons ); QObject::connect( buttons, &QDialogButtonBox::accepted, GetWidget(), &QDialog::accept ); } @@ -563,15 +563,15 @@ void Widget_connectToggleDependency( QCheckBox* self, QCheckBox* toggleButton ){ QStandardItem* PreferenceTree_appendPage( QStandardItemModel* model, QStandardItem* parent, const char* name, int pageIndex ){ - auto item = new QStandardItem( name ); + auto *item = new QStandardItem( name ); item->setData( pageIndex, Qt::ItemDataRole::UserRole ); parent->appendRow( item ); return item; } auto PreferencePages_addPage( QStackedWidget* notebook, const char* name ){ - auto frame = new QGroupBox( name ); - auto grid = new QGridLayout( frame ); + auto *frame = new QGroupBox( name ); + auto *grid = new QGridLayout( frame ); grid->setAlignment( Qt::AlignmentFlag::AlignTop ); grid->setColumnStretch( 0, 111 ); grid->setColumnStretch( 1, 333 ); @@ -604,10 +604,10 @@ void PrefsDlg::BuildDialog(){ GetWidget()->setWindowTitle( "NetRadiant Preferences" ); { - auto grid = new QGridLayout( GetWidget() ); + auto *grid = new QGridLayout( GetWidget() ); grid->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { - auto buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); + auto *buttons = new QDialogButtonBox( QDialogButtonBox::StandardButton::Ok | QDialogButtonBox::StandardButton::Cancel ); grid->addWidget( buttons, 1, 1 ); QObject::connect( buttons, &QDialogButtonBox::accepted, GetWidget(), &QDialog::accept ); QObject::connect( buttons, &QDialogButtonBox::rejected, GetWidget(), &QDialog::reject ); @@ -632,7 +632,7 @@ void PrefsDlg::BuildDialog(){ grid->addWidget( m_treeview, 0, 0, 2, 1 ); // store display name in column #0 and page index in data( Qt::ItemDataRole::UserRole ) - auto model = new QStandardItemModel( m_treeview ); + auto *model = new QStandardItemModel( m_treeview ); m_treeview->setModel( model ); QObject::connect( m_treeview->selectionModel(), &QItemSelectionModel::currentChanged, [this]( const QModelIndex& current ){ @@ -809,7 +809,7 @@ void PreferencesDialog_showDialog(){ if ( g_Preferences.DoModal() == QDialog::DialogCode::Accepted ) { if ( !g_restart_required.empty() ) { auto message = StringStream( "Preference changes require a restart:\n\n" ); - for ( const auto i : g_restart_required ) + for ( const auto *i : g_restart_required ) message << i << '\n'; g_restart_required.clear(); message << "\nRestart now?"; diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index 2f609de2..5e650eef 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -826,7 +826,7 @@ class OpenGLShaderCache final : public ShaderCache, public TexturesCacheObserver : m_cache( cache ){ } OpenGLShader* construct( const CopiedString& name ){ - OpenGLShader* shader = new OpenGLShader; + auto *shader = new OpenGLShader; if ( m_cache->realised() ) { shader->realise( name ); } diff --git a/radiant/select.cpp b/radiant/select.cpp index d74ea06e..792456ca 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -1593,7 +1593,7 @@ class RotateDialog : public QObject m_window->setWindowTitle( "Arbitrary rotation" ); m_window->installEventFilter( this ); - auto grid = new QGridLayout( m_window ); + auto *grid = new QGridLayout( m_window ); grid->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { @@ -1607,7 +1607,7 @@ class RotateDialog : public QObject grid->addWidget( new SpinBoxLabel( " Z ", m_z ), 2, 0 ); } { - auto buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); + auto *buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); grid->addWidget( buttons, 0, 2, 3, 1 ); QObject::connect( buttons->addButton( QDialogButtonBox::StandardButton::Ok ), &QPushButton::clicked, [this](){ ok(); } ); QObject::connect( buttons->addButton( QDialogButtonBox::StandardButton::Cancel ), &QPushButton::clicked, [this](){ cancel(); } ); @@ -1637,7 +1637,7 @@ class RotateDialog : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Escape ){ cancel(); event->accept(); @@ -1685,7 +1685,7 @@ class ScaleDialog : public QObject m_window->setWindowTitle( "Arbitrary scale" ); m_window->installEventFilter( this ); - auto grid = new QGridLayout( m_window ); + auto *grid = new QGridLayout( m_window ); grid->setSizeConstraint( QLayout::SizeConstraint::SetFixedSize ); { @@ -1699,7 +1699,7 @@ class ScaleDialog : public QObject grid->addWidget( new SpinBoxLabel( " Z ", m_z ), 2, 0 ); } { - auto buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); + auto *buttons = new QDialogButtonBox( Qt::Orientation::Vertical ); grid->addWidget( buttons, 0, 2, 3, 1 ); QObject::connect( buttons->addButton( QDialogButtonBox::StandardButton::Ok ), &QPushButton::clicked, [this](){ ok(); } ); QObject::connect( buttons->addButton( QDialogButtonBox::StandardButton::Cancel ), &QPushButton::clicked, [this](){ cancel(); } ); @@ -1729,7 +1729,7 @@ class ScaleDialog : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Escape ){ cancel(); event->accept(); diff --git a/radiant/selection.cpp b/radiant/selection.cpp index afb0abb9..718f3b41 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -1083,7 +1083,7 @@ public: for( ExtrudeSource& source : m_extrudeSources ){ Brush& brush0 = source.m_brushInstance->getBrush(); if( source.m_faces.size() > 1 ){ - Brush* tmpbrush = new Brush( brush0 ); + auto *tmpbrush = new Brush( brush0 ); offsetFaces( source, *tmpbrush, offset ); brush_extrudeDiag( brush0, *tmpbrush, source ); delete tmpbrush; @@ -1129,7 +1129,7 @@ public: face->planeChanged(); } if( source.m_faces.size() > 1 ){ - Brush* tmpbrush = new Brush( brush0 ); + auto *tmpbrush = new Brush( brush0 ); tmpbrush->evaluateBRep(); offsetFaces( source, brush0, offset ); if( brush0.hasContributingFaces() ) @@ -6500,15 +6500,15 @@ public: float snapMoveV = 0; // snap uvmove const auto functor = [&]( const Vector3& point ){ - for( std::vector::const_iterator i = m_Ulines.m_lines.begin(); i != m_Ulines.m_lines.end(); ++++i ){ - const float dist = point.y() - ( ( *i ).vertex.y() + uvmove.y() ); + for( auto it = m_Ulines.m_lines.cbegin(); it != m_Ulines.m_lines.cend(); ++++it ){ + const float dist = point.y() - ( ( *it ).vertex.y() + uvmove.y() ); if( fabs( dist ) < bestDistU ){ bestDistU = fabs( dist ); snapMoveU = uvmove.y() + dist; } } - for( std::vector::const_iterator i = m_Vlines.m_lines.begin(); i != m_Vlines.m_lines.end(); ++++i ){ - const float dist = point.x() - ( ( *i ).vertex.x() + uvmove.x() ); + for( auto it = m_Vlines.m_lines.cbegin(); it != m_Vlines.m_lines.cend(); ++++it ){ + const float dist = point.x() - ( ( *it ).vertex.x() + uvmove.x() ); if( fabs( dist ) < bestDistV ){ bestDistV = fabs( dist ); snapMoveV = uvmove.x() + dist; diff --git a/radiant/server.cpp b/radiant/server.cpp index a7601d76..c2f8e1dd 100644 --- a/radiant/server.cpp +++ b/radiant/server.cpp @@ -219,7 +219,7 @@ public: release(); } void registerLibrary( const char* filename, ModuleServer& server ){ - DynamicLibraryModule* library = new DynamicLibraryModule( filename ); + auto *library = new DynamicLibraryModule( filename ); if ( library->failed() ) { delete library; diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 12b1c342..f0973636 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -470,7 +470,7 @@ class : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick ){ - QMouseEvent *mouseEvent = static_cast( event ); + auto *mouseEvent = static_cast( event ); if( mouseEvent->button() == Qt::MouseButton::RightButton ){ SurfaceInspector_FaceFitWidthOnly(); return true; @@ -486,7 +486,7 @@ class : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick ){ - QMouseEvent *mouseEvent = static_cast( event ); + auto *mouseEvent = static_cast( event ); if( mouseEvent->button() == Qt::MouseButton::RightButton ){ SurfaceInspector_FaceFitHeightOnly(); return true; @@ -597,7 +597,7 @@ protected: bool eventFilter( QObject *obj, QEvent *event ) override { // QEvent::KeyPress & return true: override QDialog keyPressEvent also if( event->type() == QEvent::ShortcutOverride || event->type() == QEvent::KeyPress ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Escape @@ -677,19 +677,19 @@ void SurfaceInspector::BuildDialog(){ GridRowAdder adder{ grid, 0, 2 }; adder.m_grid->setColumnStretch( adder.m_colField, 1 ); { - auto spin = new NonModalSpinner( -8192, 8192, 0, 2, 2 ); + auto *spin = new NonModalSpinner( -8192, 8192, 0, 2, 2 ); spin->setCallbacks( ApplyTexdef_HShiftCaller( *this ), UpdateCaller( *this ) ); m_hshiftIncrement.m_spin = spin; adder.addRow( new SpinBoxLabel( "Horizontal shift", spin ), spin ); } { - auto spin = new NonModalSpinner( -8192, 8192, 0, 2, 2 ); + auto *spin = new NonModalSpinner( -8192, 8192, 0, 2, 2 ); spin->setCallbacks( ApplyTexdef_VShiftCaller( *this ), UpdateCaller( *this ) ); m_vshiftIncrement.m_spin = spin; adder.addRow( new SpinBoxLabel( "Vertical shift", spin ), spin ); } { - auto spin = new NonModalSpinner( -8192, 8192, .5, 5, .5 ); + auto *spin = new NonModalSpinner( -8192, 8192, .5, 5, .5 ); spin->setCallbacks( ApplyTexdef_HScaleCaller( *this ), UpdateCaller( *this ) ); m_hscaleIncrement.m_spin = spin; adder.addRow( new SpinBoxLabel( "Horizontal stretch", spin ), spin ); @@ -700,7 +700,7 @@ void SurfaceInspector::BuildDialog(){ QObject::connect( b, &QAbstractButton::clicked, SurfaceInspector_InvertTextureHorizontally ); } { - auto spin = new NonModalSpinner( -8192, 8192, .5, 5, .5 ); + auto *spin = new NonModalSpinner( -8192, 8192, .5, 5, .5 ); spin->setCallbacks( ApplyTexdef_VScaleCaller( *this ), UpdateCaller( *this ) ); m_vscaleIncrement.m_spin = spin; adder.addRow( new SpinBoxLabel( "Vertical stretch", spin ), spin ); @@ -711,7 +711,7 @@ void SurfaceInspector::BuildDialog(){ QObject::connect( b, &QAbstractButton::clicked, SurfaceInspector_InvertTextureVertically ); } { - auto spin = new NonModalSpinner( -360, 360, 0, 2, 45, true ); + auto *spin = new NonModalSpinner( -360, 360, 0, 2, 45, true ); spin->setCallbacks( ApplyTexdef_RotationCaller( *this ), UpdateCaller( *this ) ); m_rotateIncrement.m_spin = spin; adder.addRow( new SpinBoxLabel( "Rotate", spin ), spin ); @@ -720,27 +720,27 @@ void SurfaceInspector::BuildDialog(){ { GridRowAdder adder{ grid, 3, 4 }; { - auto entry = new NonModalEntry( Increment::ApplyCaller( m_hshiftIncrement ), Increment::CancelCaller( m_hshiftIncrement ) ); + auto *entry = new NonModalEntry( Increment::ApplyCaller( m_hshiftIncrement ), Increment::CancelCaller( m_hshiftIncrement ) ); m_hshiftIncrement.m_entry = entry; adder.addRow( "Step", entry ); } { - auto entry = new NonModalEntry( Increment::ApplyCaller( m_vshiftIncrement ), Increment::CancelCaller( m_vshiftIncrement ) ); + auto *entry = new NonModalEntry( Increment::ApplyCaller( m_vshiftIncrement ), Increment::CancelCaller( m_vshiftIncrement ) ); m_vshiftIncrement.m_entry = entry; adder.addRow( "Step", entry ); } { - auto entry = new NonModalEntry( Increment::ApplyCaller( m_hscaleIncrement ), Increment::CancelCaller( m_hscaleIncrement ) ); + auto *entry = new NonModalEntry( Increment::ApplyCaller( m_hscaleIncrement ), Increment::CancelCaller( m_hscaleIncrement ) ); m_hscaleIncrement.m_entry = entry; adder.addRow( "Step", entry ); } { - auto entry = new NonModalEntry( Increment::ApplyCaller( m_vscaleIncrement ), Increment::CancelCaller( m_vscaleIncrement ) ); + auto *entry = new NonModalEntry( Increment::ApplyCaller( m_vscaleIncrement ), Increment::CancelCaller( m_vscaleIncrement ) ); m_vscaleIncrement.m_entry = entry; adder.addRow( "Step", entry ); } { - auto entry = new NonModalEntry( Increment::ApplyCaller( m_rotateIncrement ), Increment::CancelCaller( m_rotateIncrement ) ); + auto *entry = new NonModalEntry( Increment::ApplyCaller( m_rotateIncrement ), Increment::CancelCaller( m_rotateIncrement ) ); m_rotateIncrement.m_entry = entry; adder.addRow( "Step", entry ); } @@ -1292,7 +1292,7 @@ static std::vector Patch_getClosestTriangle( const PatchDat std::vector ret; const auto find_triangle = [&ret, &patch, triangle_ok, eps]( const auto& check_func ){ - for( auto& iter : { + for( const auto& iter : { PatchEdgeIter( patch, PatchEdgeIter::eRowBack, 0 ), PatchEdgeIter( patch, PatchEdgeIter::eRowForward, patch.getHeight() - 1 ), PatchEdgeIter( patch, PatchEdgeIter::eColBack, patch.getWidth() - 1 ), diff --git a/radiant/textures.cpp b/radiant/textures.cpp index 2649c0d4..011e759d 100644 --- a/radiant/textures.cpp +++ b/radiant/textures.cpp @@ -371,7 +371,7 @@ void qtexture_realise( qtexture_t& texture, const TextureKey& key ){ gl().glTexParameteri( GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 0); //this or mipmaps are required for samplerCube to work // fix non quadratic, varying sizes; GL_TEXTURE_CUBE_MAP requires this unsigned int size = 0; - for( const auto img : images ) + for( const auto *img : images ) size = std::max( { size, img->getWidth(), img->getHeight() } ); for( int i = 0; i < 6; ++i ){ const Image& img = *images[i]; @@ -435,7 +435,7 @@ class TexturesMap final : public TexturesCache : m_cache( cache ){ } qtexture_t* construct( const TextureKey& key ){ - qtexture_t* texture = new qtexture_t( key.first, key.second.c_str() ); + auto *texture = new qtexture_t( key.first, key.second.c_str() ); if ( m_cache->realised() ) { qtexture_realise( *texture, key ); } diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 0c7c8d29..50fbc1f1 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1102,7 +1102,7 @@ void TextureBrowser_ToggleHideUnused(){ } void TextureGroups_constructTreeModel( TextureGroups groups, QStandardItemModel* model ){ - auto root = model->invisibleRootItem(); + auto *root = model->invisibleRootItem(); TextureGroups::const_iterator i = groups.begin(); while ( i != groups.end() ) @@ -1115,13 +1115,13 @@ void TextureGroups_constructTreeModel( TextureGroups groups, QStandardItemModel* if ( firstUnderscore != 0 && next != groups.end() && string_equal_start( ( *next ).c_str(), dirRoot ) ) { - auto subroot = new QStandardItem( CopiedString( StringRange( dirName, firstUnderscore ) ).c_str() ); + auto *subroot = new QStandardItem( CopiedString( StringRange( dirName, firstUnderscore ) ).c_str() ); root->appendRow( subroot ); // keep going... while ( i != groups.end() && string_equal_start( ( *i ).c_str(), dirRoot ) ) { - auto item = new QStandardItem( ( *i ).c_str() ); + auto *item = new QStandardItem( ( *i ).c_str() ); item->setData( ( *i ).c_str(), Qt::ItemDataRole::ToolTipRole ); subroot->appendRow( item ); ++i; @@ -1129,7 +1129,7 @@ void TextureGroups_constructTreeModel( TextureGroups groups, QStandardItemModel* } else { - auto item = new QStandardItem( dirName ); + auto *item = new QStandardItem( dirName ); item->setData( dirName, Qt::ItemDataRole::ToolTipRole ); root->appendRow( item ); ++i; @@ -1138,7 +1138,7 @@ void TextureGroups_constructTreeModel( TextureGroups groups, QStandardItemModel* } void TextureGroups_constructTreeModel_childless( TextureGroups groups, QStandardItemModel* model ){ - auto root = model->invisibleRootItem(); + auto *root = model->invisibleRootItem(); TextureGroups::const_iterator i = groups.begin(); while ( i != groups.end() ) @@ -1148,7 +1148,7 @@ void TextureGroups_constructTreeModel_childless( TextureGroups groups, QStandard const char* pakNameEnd = strrchr( dirName, '.' ); ASSERT_MESSAGE( pakName != 0 && pakNameEnd != 0 && pakNameEnd > pakName, "interesting wad path" ); { - auto item = new QStandardItem( CopiedString( StringRange( pakName + 1, pakNameEnd ) ).c_str() ); + auto *item = new QStandardItem( CopiedString( StringRange( pakName + 1, pakNameEnd ) ).c_str() ); item->setData( dirName, Qt::ItemDataRole::ToolTipRole ); root->appendRow( item ); ++i; @@ -1175,7 +1175,7 @@ void TextureBrowser_constructTreeStore(){ TextureGroups groups; TextureGroups_constructTreeView( groups ); - auto model = new QStandardItemModel( g_TexBro.m_treeView ); //. ? delete old or clear() & reuse + auto *model = new QStandardItemModel( g_TexBro.m_treeView ); //. ? delete old or clear() & reuse // store display name in column #0 and load path in data( Qt::ItemDataRole::ToolTipRole ) // tooltips are only wanted for TextureBrowser::wads, but well @@ -1232,7 +1232,7 @@ void TextureBrowser_createTreeViewTree(){ } static QMenu* TextureBrowser_constructViewMenu(){ - QMenu *menu = new QMenu( "View" ); + auto *menu = new QMenu( "View" ); menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value ); @@ -1275,7 +1275,7 @@ XmlTagBuilder TagBuilder; static QMenu* TextureBrowser_constructTagsMenu(){ - auto menu = new QMenu( "Tags" ); + auto *menu = new QMenu( "Tags" ); menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value ); @@ -1330,7 +1330,7 @@ void TextureBrowser_tagsSetCheckboxesForShader( const char *shader ){ for( int i = 0; i < g_TexBro.m_tagsListWidget->count(); ++i ) { - auto item = g_TexBro.m_tagsListWidget->item( i ); + auto *item = g_TexBro.m_tagsListWidget->item( i ); item->setCheckState( contains( item->data( Qt::ItemDataRole::DisplayRole ).toByteArray() )? Qt::CheckState::Checked : Qt::CheckState::Unchecked ); } } @@ -1500,7 +1500,7 @@ void TextureBrowser_addTag(){ while( g_TexBro.m_all_tags.contains( tag.c_str() ) ) tag( "NewTag", ++index ); - auto item = new QListWidgetItem( tag.c_str() ); + auto *item = new QListWidgetItem( tag.c_str() ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren ); item->setCheckState( Qt::CheckState::Unchecked ); // is needed to see checkbox g_TexBro.m_tagsListWidget->addItem( item ); @@ -1523,7 +1523,7 @@ void TextureBrowser_deleteTag(){ const auto selected = g_TexBro.m_tagsListWidget->selectedItems(); if ( !selected.empty() ) { if ( eIDYES == qt_MessageBox( g_TexBro.m_parent, "Are you sure you want to delete the selected tags?", "Delete Tag", EMessageBoxType::Question ) ) { - for( auto item : selected ){ + for( auto *item : selected ){ auto tag = item->text().toLatin1(); delete item; TagBuilder.DeleteTag( tag.constData() ); @@ -1650,7 +1650,7 @@ protected: } bool event( QEvent *event ) override { if( event->type() == QEvent::ShortcutOverride ){ - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); if( keyEvent->key() == Qt::Key_Escape ){ clear(); event->accept(); @@ -1758,13 +1758,13 @@ QWidget* TextureBrowser_constructWindow( QWidget* toplevel ){ g_TexBro.m_parent = toplevel; - QSplitter *splitter = new QSplitter; - QWidget *containerWidgetLeft = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget - QWidget *containerWidgetRight = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget + auto *splitter = new QSplitter; + auto *containerWidgetLeft = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget + auto *containerWidgetRight = new QWidget; // Adding a QLayout to a QSplitter is not supported, use proxy widget splitter->addWidget( containerWidgetLeft ); splitter->addWidget( containerWidgetRight ); - QVBoxLayout *vbox = new QVBoxLayout( containerWidgetLeft ); - QHBoxLayout *hbox = new QHBoxLayout( containerWidgetRight ); + auto *vbox = new QVBoxLayout( containerWidgetLeft ); + auto *hbox = new QHBoxLayout( containerWidgetRight ); hbox->setContentsMargins( 0, 0, 0, 0 ); vbox->setContentsMargins( 0, 0, 0, 0 ); @@ -1773,7 +1773,7 @@ QWidget* TextureBrowser_constructWindow( QWidget* toplevel ){ { // menu bar - QToolBar *toolbar = new QToolBar; + auto *toolbar = new QToolBar; vbox->addWidget( toolbar ); QMenu* menu_view = TextureBrowser_constructViewMenu(); @@ -1814,7 +1814,7 @@ QWidget* TextureBrowser_constructWindow( QWidget* toplevel ){ hbox->addWidget( g_TexBro.m_gl_widget ); } { // gl_widget scrollbar - auto scroll = g_TexBro.m_texture_scroll = new QScrollBar; + auto *scroll = g_TexBro.m_texture_scroll = new QScrollBar; hbox->addWidget( scroll ); QObject::connect( scroll, &QAbstractSlider::valueChanged, []( int value ){ @@ -1838,7 +1838,7 @@ QWidget* TextureBrowser_constructWindow( QWidget* toplevel ){ TagBuilder.GetAllTags( g_TexBro.m_all_tags ); for ( const CopiedString& tag : g_TexBro.m_all_tags ){ - auto item = new QListWidgetItem( tag.c_str() ); + auto *item = new QListWidgetItem( tag.c_str() ); item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren ); item->setCheckState( Qt::CheckState::Unchecked ); // is needed to see checkbox g_TexBro.m_tagsListWidget->addItem( item ); diff --git a/radiant/watchbsp.cpp b/radiant/watchbsp.cpp index f09f7c5a..261e5c62 100644 --- a/radiant/watchbsp.cpp +++ b/radiant/watchbsp.cpp @@ -356,19 +356,19 @@ static void saxStartElement( message_info_t *data, const xmlChar *name, const xm data->pGeometry->saxStartElement( data, name, attrs ); } else if ( strcmp( reinterpret_cast( name ), "select" ) == 0 ) { - CSelectMsg *pSelect = new CSelectMsg(); + auto *pSelect = new CSelectMsg(); data->geometry_depth = data->recurse; data->pGeometry = pSelect; data->pGeometry->saxStartElement( data, name, attrs ); } else if ( strcmp( reinterpret_cast( name ), "pointmsg" ) == 0 ) { - CPointMsg *pPoint = new CPointMsg(); + auto *pPoint = new CPointMsg(); data->geometry_depth = data->recurse; data->pGeometry = pPoint; data->pGeometry->saxStartElement( data, name, attrs ); } else if ( strcmp( reinterpret_cast( name ), "windingmsg" ) == 0 ) { - CWindingMsg *pWinding = new CWindingMsg(); + auto *pWinding = new CWindingMsg(); data->geometry_depth = data->recurse; data->pGeometry = pWinding; data->pGeometry->saxStartElement( data, name, attrs ); @@ -697,7 +697,7 @@ void CWatchBSP::RoutineProcessing(){ // this is game dependant const auto [exe, args] = [&](){ if( string_equal( gamemode_get(), "mp" ) ){ - if( const auto exe = g_engineExecutableMP.string(); !exe.empty() ) + if( auto exe = g_engineExecutableMP.string(); !exe.empty() ) return std::pair( std::move( exe ), g_engineArgsMP.string() ); } return std::pair( g_engineExecutable.string(), g_engineArgs.string() ); diff --git a/radiant/winding.cpp b/radiant/winding.cpp index f87848b9..bd68bd74 100644 --- a/radiant/winding.cpp +++ b/radiant/winding.cpp @@ -230,13 +230,9 @@ inline PlaneClassification Winding_ClassifyDistance( const double distance, cons /// or flipped && winding is completely FRONT or ON bool Winding_TestPlane( const Winding& winding, const Plane3& plane, bool flipped ){ const int test = ( flipped ) ? ePlaneBack : ePlaneFront; - for ( Winding::const_iterator i = winding.begin(); i != winding.end(); ++i ) - { - if ( test == Winding_ClassifyDistance( plane3_distance_to_point( plane, ( *i ).vertex ), ON_EPSILON ) ) { - return false; - } - } - return true; + return std::ranges::none_of( winding, [&]( const WindingVertex& v ){ + return test == Winding_ClassifyDistance( plane3_distance_to_point( plane, v.vertex ), ON_EPSILON ); + } ); } /// \brief Returns true if any point in \p w1 is in front of plane2, or any point in \p w2 is in front of plane1 @@ -246,9 +242,9 @@ bool Winding_PlanesConcave( const Winding& w1, const Winding& w2, const Plane3& brushsplit_t Winding_ClassifyPlane( const Winding& winding, const Plane3& plane ){ brushsplit_t split; - for ( Winding::const_iterator i = winding.begin(); i != winding.end(); ++i ) + for ( const auto& v : winding ) { - ++split.counts[Winding_ClassifyDistance( plane3_distance_to_point( plane, ( *i ).vertex ), ON_EPSILON )]; + ++split.counts[Winding_ClassifyDistance( plane3_distance_to_point( plane, v.vertex ), ON_EPSILON )]; } return split; } diff --git a/radiant/windowobservers.cpp b/radiant/windowobservers.cpp index 5a51299c..b15e6cb1 100644 --- a/radiant/windowobservers.cpp +++ b/radiant/windowobservers.cpp @@ -38,7 +38,7 @@ WindowObservers g_window_observers; inline void WindowObservers_OnModifierDown( WindowObservers& observers, ModifierFlags type ){ g_modifier_state = bitfield_enable( g_modifier_state, type ); - for ( auto observer : observers ) + for ( auto *observer : observers ) { observer->onModifierDown( type ); } @@ -46,7 +46,7 @@ inline void WindowObservers_OnModifierDown( WindowObservers& observers, Modifier inline void WindowObservers_OnModifierUp( WindowObservers& observers, ModifierFlags type ){ g_modifier_state = bitfield_disable( g_modifier_state, type ); - for ( auto observer : observers ) + for ( auto *observer : observers ) { observer->onModifierUp( type ); } @@ -58,7 +58,7 @@ class : public QObject protected: bool eventFilter( QObject *obj, QEvent *event ) override { if( event->type() == QEvent::KeyPress ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); switch ( keyEvent->key() ) { case Qt::Key_Alt: @@ -76,7 +76,7 @@ protected: } } else if( event->type() == QEvent::KeyRelease ) { - QKeyEvent *keyEvent = static_cast( event ); + auto *keyEvent = static_cast( event ); switch ( keyEvent->key() ) { case Qt::Key_Alt: @@ -121,7 +121,7 @@ protected: if( event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove || event->type() == QEvent::MouseButtonRelease ) { - QMouseEvent *mouseEvent = static_cast( event ); + auto *mouseEvent = static_cast( event ); WindowObservers_UpdateModifiers( g_window_observers, modifiers_for_state( mouseEvent->modifiers() ) ); } return QObject::eventFilter( obj, event ); // standard event processing diff --git a/tools/quake3/common/vfs.cpp b/tools/quake3/common/vfs.cpp index 65d412b7..84cd1da3 100644 --- a/tools/quake3/common/vfs.cpp +++ b/tools/quake3/common/vfs.cpp @@ -141,10 +141,9 @@ void vfsInitDirectory( const char *path ){ GDir *dir; const auto path_is_forbidden = []( const char *path ){ - for ( const auto& forbidden : g_strForbiddenDirs ) - if ( matchpattern( path_get_filename_start( path ), forbidden.c_str(), TRUE ) ) - return true; - return false; + return std::ranges::any_of( g_strForbiddenDirs, [path]( const CopiedString& forbidden ){ + return matchpattern( path_get_filename_start( path ), forbidden.c_str(), TRUE ); + } ); }; { @@ -183,7 +182,7 @@ void vfsInitDirectory( const char *path ){ // sort paks in ascending order // pakFiles are then prepended to the list, reversing the order // thus later (zzz) pak content have priority over earlier, just like in engine - std::sort( paks.begin(), paks.end(), + std::ranges::sort( paks, []( const char* a, const char* b ){ return string_compare_nocase_upper( a, b ) < 0; } ); @@ -199,10 +198,10 @@ void vfsInitDirectory( const char *path ){ std::vector vfsListShaderFiles( const char *shaderPath ){ std::vector list; const auto insert = [&list]( const char *name ){ - for( const CopiedString& str : list ) - if( striEqual( str.c_str(), name ) ) - return; - list.emplace_back( name ); + if( std::ranges::none_of( list, [name]( const CopiedString& str ){ + return striEqual( str.c_str(), name ); + } ) ) + list.emplace_back( name ); }; /* search in dirs */ for ( const auto& strdir : g_strDirs ){ diff --git a/tools/quake3/q3map2/autopk3.cpp b/tools/quake3/q3map2/autopk3.cpp index 59ca6231..478e5079 100644 --- a/tools/quake3/q3map2/autopk3.cpp +++ b/tools/quake3/q3map2/autopk3.cpp @@ -484,7 +484,7 @@ int pk3BSPMain( Args& args ){ /* ignore bogus paths */ if ( !strEqual( token, "-" ) && !striEqual( token, "full" ) ) { char* const skysidestring = token + strcatQ( token, "_@@.tga", std::size( token ) ) - 6; - for( const auto side : { "up", "dn", "lf", "rt", "bk", "ft" } ){ + for( const auto *side : { "up", "dn", "lf", "rt", "bk", "ft" } ){ memcpy( skysidestring, side, 2 ); tex2list( pk3Textures, ex.textures, NULL ); } @@ -866,7 +866,7 @@ int repackBSPMain( Args& args ){ /* ignore bogus paths */ if ( !strEqual( token, "-" ) && !striEqual( token, "full" ) ) { char* const skysidestring = token + strcatQ( token, "_@@.tga", std::size( token ) ) - 6; - for( const auto side : { "up", "dn", "lf", "rt", "bk", "ft" } ){ + for( const auto *side : { "up", "dn", "lf", "rt", "bk", "ft" } ){ memcpy( skysidestring, side, 2 ); tex2list( pk3Textures, ex.textures, &rex.textures ); } diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index 56ff189a..0b495116 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -54,7 +54,7 @@ static void autocaulk_write(){ fprintf( file, "%i ", b.brushNum ); const shaderInfo_t* contentShader = b.contentShader; const bool globalFog = ( contentShader->compileFlags & C_FOG ) - && std::all_of( b.sides.cbegin(), b.sides.cend(), []( const side_t& side ){ return side.visibleHull.empty(); } ); + && std::ranges::all_of( b.sides, []( const side_t& side ){ return side.visibleHull.empty(); } ); for( const side_t& side : b.sides ){ if( !side.visibleHull.empty() || ( side.compileFlags & C_NODRAW ) || globalFog ){ fprintf( file, "-" ); @@ -206,7 +206,7 @@ static void SetCloneModelNumbers(){ entities[ i ].setKeyValue( "model", modelValue ); /* nuke the brushes/patches for this entity (fixme: leak!) */ - brushlist_t *leak = new brushlist_t( std::move( entities[ i ].brushes ) ); // are brushes referenced elsewhere, so we do not nuke them really? + auto *leak = new brushlist_t( std::move( entities[ i ].brushes ) ); // are brushes referenced elsewhere, so we do not nuke them really? entities[ i ].patches = NULL; } } diff --git a/tools/quake3/q3map2/convert_json.cpp b/tools/quake3/q3map2/convert_json.cpp index 4b18ea9c..ad3afb20 100644 --- a/tools/quake3/q3map2/convert_json.cpp +++ b/tools/quake3/q3map2/convert_json.cpp @@ -36,6 +36,7 @@ #include "rapidjson/prettywriter.h" #include +#include #define for_indexed(...) for_indexed_v(i, __VA_ARGS__) #define for_indexed_v(v, ...) if (std::size_t v = -1) for (__VA_ARGS__) if ((++v, true)) @@ -137,10 +138,10 @@ static void write_json( const char *directory ){ { int flags = shader.surfaceFlags; std::map map; // decompose flags - for( auto parm = g_game->surfaceParms.crbegin(); parm != g_game->surfaceParms.crend(); ++parm ){ // find known flags // traverse backwards to try fatter material flags 1st - if( parm->surfaceFlags == ( flags & parm->surfaceFlags ) && parm->surfaceFlags != 0 ){ - flags &= ~parm->surfaceFlags; - map.emplace( parm->surfaceFlags, parm->name ); + for( const auto& parm : std::ranges::reverse_view( g_game->surfaceParms ) ){ // find known flags // traverse backwards to try fatter material flags 1st + if( parm.surfaceFlags == ( flags & parm.surfaceFlags ) && parm.surfaceFlags != 0 ){ + flags &= ~parm.surfaceFlags; + map.emplace( parm.surfaceFlags, parm.name ); } } for( int bit = 0; bit < 32; ++bit ){ // handle unknown flags @@ -159,10 +160,10 @@ static void write_json( const char *directory ){ { int flags = shader.contentFlags; std::map map; // decompose flags - for( auto parm = g_game->surfaceParms.crbegin(); parm != g_game->surfaceParms.crend(); ++parm ){ // find known flags // traverse backwards to try fatter material flags 1st - if( parm->contentFlags == ( flags & parm->contentFlags ) && parm->contentFlags != 0 ){ - flags &= ~parm->contentFlags; - map.emplace( parm->contentFlags, parm->name ); + for( const auto& parm : std::ranges::reverse_view( g_game->surfaceParms ) ){ // find known flags // traverse backwards to try fatter material flags 1st + if( parm.contentFlags == ( flags & parm.contentFlags ) && parm.contentFlags != 0 ){ + flags &= ~parm.contentFlags; + map.emplace( parm.contentFlags, parm.name ); } } for( int bit = 0; bit < 32; ++bit ){ // handle unknown flags @@ -408,11 +409,11 @@ static void read_json( const char *directory, bool useFlagNames, bool skipUnknow auto&& item = bspShaders.emplace_back(); strcpy( item.shader, obj.value["shader"].GetString() ); for( auto&& flag : obj.value["surfaceFlags"].GetObj() ){ - auto name = flag.name.GetString(); - auto value = flag.value.GetString(); + const auto *name = flag.name.GetString(); + const auto *value = flag.value.GetString(); if( useFlagNames ){ auto&& parms = g_game->surfaceParms; - auto found = std::find_if( parms.begin(), parms.end(), [name]( const auto& parm ){ return striEqual( parm.name, name ); } ); + auto found = std::ranges::find_if( parms, [name]( const auto& parm ){ return striEqual( parm.name, name ); } ); if( found != parms.end() ){ item.surfaceFlags |= found->surfaceFlags; } @@ -428,11 +429,11 @@ static void read_json( const char *directory, bool useFlagNames, bool skipUnknow item.surfaceFlags |= strtoul( value, nullptr, 0 ); } for( auto&& flag : obj.value["contentFlags"].GetObj() ){ - auto name = flag.name.GetString(); - auto value = flag.value.GetString(); + const auto *name = flag.name.GetString(); + const auto *value = flag.value.GetString(); if( useFlagNames ){ auto&& parms = g_game->surfaceParms; - auto found = std::find_if( parms.begin(), parms.end(), [name]( const auto& parm ){ return striEqual( parm.name, name ); } ); + auto found = std::ranges::find_if( parms, [name]( const auto& parm ){ return striEqual( parm.name, name ); } ); if( found != parms.end() ){ item.contentFlags |= found->contentFlags; } diff --git a/tools/quake3/q3map2/image.cpp b/tools/quake3/q3map2/image.cpp index 40d9243c..c5051737 100644 --- a/tools/quake3/q3map2/image.cpp +++ b/tools/quake3/q3map2/image.cpp @@ -273,7 +273,7 @@ const image_t *ImageLoad( const char *name ){ } /* try to find existing image */ - if ( auto img = ImageFind( name ) ) { + if ( const auto *img = ImageFind( name ) ) { return img; } diff --git a/tools/quake3/q3map2/light.cpp b/tools/quake3/q3map2/light.cpp index 7abf29fb..b8599b67 100644 --- a/tools/quake3/q3map2/light.cpp +++ b/tools/quake3/q3map2/light.cpp @@ -129,7 +129,7 @@ public: SkyProbes( const String64& skyParmsImageBase ){ if( !skyParmsImageBase.empty() ){ std::vector images; - for( const auto suffix : { "_lf", "_rt", "_ft", "_bk", "_up", "_dn" } ) + for( const auto *suffix : { "_lf", "_rt", "_ft", "_bk", "_up", "_dn" } ) { if( nullptr == images.emplace_back( ImageLoad( StringStream<64>( skyParmsImageBase, suffix ) ) ) ){ Sys_Warning( "Couldn't find image %s\n", StringStream<64>( skyParmsImageBase, suffix ).c_str() ); @@ -304,7 +304,7 @@ static void CreateSkyLights( const skylight_t& skylight, const Vector3& color, f sun.color /= max; } - std::for_each( suns.begin(), suns.end(), CreateSunLight ); + std::ranges::for_each( suns, CreateSunLight ); } @@ -597,9 +597,9 @@ static void CreateSurfaceLights(){ /* sunlight? */ if ( !si->suns.empty() && !nss ) { - shaderInfo_t* si_ = const_cast( si ); /* FIXME: hack! */ + auto* si_ = const_cast( si ); /* FIXME: hack! */ Sys_FPrintf( SYS_VRB, "Sun: %s\n", si->shader.c_str() ); - std::for_each( si_->suns.begin(), si_->suns.end(), CreateSunLight ); + std::ranges::for_each( si_->suns, CreateSunLight ); si_->suns.clear(); /* FIXME: hack! */ } diff --git a/tools/quake3/q3map2/light_trace.cpp b/tools/quake3/q3map2/light_trace.cpp index 8eb3c7a6..15a7d127 100644 --- a/tools/quake3/q3map2/light_trace.cpp +++ b/tools/quake3/q3map2/light_trace.cpp @@ -1001,7 +1001,7 @@ static void PopulateWithPicoModel( int castShadows, const std::vectorgetShaderName() ); diff --git a/tools/quake3/q3map2/model.cpp b/tools/quake3/q3map2/model.cpp index a1fa4a03..89c655cf 100644 --- a/tools/quake3/q3map2/model.cpp +++ b/tools/quake3/q3map2/model.cpp @@ -347,9 +347,8 @@ std::vector LoadModelWalker( const char *name, int frame ) AssModel *model = LoadModel( name, frame ); std::vector vector; if( model != nullptr ) - std::for_each( model->m_meshes.begin(), model->m_meshes.end(), [&vector]( const auto& val ){ + for( const auto& val : model->m_meshes ) vector.push_back( &val ); - } ); return vector; } diff --git a/tools/quake3/q3map2/portals.cpp b/tools/quake3/q3map2/portals.cpp index e11e0716..48c4fe5a 100644 --- a/tools/quake3/q3map2/portals.cpp +++ b/tools/quake3/q3map2/portals.cpp @@ -373,7 +373,7 @@ static void SplitNodePortals( node_t *node ){ // the winding is split p->winding.clear(); - portal_t *new_portal = new portal_t( *p ); // AllocPortal() + auto *new_portal = new portal_t( *p ); // AllocPortal() new_portal->winding.swap( backwinding ); p->winding.swap( frontwinding ); diff --git a/tools/quake3/q3map2/prtfile.cpp b/tools/quake3/q3map2/prtfile.cpp index d3a4a1f4..c8422b71 100644 --- a/tools/quake3/q3map2/prtfile.cpp +++ b/tools/quake3/q3map2/prtfile.cpp @@ -30,6 +30,7 @@ /* dependencies */ #include "q3map2.h" +#include @@ -239,12 +240,12 @@ static void WriteFaceFile_r( const node_t *node ){ else { fprintf( pf, "%zu %i ", w.size(), p->nodes[1]->cluster ); - for ( winding_t::const_reverse_iterator point = w.crbegin(); point != w.crend(); ++point ) + for ( const Vector3& point : std::ranges::reverse_view( w ) ) { fprintf( pf, "(" ); - WriteFloat( pf, point->x() ); - WriteFloat( pf, point->y() ); - WriteFloat( pf, point->z() ); + WriteFloat( pf, point.x() ); + WriteFloat( pf, point.y() ); + WriteFloat( pf, point.z() ); fprintf( pf, ") " ); } fprintf( pf, "\n" ); diff --git a/tools/quake3/q3map2/shaders.cpp b/tools/quake3/q3map2/shaders.cpp index 5ef40965..56e8a803 100644 --- a/tools/quake3/q3map2/shaders.cpp +++ b/tools/quake3/q3map2/shaders.cpp @@ -1877,10 +1877,7 @@ void LoadShaderInfo(){ { /* check for duplicate entries */ const auto contains = [&shaderFiles]( const char *file ){ - for( const CopiedString& str : shaderFiles ) - if( striEqual( str.c_str(), file ) ) - return true; - return false; + return std::ranges::any_of( shaderFiles, [file]( const CopiedString& str ){ return striEqual( str.c_str(), file ); } ); }; if( !path_extension_is( token , "shader" ) ) diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index f0f9149d..55614aa1 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -741,7 +741,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const /* ydnar: sky hack/fix for GL_CLAMP borders on ati cards */ if ( skyFixHack && !si->skyParmsImageBase.empty() ) { //% Sys_FPrintf( SYS_VRB, "Enabling sky hack for shader %s using env %s\n", si->shader, si->skyParmsImageBase ); - for( const auto suffix : { "_lf", "_rt", "_ft", "_bk", "_up", "_dn" } ) + for( const auto *suffix : { "_lf", "_rt", "_ft", "_bk", "_up", "_dn" } ) DrawSurfaceForShader( String64( si->skyParmsImageBase, suffix ) ); } @@ -3112,7 +3112,7 @@ static void VolumeColorMods( const entity_t& e, mapDrawSurface_t *ds ){ /* iterate verts */ for ( bspDrawVert_t& vert : Span( ds->verts, ds->numVerts ) ) { - if( std::none_of( b->sides.cbegin(), b->sides.cend(), [&vert]( const side_t& side ){ + if( std::ranges::none_of( b->sides, [&vert]( const side_t& side ){ return plane3_distance_to_point( mapplanes[ side.planenum ].plane, vert.xyz ) > 1.0f; } ) ) /* point-plane test */ /* apply colormods */ ColorMod( b->contentShader->colorMod, 1, &vert ); diff --git a/tools/quake3/q3map2/surface_meta.cpp b/tools/quake3/q3map2/surface_meta.cpp index 50fba83f..79ac356f 100644 --- a/tools/quake3/q3map2/surface_meta.cpp +++ b/tools/quake3/q3map2/surface_meta.cpp @@ -33,7 +33,6 @@ #include "tjunction.h" #include "timer.h" #include -#include const Plane3f c_spatial_sort_plane( 0.786868, 0.316861, 0.529564, 0 ); @@ -253,10 +252,10 @@ static void metaTriangle_insert( metaTriangle_t& src, std::arraym_triangles.empty() && !src.m_vertices[2]->m_triangles.empty() ) { /* find common triangle */ - for( const auto t1 : src.m_vertices[0]->m_triangles ){ - for( const auto t2 : src.m_vertices[1]->m_triangles ){ + for( const auto *t1 : src.m_vertices[0]->m_triangles ){ + for( const auto *t2 : src.m_vertices[1]->m_triangles ){ if( t1 == t2 ){ - for( const auto t3 : src.m_vertices[2]->m_triangles ){ + for( const auto *t3 : src.m_vertices[2]->m_triangles ){ if( t1 == t3 ){ if( CompareMetaTriangles::equal( src, *t1 ) ){ // equal to src Sys_Warning( "Duplicate or Flipped triangle: (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f)\n", @@ -275,7 +274,7 @@ static void metaTriangle_insert( metaTriangle_t& src, std::arraym_triangles.push_back( &newTriangle ); } @@ -1166,7 +1165,7 @@ void SmoothMetaTriangles(){ struct VT{ metaVertex_t *vertex; metaTriangle_t *triangle; float angle{}; bool skipped{}; bool smoothed{}; Vector3 newnormal{ 0 }; }; std::vector verts; for( auto& v : list ) - for( auto* t : v.m_triangles ) + for( auto *t : v.m_triangles ) verts.push_back( VT{ &v, t } ); /* get per-vertex smoothing angle */ for( auto& v : verts ) @@ -1223,7 +1222,7 @@ void SmoothMetaTriangles(){ smoothedVerts.push_back( v2.operator->() ); /* see if this normal has already been voted */ - if( std::none_of( votes.begin(), votes.end(), + if( std::ranges::none_of( votes, [normal = v2->vertex->normal]( const Vector3& vote ){ return vector3_equal_epsilon( normal, vote, EQUAL_NORMAL_EPSILON ); } ) ) @@ -1249,14 +1248,14 @@ void SmoothMetaTriangles(){ } } /* reconstruct meta data from smoothed verts */ - if( std::any_of( verts.cbegin(), verts.cend(), []( const VT& vt ){ return vt.smoothed; } ) ){ + if( std::ranges::any_of( verts, std::identity{}, &VT::smoothed ) ){ decltype( list ) newlist; for( auto& v : verts ){ bspDrawVert_t newv = *v.vertex; if( v.smoothed ) newv.normal = v.newnormal; - auto it = std::find_if( newlist.begin(), newlist.end(), [&newv]( const metaVertex_t& v ){ + auto it = std::ranges::find_if( newlist, [&newv]( const metaVertex_t& v ){ return bspDrawVert_equal( newv, v ); } ); if( it == newlist.end() ){ /* insert vertex */ @@ -1266,7 +1265,7 @@ void SmoothMetaTriangles(){ } /* link vertex <> triangle */ it->m_triangles.push_back( v.triangle ); - *std::find( v.triangle->m_vertices.begin(), v.triangle->m_vertices.end(), v.vertex ) = it.operator->(); + *std::ranges::find( v.triangle->m_vertices, v.vertex ) = it.operator->(); } list.swap( newlist ); } @@ -1569,7 +1568,7 @@ static void MetaTrianglesToSurface( int *fOld, int *numAdded ){ for( metaTriangle_t *tri : groupvert.m_triangles ){ if( tri->si != nullptr && CompareMetaTriangles::equal( *tri, triangle ) // note: triangle.si must be still there for comparison - && std::find( testCloud.cbegin(), testCloud.cend(), tri ) == testCloud.cend() ){ + && std::ranges::find( testCloud, tri ) == testCloud.cend() ){ testCloud.push_back( tri ); } } @@ -1578,7 +1577,7 @@ static void MetaTrianglesToSurface( int *fOld, int *numAdded ){ /* mark triangle as used */ triangle.si = NULL; /* remove from cloud */ - if( auto it = std::find( testCloud.cbegin(), testCloud.cend(), &triangle ); it != testCloud.cend() ){ + if( auto it = std::ranges::find( testCloud, &triangle ); it != testCloud.cend() ){ testCloud.erase( it ); } #if 0 diff --git a/tools/quake3/q3map2/tjunction.cpp b/tools/quake3/q3map2/tjunction.cpp index 5950a4dc..574354cc 100644 --- a/tools/quake3/q3map2/tjunction.cpp +++ b/tools/quake3/q3map2/tjunction.cpp @@ -31,6 +31,7 @@ /* dependencies */ #include "q3map2.h" #include "tjunction.h" +#include @@ -331,22 +332,22 @@ static void FixSurfaceJunctions( mapDrawSurface_t& ds ) { }; if( start < end ){ - for( auto p = e.points.cbegin(); p != e.points.cend(); ++p ){ - if( p->intercept > start + ON_EPSILON ){ - if ( p->intercept > end - ON_EPSILON ) + for( const auto& p : e.points ){ + if( p.intercept > start + ON_EPSILON ){ + if ( p.intercept > end - ON_EPSILON ) break; else - insert_this_point( *p ); + insert_this_point( p ); } } } else{ - for( auto p = e.points.crbegin(); p != e.points.crend(); ++p ){ - if( p->intercept < start - ON_EPSILON ){ - if( p->intercept < end + ON_EPSILON ) + for( const auto& p : std::ranges::reverse_view( e.points ) ){ + if( p.intercept < start - ON_EPSILON ){ + if( p.intercept < end + ON_EPSILON ) break; else - insert_this_point( *p ); + insert_this_point( p ); } } } @@ -542,7 +543,7 @@ void FixTJunctions( const entity_t& ent ){ const size_t axialEdgeLines = edgeLines.size(); // sort the non-axial edges by length - std::sort( originalEdges.begin(), originalEdges.end(), []( const originalEdge_t& a, const originalEdge_t& b ){ + std::ranges::sort( originalEdges, []( const originalEdge_t& a, const originalEdge_t& b ){ return a.length < b.length; } );