SetSavedToDisk in Save(), not in SM_SaveSuccessful. When we save the
whole file, all steps are saved to disk; we were only marking the
active steps. This sequence would cause steps to be wrongly deleted:
1: create easy and medium steps for one steps type; save
2: on another steps type, edit easy steps which were autogenned from the above
change the steps
3: f6 to change to medium steps steps which were autogenned from the above
4: menu -> save
This will save all data, but only medium will be marked saved to disk.
5: f5 to change back to easy steps
6: menu -> exit
This will delete the easy steps, because they were not marked saved to disk.
This commit is contained in:
+25
-1
@@ -819,7 +819,31 @@ bool Song::SaveToSMFile( RString sPath, bool bSavingCache )
|
||||
if( !bSavingCache && IsAFile(sPath) )
|
||||
FileCopy( sPath, sPath + ".old" );
|
||||
|
||||
return NotesWriterSM::Write( sPath, *this, bSavingCache );
|
||||
vector<Steps*> vpStepsToSave;
|
||||
FOREACH_CONST( Steps*, m_vpSteps, s )
|
||||
{
|
||||
Steps *pSteps = *s;
|
||||
if( pSteps->IsAutogen() )
|
||||
continue; /* don't write autogen notes */
|
||||
|
||||
/* Only save steps that weren't loaded from a profile. */
|
||||
if( pSteps->WasLoadedFromProfile() )
|
||||
continue;
|
||||
|
||||
vpStepsToSave.push_back( pSteps );
|
||||
}
|
||||
|
||||
if( !NotesWriterSM::Write(sPath, *this, vpStepsToSave, bSavingCache) )
|
||||
return false;
|
||||
|
||||
if( !bSavingCache )
|
||||
{
|
||||
/* Mark these steps saved to disk. */
|
||||
FOREACH( Steps*, vpStepsToSave, s )
|
||||
(*s)->SetSavedToDisk( true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Song::SaveToCacheFile()
|
||||
|
||||
Reference in New Issue
Block a user