mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-25 14:52:30 +01:00
Small SVF refactor
This commit is contained in:
parent
f63425cff0
commit
0fa88b0260
@ -127,12 +127,15 @@ namespace SVF
|
||||
} ) != results.second;
|
||||
}
|
||||
|
||||
std::function<void(Feature)> ForAllModelFeatures( int32_t modelID, std::function<void(Feature)> pred )
|
||||
std::function<bool(Feature)> ForAllModelFeatures( int32_t modelID, std::function<bool(Feature)> pred )
|
||||
{
|
||||
auto results = specialVehFeatures.equal_range( modelID );
|
||||
for ( auto it = results.first; it != results.second; ++it )
|
||||
{
|
||||
pred(std::get<Feature>(it->second));
|
||||
if (!pred(std::get<Feature>(it->second)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return std::move(pred);
|
||||
}
|
||||
|
@ -47,5 +47,5 @@ namespace SVF
|
||||
void DeleteFeature( int32_t cookie );
|
||||
void DisableStockVehiclesForFeature( Feature feature );
|
||||
bool ModelHasFeature( int32_t modelID, Feature feature );
|
||||
std::function<void(Feature)> ForAllModelFeatures( int32_t modelID, std::function<void(Feature)> pred );
|
||||
std::function<bool(Feature)> ForAllModelFeatures( int32_t modelID, std::function<bool(Feature)> pred );
|
||||
};
|
@ -66,18 +66,19 @@ bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData )
|
||||
bool foundFeature = false;
|
||||
bool featureStatus = false;
|
||||
SVF::ForAllModelFeatures( modelID, [&]( SVF::Feature f ) {
|
||||
if ( foundFeature ) return;
|
||||
|
||||
if ( f == SVF::Feature::_INTERNAL_FORCE_DOUBLE_RWHEELS_OFF )
|
||||
{
|
||||
foundFeature = true;
|
||||
featureStatus = false;
|
||||
return false;
|
||||
}
|
||||
else if ( f == SVF::Feature::_INTERNAL_FORCE_DOUBLE_RWHEELS_ON )
|
||||
if ( f == SVF::Feature::_INTERNAL_FORCE_DOUBLE_RWHEELS_ON )
|
||||
{
|
||||
foundFeature = true;
|
||||
featureStatus = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} );
|
||||
if ( !foundFeature )
|
||||
{
|
||||
|
@ -399,15 +399,17 @@ namespace FBISirenCoronaFix
|
||||
if ( f >= SVF::Feature::FBI_RANCHER_SIREN && f <= SVF::Feature::VICE_CHEETAH_SIREN )
|
||||
{
|
||||
foundFeature = f;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} );
|
||||
|
||||
if ( foundFeature != SVF::Feature::NO_FEATURE )
|
||||
{
|
||||
if ( foundFeature != SVF::Feature::VICE_CHEETAH_SIREN )
|
||||
{
|
||||
const CVector FBICAR_SIREN_POS = CVector(0.4f, 0.8f, 0.25f);
|
||||
const CVector FBIRANCH_SIREN_POS = CVector(0.5f, 1.12f, 0.5f);
|
||||
constexpr CVector FBICAR_SIREN_POS(0.4f, 0.8f, 0.25f);
|
||||
constexpr CVector FBIRANCH_SIREN_POS(0.5f, 1.12f, 0.5f);
|
||||
|
||||
overridePosition = true;
|
||||
vecOverridePosition = foundFeature == SVF::Feature::FBI_WASHINGTON_SIREN ? FBICAR_SIREN_POS : FBIRANCH_SIREN_POS;
|
||||
|
Loading…
Reference in New Issue
Block a user