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
|
/* We may have cached trails from before everything was loaded (eg. from before
|
||||||
* SongManager::UpdateBest could be called). Erase the cache. */
|
* SongManager::UpdateBest could be called). Erase the cache. */
|
||||||
SONGMAN->RegenRandomTrailEntries();
|
SONGMAN->FlushCaches();
|
||||||
|
|
||||||
g_vPlayedStageStats.clear();
|
g_vPlayedStageStats.clear();
|
||||||
|
|
||||||
|
|||||||
@@ -661,24 +661,18 @@ void SongManager::Cleanup()
|
|||||||
pSteps->Compress();
|
pSteps->Compress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME
|
/* Flush all Song*, Steps* and Course* caches. This is called on reload, and when
|
||||||
/* Why was this commented out? If this isn't done, we'll have stale Steps* in
|
* any of those are removed or changed. This doesn't touch GAMESTATE and StageStats
|
||||||
* course caches, and we'll crash later. */
|
* pointers, which are updated explicitly in Song::RevertFromDisk. */
|
||||||
|
void SongManager::FlushCaches()
|
||||||
|
{
|
||||||
/* Erase cached course info. */
|
/* Erase cached course info. */
|
||||||
for( unsigned i=0; i < m_pCourses.size(); i++ )
|
for( unsigned i=0; i < m_pCourses.size(); i++ )
|
||||||
m_pCourses[i]->RegenTrails();
|
m_pCourses[i]->RegenTrails();
|
||||||
StepsID::FlushCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SongManager::RegenRandomTrailEntries()
|
StepsID::FlushCache();
|
||||||
{
|
|
||||||
/* 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongManager::SetPreferences()
|
void SongManager::SetPreferences()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
void InitSongsFromDisk( LoadingWindow *ld );
|
void InitSongsFromDisk( LoadingWindow *ld );
|
||||||
void FreeSongs();
|
void FreeSongs();
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
void RegenRandomTrailEntries();
|
void FlushCaches();
|
||||||
void SetPreferences();
|
void SetPreferences();
|
||||||
|
|
||||||
void LoadAllFromProfiles(); // song, edits
|
void LoadAllFromProfiles(); // song, edits
|
||||||
|
|||||||
Reference in New Issue
Block a user