Whoops! We can't revert an autogen course from disk. My bad.
TODO: is there a cheaper way to fix up the autogen courses?
This commit is contained in:
@@ -799,7 +799,6 @@ void SongManager::InitAutogenCourses()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SongManager::FreeCourses()
|
||||
{
|
||||
for( unsigned i=0; i<m_pCourses.size(); i++ )
|
||||
@@ -814,6 +813,26 @@ void SongManager::FreeCourses()
|
||||
m_mapCourseGroupToInfo.clear();
|
||||
}
|
||||
|
||||
void SongManager::DeleteAutogenCourses()
|
||||
{
|
||||
vector<Course*> vNewCourses;
|
||||
for( vector<Course*>::iterator it = m_pCourses.begin(); it != m_pCourses.end(); ++it )
|
||||
{
|
||||
if( (*it)->m_bIsAutogen )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
else
|
||||
{
|
||||
vNewCourses.push_back( *it );
|
||||
}
|
||||
}
|
||||
m_pCourses.swap( vNewCourses );
|
||||
UpdatePopular();
|
||||
UpdateShuffled();
|
||||
RefreshCourseGroupInfo();
|
||||
}
|
||||
|
||||
void SongManager::AddCourse( Course *pCourse )
|
||||
{
|
||||
m_pCourses.push_back( pCourse );
|
||||
@@ -861,15 +880,21 @@ void SongManager::Cleanup()
|
||||
|
||||
/* Flush all Song*, Steps* and Course* caches. This is when a Song or its Steps
|
||||
* are removed or changed. This doesn't touch GAMESTATE and StageStats
|
||||
* pointers. Currently, the only time Steps are altered independantly of the
|
||||
* pointers. Currently, the only time Steps are altered independently of the
|
||||
* Courses and Songs is in Edit Mode, which updates the other pointers it needs. */
|
||||
void SongManager::Invalidate( const Song *pStaleSong )
|
||||
{
|
||||
// TODO: This is unnecessarily expensive.
|
||||
// Can we regenerate only the autogen courses that are affected?
|
||||
DeleteAutogenCourses();
|
||||
|
||||
FOREACH( Course*, this->m_pCourses, pCourse )
|
||||
{
|
||||
(*pCourse)->Invalidate( pStaleSong );
|
||||
}
|
||||
|
||||
InitAutogenCourses();
|
||||
|
||||
UpdatePopular();
|
||||
UpdateShuffled();
|
||||
RefreshCourseGroupInfo();
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
void FreeCourses();
|
||||
void AddCourse( Course *pCourse ); // transfers ownership of pCourse
|
||||
void DeleteCourse( Course *pCourse ); // transfers ownership of pCourse
|
||||
void DeleteAutogenCourses(); // deletes every autogen course
|
||||
void InvalidateCachedTrails();
|
||||
|
||||
void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything.
|
||||
|
||||
Reference in New Issue
Block a user