fix:
"// FIXME: This logic fails if the user starts a new steps, changes to // a different stepchart, and then exits without saving"
This commit is contained in:
@@ -2573,18 +2573,25 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
// IMPORTANT: CopyFromLastSave before deleting the Steps below
|
// IMPORTANT: CopyFromLastSave before deleting the Steps below
|
||||||
CopyFromLastSave();
|
CopyFromLastSave();
|
||||||
|
|
||||||
// If these steps have never been saved, then we should delete them.
|
/* The user has been given a choice to save. Delete all unsaved
|
||||||
// If the user created them in the edit menu and never bothered
|
* steps before exiting the editor. */
|
||||||
// to save them, then they aren't wanted.
|
Song *pSong = GAMESTATE->m_pCurSong;
|
||||||
// FIXME: This logic fails if the user starts a new steps, changes to
|
const vector<Steps*> &apSteps = pSong->GetAllSteps();
|
||||||
// a different stepchart, and then exits without saving
|
vector<Steps*> apToDelete;
|
||||||
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
FOREACH_CONST( Steps *, apSteps, s )
|
||||||
if( !pSteps->GetSavedToDisk() )
|
|
||||||
{
|
{
|
||||||
Song* pSong = GAMESTATE->m_pCurSong;
|
if( (*s)->IsAutogen() || (*s)->GetSavedToDisk() )
|
||||||
|
continue;
|
||||||
|
apToDelete.push_back( *s );
|
||||||
|
}
|
||||||
|
FOREACH_CONST( Steps *, apToDelete, s )
|
||||||
|
{
|
||||||
|
Steps *pSteps = *s;
|
||||||
pSong->DeleteSteps( pSteps );
|
pSong->DeleteSteps( pSteps );
|
||||||
m_pSteps = NULL;
|
if( m_pSteps == pSteps )
|
||||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL );
|
m_pSteps = NULL;
|
||||||
|
if( GAMESTATE->m_pCurSteps[PLAYER_1].Get() == pSteps )
|
||||||
|
GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Out.StartTransitioning( SM_GoToNextScreen );
|
m_Out.StartTransitioning( SM_GoToNextScreen );
|
||||||
|
|||||||
Reference in New Issue
Block a user