Skip to content

Commit 93cccf6

Browse files
committed
Fix references when define new cache time
1 parent e5ec4fd commit 93cccf6

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Client/multiplayer_sa/CMultiplayerSA_ClothesCache.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*****************************************************************************
1+
/*****************************************************************************
22
*
33
* PROJECT: Multi Theft Auto v1.0
44
* LICENSE: See LICENSE in the top level directory
@@ -421,8 +421,26 @@ bool CMultiplayerSA::SetClothingCacheTime(std::uint32_t timeInMs)
421421
if (timeInMs == ms_clumpStore.m_minCacheTime)
422422
return false;
423423

424-
ms_clumpStore.savedClumpList.clear();
424+
for (auto it = ms_clumpStore.savedClumpList.begin(); it != ms_clumpStore.savedClumpList.end();)
425+
{
426+
CClumpStore::SSavedClumpInfo& info = *it;
427+
428+
#ifdef CLOTHES_REF_TEST
429+
RpGeometry* pGeometry = ((RpAtomic*)((info.pClump->atomics.root.next) - 0x8))->geometry;
430+
pGeometry->refs -= 20;
431+
#endif
432+
RpClumpDestroy(info.pClump);
433+
434+
if (info.bUnused)
435+
ms_clumpStore.m_Stats.uiNumUnused--;
436+
437+
ms_clumpStore.m_Stats.uiNumRemoved++;
438+
439+
it = ms_clumpStore.savedClumpList.erase(it);
440+
}
441+
425442
ms_clumpStore.m_minCacheTime = timeInMs;
443+
ms_clumpStore.m_Stats.uiNumTotal = ms_clumpStore.savedClumpList.size();
426444

427445
return true;
428446
}

0 commit comments

Comments
 (0)