From 8150a7d9bcac2c9311b4935a8e167d77034c8e02 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 1 Jun 2020 22:17:46 -0700 Subject: [PATCH] Resolve conflicts with std::swap. --- cl_dll/cdll_util.cpp | 2 +- cl_dll/clientshadowmgr.cpp | 2 +- cl_dll/view_scene.cpp | 4 ++-- dlls/filters.cpp | 2 +- dlls/hl2_dll/npc_attackchopper.cpp | 4 ++-- dlls/hl2_dll/npc_combinecamera.cpp | 8 ++++---- dlls/hl2_dll/npc_turret_ceiling.cpp | 6 +++--- dlls/hltvdirector.cpp | 2 +- dlls/physconstraint.cpp | 2 +- dlls/props.cpp | 2 +- game_shared/gamerules.cpp | 2 +- game_shared/hl2mp/hl2mp_gamerules.cpp | 2 +- game_shared/sdk/sdk_gamerules.cpp | 2 +- utils/common/mstristrip.cpp | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cl_dll/cdll_util.cpp b/cl_dll/cdll_util.cpp index 9e426002..5506dc8f 100644 --- a/cl_dll/cdll_util.cpp +++ b/cl_dll/cdll_util.cpp @@ -828,7 +828,7 @@ static unsigned char ComputeDistanceFade( C_BaseEntity *pEntity, float flMinDist if( flMinDist > flMaxDist ) { - swap( flMinDist, flMaxDist ); + V_swap( flMinDist, flMaxDist ); } // If a negative value is provided for the min fade distance, then base it off the max. diff --git a/cl_dll/clientshadowmgr.cpp b/cl_dll/clientshadowmgr.cpp index c9ca24c8..a0908ec6 100644 --- a/cl_dll/clientshadowmgr.cpp +++ b/cl_dll/clientshadowmgr.cpp @@ -3459,7 +3459,7 @@ void CVisibleShadowList::PrioritySort() flLargestArea = m_ShadowsInView[nIndex].m_flArea; } } - swap( m_PriorityIndex[i], m_PriorityIndex[nLargestInd] ); + V_swap( m_PriorityIndex[i], m_PriorityIndex[nLargestInd] ); } } diff --git a/cl_dll/view_scene.cpp b/cl_dll/view_scene.cpp index 61eb91d8..90bbab96 100644 --- a/cl_dll/view_scene.cpp +++ b/cl_dll/view_scene.cpp @@ -507,8 +507,8 @@ void SortEntities( CRenderList::CEntry *pEntities, int nEntities ) { if( dists[i] > dists[i+stepSize] ) { - swap( pEntities[i], pEntities[i+stepSize] ); - swap( dists[i], dists[i+stepSize] ); + V_swap( pEntities[i], pEntities[i+stepSize] ); + V_swap( dists[i], dists[i+stepSize] ); if( i == 0 ) { diff --git a/dlls/filters.cpp b/dlls/filters.cpp index e5ff4536..2acbd097 100644 --- a/dlls/filters.cpp +++ b/dlls/filters.cpp @@ -503,7 +503,7 @@ bool CFilterEnemy::PassesProximityFilter( CBaseEntity *pCaller, CBaseEntity *pEn float flSmallerRadius = m_flRadius; if ( flSmallerRadius > flLargerRadius ) { - swap( flLargerRadius, flSmallerRadius ); + V_swap( flLargerRadius, flSmallerRadius ); } float flDist; diff --git a/dlls/hl2_dll/npc_attackchopper.cpp b/dlls/hl2_dll/npc_attackchopper.cpp index 069adf6e..f0da32c5 100644 --- a/dlls/hl2_dll/npc_attackchopper.cpp +++ b/dlls/hl2_dll/npc_attackchopper.cpp @@ -1669,7 +1669,7 @@ void CNPC_AttackHelicopter::ShootAtPlayer( const Vector &vBasePos, const Vector for ( i = 0; i < nActualTargets; ++i ) { int nSwap = random->RandomInt( 0, nActualTargets - 1 ); - swap( ppNearbyTargets[i], ppNearbyTargets[nSwap] ); + V_swap( ppNearbyTargets[i], ppNearbyTargets[nSwap] ); } // Just shoot where we're facing @@ -1906,7 +1906,7 @@ void CNPC_AttackHelicopter::ShootAtVehicle( const Vector &vBasePos, const Vector for ( i = 0; i < nActualTargets; ++i ) { int nSwap = random->RandomInt( 0, nActualTargets - 1 ); - swap( ppNearbyTargets[i], ppNearbyTargets[nSwap] ); + V_swap( ppNearbyTargets[i], ppNearbyTargets[nSwap] ); } // Just shoot where we're facing diff --git a/dlls/hl2_dll/npc_combinecamera.cpp b/dlls/hl2_dll/npc_combinecamera.cpp index b7f05da7..0883db2b 100644 --- a/dlls/hl2_dll/npc_combinecamera.cpp +++ b/dlls/hl2_dll/npc_combinecamera.cpp @@ -355,7 +355,7 @@ void CNPC_CombineCamera::Spawn() if (m_nOuterRadius < m_nInnerRadius) { - swap(m_nOuterRadius, m_nInnerRadius); + V_swap(m_nOuterRadius, m_nInnerRadius); } // Do we start active? @@ -1117,17 +1117,17 @@ void CNPC_CombineCamera::SetHeight(float height) if (mins.x > maxs.x) { - swap(mins.x, maxs.x); + V_swap(mins.x, maxs.x); } if (mins.y > maxs.y) { - swap(mins.y, maxs.y); + V_swap(mins.y, maxs.y); } if (mins.z > maxs.z) { - swap(mins.z, maxs.z); + V_swap(mins.z, maxs.z); } SetCollisionBounds(mins, maxs); diff --git a/dlls/hl2_dll/npc_turret_ceiling.cpp b/dlls/hl2_dll/npc_turret_ceiling.cpp index 1c097aed..14ff892c 100644 --- a/dlls/hl2_dll/npc_turret_ceiling.cpp +++ b/dlls/hl2_dll/npc_turret_ceiling.cpp @@ -1093,17 +1093,17 @@ void CNPC_CeilingTurret::SetHeight( float height ) if ( mins.x > maxs.x ) { - swap( mins.x, maxs.x ); + V_swap( mins.x, maxs.x ); } if ( mins.y > maxs.y ) { - swap( mins.y, maxs.y ); + V_swap( mins.y, maxs.y ); } if ( mins.z > maxs.z ) { - swap( mins.z, maxs.z ); + V_swap( mins.z, maxs.z ); } SetCollisionBounds( mins, maxs ); diff --git a/dlls/hltvdirector.cpp b/dlls/hltvdirector.cpp index 8645e62e..47a69317 100644 --- a/dlls/hltvdirector.cpp +++ b/dlls/hltvdirector.cpp @@ -555,7 +555,7 @@ void CHLTVDirector::CreateShotFromEvent( CGameEvent *event ) // if we show ineye view, show it more likely from killer if ( RandomFloat(0,1) > (bInEye?0.3f:0.7f) ) { - swap( attacker, victim ); + V_swap( attacker, victim ); } // hurting a victim is shown as chase more often diff --git a/dlls/physconstraint.cpp b/dlls/physconstraint.cpp index ea7d6294..63bb482f 100644 --- a/dlls/physconstraint.cpp +++ b/dlls/physconstraint.cpp @@ -830,7 +830,7 @@ IPhysicsConstraint *CPhysSlideConstraint::CreateConstraint( IPhysicsConstraintGr sliding.limitMax = DotProduct( axisDirection, m_axisEnd ); if ( sliding.limitMax < sliding.limitMin ) { - swap( sliding.limitMin, sliding.limitMax ); + V_swap( sliding.limitMin, sliding.limitMax ); } // expand limits to make initial position of the attached object valid diff --git a/dlls/props.cpp b/dlls/props.cpp index 0b4fda1a..a5695916 100644 --- a/dlls/props.cpp +++ b/dlls/props.cpp @@ -4571,7 +4571,7 @@ void CPropDoorRotating::Spawn() // that the model already be set. if ( IsHingeOnLeft() ) { - swap( m_angRotationOpenForward, m_angRotationOpenBack ); + V_swap( m_angRotationOpenForward, m_angRotationOpenBack ); } // Figure out our volumes of movement as this door opens diff --git a/game_shared/gamerules.cpp b/game_shared/gamerules.cpp index 2c681c78..0b9085e3 100644 --- a/game_shared/gamerules.cpp +++ b/game_shared/gamerules.cpp @@ -580,7 +580,7 @@ bool CGameRules::ShouldCollide( int collisionGroup0, int collisionGroup1 ) if ( collisionGroup0 > collisionGroup1 ) { // swap so that lowest is always first - swap(collisionGroup0,collisionGroup1); + V_swap(collisionGroup0,collisionGroup1); } #ifndef HL2MP diff --git a/game_shared/hl2mp/hl2mp_gamerules.cpp b/game_shared/hl2mp/hl2mp_gamerules.cpp index 4f403718..b1de8ca5 100644 --- a/game_shared/hl2mp/hl2mp_gamerules.cpp +++ b/game_shared/hl2mp/hl2mp_gamerules.cpp @@ -866,7 +866,7 @@ bool CHL2MPRules::ShouldCollide( int collisionGroup0, int collisionGroup1 ) if ( collisionGroup0 > collisionGroup1 ) { // swap so that lowest is always first - swap(collisionGroup0,collisionGroup1); + V_swap(collisionGroup0,collisionGroup1); } if ( (collisionGroup0 == COLLISION_GROUP_PLAYER || collisionGroup0 == COLLISION_GROUP_PLAYER_MOVEMENT) && diff --git a/game_shared/sdk/sdk_gamerules.cpp b/game_shared/sdk/sdk_gamerules.cpp index 0a65857d..41179dce 100644 --- a/game_shared/sdk/sdk_gamerules.cpp +++ b/game_shared/sdk/sdk_gamerules.cpp @@ -315,7 +315,7 @@ bool CSDKGameRules::ShouldCollide( int collisionGroup0, int collisionGroup1 ) if ( collisionGroup0 > collisionGroup1 ) { // swap so that lowest is always first - swap(collisionGroup0,collisionGroup1); + V_swap(collisionGroup0,collisionGroup1); } //Don't stand on COLLISION_GROUP_WEAPON diff --git a/utils/common/mstristrip.cpp b/utils/common/mstristrip.cpp index 98594fd8..8124c977 100644 --- a/utils/common/mstristrip.cpp +++ b/utils/common/mstristrip.cpp @@ -362,7 +362,7 @@ STRIPLIST::iterator FindBestCachedStrip(STRIPLIST *pstriplist, // make sure we keep the list in order and always pull off // the first dude. if(istriplistbest != pstriplist->begin()) - swap(*istriplistbest, *pstriplist->begin()); + V_swap(*istriplistbest, *pstriplist->begin()); return pstriplist->begin(); }