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:
@@ -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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void InitSongsFromDisk( LoadingWindow *ld );
|
||||
void FreeSongs();
|
||||
void Cleanup();
|
||||
void RegenRandomTrailEntries();
|
||||
void FlushCaches();
|
||||
void SetPreferences();
|
||||
|
||||
void LoadAllFromProfiles(); // song, edits
|
||||
|
||||
Reference in New Issue
Block a user