diff options
Diffstat (limited to 'src/core/Pools.cpp')
-rw-r--r-- | src/core/Pools.cpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index bd0814d0..fe2cf7ad 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -22,21 +22,25 @@ CTreadablePool *CPools::ms_pTreadablePool; CObjectPool *CPools::ms_pObjectPool; CDummyPool *CPools::ms_pDummyPool; CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool; +CColModelPool *CPools::ms_pColModelPool; +//--MIAMI: done void CPools::Initialise(void) { - ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES); - ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS); - ms_pPedPool = new CPedPool(NUMPEDS); - ms_pVehiclePool = new CVehiclePool(NUMVEHICLES); - ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS); - ms_pTreadablePool = new CTreadablePool(NUMTREADABLES); - ms_pObjectPool = new CObjectPool(NUMOBJECTS); - ms_pDummyPool = new CDummyPool(NUMDUMMIES); - ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS); + ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES, "PtrNode"); + ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS, "EntryInfoNode"); + ms_pPedPool = new CPedPool(NUMPEDS, "Peds"); + ms_pVehiclePool = new CVehiclePool(NUMVEHICLES, "Vehicles"); + ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS, "Buildings"); + ms_pTreadablePool = new CTreadablePool(NUMTREADABLES, "Treadables"); + ms_pObjectPool = new CObjectPool(NUMOBJECTS, "Objects"); + ms_pDummyPool = new CDummyPool(NUMDUMMIES, "Dummys"); + ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS, "AudioScriptObj"); + ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel"); } +//--MIAMI: done void CPools::ShutDown(void) { @@ -49,6 +53,7 @@ CPools::ShutDown(void) debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces()); debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces()); debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces()); + debug("ColModels left %d\n", ms_pColModelPool->GetNoOfUsedSpaces()); printf("Shutdown pool started\n"); delete ms_pPtrNodePool; @@ -60,6 +65,7 @@ CPools::ShutDown(void) delete ms_pObjectPool; delete ms_pDummyPool; delete ms_pAudioScriptObjectPool; + delete ms_pColModelPool; printf("Shutdown pool done\n"); } @@ -542,8 +548,20 @@ INITSAVEBUF pPed->CharCreatedBy = pBufferPlayer->CharCreatedBy; pPed->m_currentWeapon = 0; pPed->m_maxWeaponTypeAllowed = pBufferPlayer->m_maxWeaponTypeAllowed; - for (int i = 0; i < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; i++) - pPed->m_weapons[i] = pBufferPlayer->m_weapons[i]; + for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) { + if (pBufferPlayer->HasWeaponSlot(i)) { + int modelId = CWeaponInfo::GetWeaponInfo(pBufferPlayer->GetWeapon(i).m_eWeaponType)->m_nModelId; + if (modelId != -1) { + CStreaming::RequestModel(modelId, STREAMFLAGS_DEPENDENCY); + int modelId2 = CWeaponInfo::GetWeaponInfo(pBufferPlayer->GetWeapon(i).m_eWeaponType)->m_nModel2Id; + if (modelId2 != -1) + CStreaming::RequestModel(modelId2, STREAMFLAGS_DEPENDENCY); + + CStreaming::LoadAllRequestedModels(false); + } + pPed->GiveWeapon(pBufferPlayer->GetWeapon(i).m_eWeaponType, pBufferPlayer->GetWeapon(i).m_nAmmoTotal); + } + } if (pedtype == PEDTYPE_PLAYER1) { pPed->m_wepAccuracy = 100; |