separate SongManager::Cleanup and SongManager::FlushCaches

Cleanup() is called every screen, to remove large decompressed step
data, but that shouldn't clear trail caches as well;
SongManager::FlushCaches also clears the StepsID cache
This commit is contained in:
Glenn Maynard
2004-06-11 21:31:34 +00:00
parent 0a455d1a64
commit a17b1ead51
3 changed files with 9 additions and 15 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ void GameState::Reset()
/* We may have cached trails from before everything was loaded (eg. from before
* SongManager::UpdateBest could be called). Erase the cache. */
SONGMAN->RegenRandomTrailEntries();
SONGMAN->FlushCaches();
g_vPlayedStageStats.clear();
+7 -13
View File
@@ -661,24 +661,18 @@ void SongManager::Cleanup()
pSteps->Compress();
}
}
}
// FIXME
/* Why was this commented out? If this isn't done, we'll have stale Steps* in
* course caches, and we'll crash later. */
/* Flush all Song*, Steps* and Course* caches. This is called on reload, and when
* any of those are removed or changed. This doesn't touch GAMESTATE and StageStats
* pointers, which are updated explicitly in Song::RevertFromDisk. */
void SongManager::FlushCaches()
{
/* Erase cached course info. */
for( unsigned i=0; i < m_pCourses.size(); i++ )
m_pCourses[i]->RegenTrails();
StepsID::FlushCache();
}
void SongManager::RegenRandomTrailEntries()
{
/* Regenerate Trails so that any random entires get re-picked. */
for( unsigned i=0; i < m_pCourses.size(); i++ )
{
// FIXME: only regen entries that are random - not all entries
m_pCourses[i]->RegenTrails();
}
StepsID::FlushCache();
}
void SongManager::SetPreferences()
+1 -1
View File
@@ -25,7 +25,7 @@ public:
void InitSongsFromDisk( LoadingWindow *ld );
void FreeSongs();
void Cleanup();
void RegenRandomTrailEntries();
void FlushCaches();
void SetPreferences();
void LoadAllFromProfiles(); // song, edits