mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Purge resource manager cache on level load
This commit is contained in:
parent
3f42df45fd
commit
433fd62de5
2 changed files with 12 additions and 1 deletions
|
@ -434,9 +434,12 @@ void PreloadCache(void)
|
||||||
char tempbuf[128];
|
char tempbuf[128];
|
||||||
if (gDemo.at1)
|
if (gDemo.at1)
|
||||||
return;
|
return;
|
||||||
|
gSysRes.PurgeCache();
|
||||||
|
gSoundRes.PurgeCache();
|
||||||
|
gSysRes.PrecacheSounds();
|
||||||
|
gSoundRes.PrecacheSounds();
|
||||||
if (MusicRestartsOnLoadToggle)
|
if (MusicRestartsOnLoadToggle)
|
||||||
sndTryPlaySpecialMusic(MUS_LOADING);
|
sndTryPlaySpecialMusic(MUS_LOADING);
|
||||||
gSoundRes.PrecacheSounds();
|
|
||||||
PreloadTiles();
|
PreloadTiles();
|
||||||
ClockTicks clock = totalclock;
|
ClockTicks clock = totalclock;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
|
@ -776,6 +776,14 @@ void Resource::PurgeCache(void)
|
||||||
for (CACHENODE *node = purgeHead.next; node != &purgeHead; node = node->next)
|
for (CACHENODE *node = purgeHead.next; node != &purgeHead; node = node->next)
|
||||||
{
|
{
|
||||||
DICTNODE *pDict = (DICTNODE*)node;
|
DICTNODE *pDict = (DICTNODE*)node;
|
||||||
|
if (!(pDict->flags & DICT_LOAD))
|
||||||
|
{
|
||||||
|
dassert(pDict->lockCount == 0);
|
||||||
|
dassert(pDict->ptr != NULL);
|
||||||
|
Free(pDict->ptr);
|
||||||
|
pDict->ptr = NULL;
|
||||||
|
RemoveMRU(pDict);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue