build: Fix compiling with C++17 on Linux

This commit is contained in:
Arthurdead 2022-08-29 04:23:11 -03:00 committed by GitHub
parent 65bc5bd2fd
commit 457b9923f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View File

@ -15,6 +15,8 @@ $Configuration
// CPU feature macros, we may want to tune these before release.
$PreprocessorDefinitions "$BASE;JPH_USE_SSE4_1;JPH_USE_SSE4_2;JPH_USE_LZCNT;JPH_USE_TZCNT;JPH_USE_F16C;JPH_USE_FMADD"
$GCC_ExtraCompilerFlags "$BASE -msse4.1 -msse4.2 -mlzcnt -mf16c -mfma"
// We DO want to comment this line out for release, AVX 1 & 2 adoption isn't reliable enough yet
// $EnableEnhancedInstructionSet "Advanced Vector Extensions 2 (/arch:AVX2)" [$DEVELOPMENT_ONLY]
}

View File

@ -41,7 +41,7 @@
#include "tier1/tier1.h"
#include "tier1/strtools.h"
#include "tier1/interface.h"
#include "tier1/keyvalues.h"
#include "tier1/KeyValues.h"
#include "tier1/UtlStringMap.h"
#include "tier1/utlbuffer.h"

View File

@ -103,7 +103,14 @@ void JoltPhysicsFluidController::OnJoltPhysicsObjectDestroyed( JoltPhysicsObject
if ( pObject == m_pFluidObject )
m_pFluidObject = nullptr;
std::erase_if( m_ObjectsInShape, [pObject]( JoltPhysicsObject *pCachedObject ) { return pObject == pCachedObject; } );
for ( auto it = m_ObjectsInShape.begin(); it != m_ObjectsInShape.end(); it++ )
{
if ( *it == pObject )
{
m_ObjectsInShape.erase( it );
break;
}
}
}
//-------------------------------------------------------------------------------------------------

View File

@ -5,6 +5,11 @@
struct JoltPhysicsContactPair
{
JoltPhysicsContactPair( JoltPhysicsObject *pObject1, JoltPhysicsObject *pObject2 )
: pObject1(pObject1), pObject2(pObject2)
{
}
JoltPhysicsObject *pObject1 = nullptr;
JoltPhysicsObject *pObject2 = nullptr;
};

View File

@ -54,7 +54,8 @@ void JoltPhysicsObjectPairHash::RemoveObjectPair( void *pObject0, void *pObject1
bool JoltPhysicsObjectPairHash::IsObjectPairInHash( void *pObject0, void *pObject1 )
{
auto pair = CreateSortedPair( pObject0, pObject1 );
return m_PairHashes[ GetHashArrayIndex( PointerHasher{}( pair ) ) ].contains( pair );
auto &pairHashes = m_PairHashes[ GetHashArrayIndex( PointerHasher{}( pair ) ) ];
return pairHashes.find( pair ) != pairHashes.end();
}
void JoltPhysicsObjectPairHash::RemoveAllPairsForObject( void *pObject0 )
@ -71,7 +72,7 @@ void JoltPhysicsObjectPairHash::RemoveAllPairsForObject( void *pObject0 )
bool JoltPhysicsObjectPairHash::IsObjectInHash( void *pObject0 )
{
return m_Objects.contains( pObject0 );
return m_Objects.find( pObject0 ) != m_Objects.end();
}
//-------------------------------------------------------------------------------------------------