@@ -6797,47 +6797,54 @@ bool CClientGame::TriggerBrowserRequestResultEvent(const std::unordered_set<SStr
6797
6797
return GetRootEntity ()->CallEvent (" onClientBrowserWhitelistChange" , Arguments, false );
6798
6798
}
6799
6799
6800
- void CClientGame::RestreamModel (unsigned short usModel )
6800
+ bool CClientGame::RestreamModel (std:: uint16_t model )
6801
6801
{
6802
6802
// Is this a vehicle ID?
6803
- if (CClientVehicleManager::IsValidModel (usModel ))
6803
+ if (CClientVehicleManager::IsValidModel (model ))
6804
6804
{
6805
6805
// Stream the vehicles of that model out so we have no
6806
6806
// loaded when we do the restore. The streamer will
6807
6807
// eventually stream them back in with async loading.
6808
- m_pManager->GetVehicleManager ()->RestreamVehicles (usModel);
6809
- }
6808
+ m_pManager->GetVehicleManager ()->RestreamVehicles (model);
6810
6809
6810
+ return true ;
6811
+ }
6811
6812
// Is this an object ID?
6812
- else if (CClientObjectManager::IsValidModel (usModel ))
6813
+ else if (CClientObjectManager::IsValidModel (model ))
6813
6814
{
6814
- if (CClientPedManager::IsValidWeaponModel (usModel ))
6815
+ if (CClientPedManager::IsValidWeaponModel (model ))
6815
6816
{
6816
6817
// Stream the weapon of that model out so we have no
6817
6818
// loaded when we do the restore. The streamer will
6818
6819
// eventually stream them back in with async loading.
6819
- m_pManager->GetPedManager ()->RestreamWeapon (usModel );
6820
- m_pManager->GetPickupManager ()->RestreamPickups (usModel );
6820
+ m_pManager->GetPedManager ()->RestreamWeapon (model );
6821
+ m_pManager->GetPickupManager ()->RestreamPickups (model );
6821
6822
}
6822
6823
// Stream the objects of that model out so we have no
6823
6824
// loaded when we do the restore. The streamer will
6824
6825
// eventually stream them back in with async loading.
6825
- m_pManager->GetObjectManager ()->RestreamObjects (usModel);
6826
- g_pGame->GetModelInfo (usModel)->RestreamIPL ();
6826
+ m_pManager->GetObjectManager ()->RestreamObjects (model);
6827
+ g_pGame->GetModelInfo (model)->RestreamIPL ();
6828
+
6829
+ return true ;
6827
6830
}
6828
6831
// Is this an ped ID?
6829
- else if (CClientPlayerManager::IsValidModel (usModel ))
6832
+ else if (CClientPlayerManager::IsValidModel (model ))
6830
6833
{
6831
6834
// Stream the ped of that model out so we have no
6832
6835
// loaded when we do the restore. The streamer will
6833
6836
// eventually stream them back in with async loading.
6834
- m_pManager->GetPedManager ()->RestreamPeds (usModel);
6835
- }
6836
- else
6837
+ m_pManager->GetPedManager ()->RestreamPeds (model);
6837
6838
6838
- // 'Restream' upgrades after model replacement to propagate visual changes with immediate effect
6839
- if (CClientObjectManager::IsValidModel (usModel) && CVehicleUpgrades::IsUpgrade (usModel))
6840
- m_pManager->GetVehicleManager ()->RestreamVehicleUpgrades (usModel);
6839
+ return true ;
6840
+ }
6841
+ // 'Restream' upgrades after model replacement to propagate visual changes with immediate effect
6842
+ else if (CClientObjectManager::IsValidModel (model) && CVehicleUpgrades::IsUpgrade (model))
6843
+ {
6844
+ m_pManager->GetVehicleManager ()->RestreamVehicleUpgrades (model);
6845
+ return true ;
6846
+ }
6847
+ return false ;
6841
6848
}
6842
6849
6843
6850
void CClientGame::RestreamWorld ()
@@ -6858,6 +6865,55 @@ void CClientGame::RestreamWorld()
6858
6865
g_pGame->GetStreaming ()->ReinitStreaming ();
6859
6866
}
6860
6867
6868
+ void CClientGame::Restream (std::optional<RestreamOption> option)
6869
+ {
6870
+ if (!option.has_value ())
6871
+ option = RestreamOption::ALL;
6872
+
6873
+ if (option == RestreamOption::ALL || option == RestreamOption::VEHICLES)
6874
+ {
6875
+ for (const auto & model : m_pManager->GetModelManager ()->GetModelsByType (eClientModelType::VEHICLE))
6876
+ {
6877
+ g_pClientGame->GetModelCacheManager ()->OnRestreamModel (model->GetModelID ());
6878
+ }
6879
+
6880
+ m_pManager->GetVehicleManager ()->RestreamAllVehicles ();
6881
+ }
6882
+
6883
+ if (option == RestreamOption::ALL || option == RestreamOption::PEDS)
6884
+ {
6885
+ for (const auto & model : m_pManager->GetModelManager ()->GetModelsByType (eClientModelType::PED))
6886
+ {
6887
+ g_pClientGame->GetModelCacheManager ()->OnRestreamModel (model->GetModelID ());
6888
+ }
6889
+
6890
+ m_pManager->GetPedManager ()->RestreamAllPeds ();
6891
+ }
6892
+
6893
+ if (option == RestreamOption::ALL || option == RestreamOption::OBJECTS)
6894
+ {
6895
+ static constexpr eClientModelType restreamTypes[] = {eClientModelType::OBJECT, eClientModelType::OBJECT_DAMAGEABLE, eClientModelType::TIMED_OBJECT,
6896
+ eClientModelType::CLUMP};
6897
+
6898
+ for (eClientModelType type : restreamTypes)
6899
+ {
6900
+ for (const auto & model : m_pManager->GetModelManager ()->GetModelsByType (type))
6901
+ {
6902
+ g_pClientGame->GetModelCacheManager ()->OnRestreamModel (model->GetModelID ());
6903
+ }
6904
+ }
6905
+
6906
+ m_pManager->GetObjectManager ()->RestreamAllObjects ();
6907
+ m_pManager->GetPickupManager ()->RestreamAllPickups ();
6908
+ }
6909
+
6910
+ if (option == RestreamOption::ALL)
6911
+ {
6912
+ g_pGame->GetStreaming ()->RemoveBigBuildings ();
6913
+ g_pGame->GetStreaming ()->ReinitStreaming ();
6914
+ }
6915
+ }
6916
+
6861
6917
void CClientGame::ReinitMarkers ()
6862
6918
{
6863
6919
g_pGame->Get3DMarkers ()->ReinitMarkers ();
0 commit comments