From 47e7ba36571e0d9fe07add3fe5920a338f57cab3 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 12 Jun 2006 10:49:44 +0000 Subject: [PATCH] Invalidate trail caches for edit courses on unlocks. --- stepmania/src/SongManager.cpp | 11 +++++++++++ stepmania/src/SongManager.h | 2 +- stepmania/src/UnlockManager.cpp | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 29d1357ac5..8c9026ba51 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -811,6 +811,17 @@ void SongManager::DeleteCourse( Course *pCourse ) RefreshCourseGroupInfo(); } +void SongManager::InvalidateCachedTrails() +{ + FOREACH_CONST( Course *, m_pCourses, pCourse ) + { + const Course &c = **pCourse; + + if( c.IsAnEdit() ) + c.m_TrailCache.clear(); + } +} + /* Called periodically to wipe out cached NoteData. This is called when we change * screens. */ void SongManager::Cleanup() diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index e4e4327aec..6c6c9660aa 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -50,7 +50,7 @@ public: void FreeCourses(); void AddCourse( Course *pCourse ); // transfers ownership of pCourse void DeleteCourse( Course *pCourse ); // transfers ownership of pCourse - + void InvalidateCachedTrails(); void InitAll( LoadingWindow *ld ); // songs, courses, groups - everything. void Reload( bool bAllowFastLoad, LoadingWindow *ld=NULL ); // songs, courses, groups - everything. diff --git a/stepmania/src/UnlockManager.cpp b/stepmania/src/UnlockManager.cpp index f18718a355..bbbb8ce378 100644 --- a/stepmania/src/UnlockManager.cpp +++ b/stepmania/src/UnlockManager.cpp @@ -593,6 +593,7 @@ void UnlockManager::UnlockEntryID( RString sEntryID ) PROFILEMAN->GetProfile(pn)->m_UnlockedEntryIDs.insert( sEntryID ); PROFILEMAN->GetMachineProfile()->m_UnlockedEntryIDs.insert( sEntryID ); + SONGMAN->InvalidateCachedTrails(); } void UnlockManager::UnlockEntryIndex( int iEntryIndex )