From bc030297c929e017e5e046d504c350ea770b1028 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 6 Jun 2004 22:03:21 +0000 Subject: [PATCH] fix stale Steps* in Trail being used after reverting songs from disk --- stepmania/src/Profile.cpp | 30 ++++++++++++++---------------- stepmania/src/ScreenGameplay.cpp | 7 +++++++ stepmania/src/StageStats.h | 3 ++- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index f3c4706d3b..b45267d7c6 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -288,26 +288,24 @@ int Profile::GetPossibleCourseDancePointsForStepsType( StepsType st ) const int iTotal = 0; // add course high scores + vector vCourses; + SONGMAN->GetAllCourses( vCourses, false ); + for( unsigned i=0; i vCourses; - SONGMAN->GetAllCourses( vCourses, false ); - for( unsigned i=0; iAllSongsAreFixed() ) + continue; + + FOREACH_ShownCourseDifficulty( cd ) { - const Course* pCourse = vCourses[i]; - - // Don't count any course that has any entries that change over time. - if( !pCourse->AllSongsAreFixed() ) + Trail* pTrail = pCourse->GetTrail(st,cd); + if( pTrail == NULL ) continue; - FOREACH_ShownCourseDifficulty( cd ) - { - Trail* pTrail = pCourse->GetTrail(st,cd); - if( pTrail == NULL ) - continue; - - const RadarValues& fRadars = pTrail->GetRadarValues(); - iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - } + const RadarValues& fRadars = pTrail->GetRadarValues(); + iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); } } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 89c0e3f5d8..3bf4940f00 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1804,6 +1804,13 @@ void RevertChanges( void* papSongsQueue ) vector& apSongsQueue = *(vector*)papSongsQueue; for( unsigned i=0; iRevertFromDisk(); + + // We need to regen any Courses that have any of the songs we just reloaded. + // Regen all Courses for now. + vector vpAllCourses; + SONGMAN->GetAllCourses( vpAllCourses, true ); + FOREACH( Course*, vpAllCourses, pCourse ) + (*pCourse)->RegenTrails(); } void ScreenGameplay::ShowSavePrompt( ScreenMessage SM_SendWhenDone ) diff --git a/stepmania/src/StageStats.h b/stepmania/src/StageStats.h index 3fcedc42e8..5ab6a4ef53 100644 --- a/stepmania/src/StageStats.h +++ b/stepmania/src/StageStats.h @@ -14,7 +14,8 @@ class Steps; struct StageStats { - StageStats(); + StageStats() { Init(); } + void Init(); void AddStats( const StageStats& other ); // accumulate Grade GetGrade( PlayerNumber pn ) const; bool OnePassed() const;