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;
|
} ) != 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 );
|
auto results = specialVehFeatures.equal_range( modelID );
|
||||||
for ( auto it = results.first; it != results.second; ++it )
|
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);
|
return std::move(pred);
|
||||||
}
|
}
|
||||||
|
@ -47,5 +47,5 @@ namespace SVF
|
|||||||
void DeleteFeature( int32_t cookie );
|
void DeleteFeature( int32_t cookie );
|
||||||
void DisableStockVehiclesForFeature( Feature feature );
|
void DisableStockVehiclesForFeature( Feature feature );
|
||||||
bool ModelHasFeature( int32_t modelID, 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 foundFeature = false;
|
||||||
bool featureStatus = false;
|
bool featureStatus = false;
|
||||||
SVF::ForAllModelFeatures( modelID, [&]( SVF::Feature f ) {
|
SVF::ForAllModelFeatures( modelID, [&]( SVF::Feature f ) {
|
||||||
if ( foundFeature ) return;
|
|
||||||
|
|
||||||
if ( f == SVF::Feature::_INTERNAL_FORCE_DOUBLE_RWHEELS_OFF )
|
if ( f == SVF::Feature::_INTERNAL_FORCE_DOUBLE_RWHEELS_OFF )
|
||||||
{
|
{
|
||||||
foundFeature = true;
|
foundFeature = true;
|
||||||
featureStatus = false;
|
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;
|
foundFeature = true;
|
||||||
featureStatus = true;
|
featureStatus = true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} );
|
} );
|
||||||
if ( !foundFeature )
|
if ( !foundFeature )
|
||||||
{
|
{
|
||||||
|
@ -399,15 +399,17 @@ namespace FBISirenCoronaFix
|
|||||||
if ( f >= SVF::Feature::FBI_RANCHER_SIREN && f <= SVF::Feature::VICE_CHEETAH_SIREN )
|
if ( f >= SVF::Feature::FBI_RANCHER_SIREN && f <= SVF::Feature::VICE_CHEETAH_SIREN )
|
||||||
{
|
{
|
||||||
foundFeature = f;
|
foundFeature = f;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( foundFeature != SVF::Feature::NO_FEATURE )
|
if ( foundFeature != SVF::Feature::NO_FEATURE )
|
||||||
{
|
{
|
||||||
if ( foundFeature != SVF::Feature::VICE_CHEETAH_SIREN )
|
if ( foundFeature != SVF::Feature::VICE_CHEETAH_SIREN )
|
||||||
{
|
{
|
||||||
const CVector FBICAR_SIREN_POS = CVector(0.4f, 0.8f, 0.25f);
|
constexpr CVector FBICAR_SIREN_POS(0.4f, 0.8f, 0.25f);
|
||||||
const CVector FBIRANCH_SIREN_POS = CVector(0.5f, 1.12f, 0.5f);
|
constexpr CVector FBIRANCH_SIREN_POS(0.5f, 1.12f, 0.5f);
|
||||||
|
|
||||||
overridePosition = true;
|
overridePosition = true;
|
||||||
vecOverridePosition = foundFeature == SVF::Feature::FBI_WASHINGTON_SIREN ? FBICAR_SIREN_POS : FBIRANCH_SIREN_POS;
|
vecOverridePosition = foundFeature == SVF::Feature::FBI_WASHINGTON_SIREN ? FBICAR_SIREN_POS : FBIRANCH_SIREN_POS;
|
||||||
|
Loading…
Reference in New Issue
Block a user