mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
Revisited aggressive object freeing
This commit is contained in:
parent
ed397348d1
commit
c1ad23ed22
@ -5,6 +5,8 @@
|
||||
#include "ModelInfoSA.h"
|
||||
#include "PoolsSA.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// Wrappers
|
||||
static void* EntityRender = AddressByVersion<void*>(0x534310, 0x5347B0, 0x545B30);
|
||||
WRAPPER void CEntity::Render() { VARJMP(EntityRender); }
|
||||
@ -105,9 +107,9 @@ extern void (*WorldRemove)(CEntity*);
|
||||
void CObject::TryToFreeUpTempObjects_SilentPatch( int numObjects )
|
||||
{
|
||||
const auto [ numProcessed, numFreed ] = TryOrFreeUpTempObjects( numObjects, false );
|
||||
if ( numProcessed >= numObjects && numObjects > numFreed )
|
||||
if ( numFreed < numObjects )
|
||||
{
|
||||
TryOrFreeUpTempObjects( numObjects - numFreed, true );
|
||||
TryOrFreeUpTempObjects( std::min(numProcessed, numObjects - numFreed), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user