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:
@@ -195,7 +195,7 @@ static RString GetSMNotesTag( const Song &song, const Steps &in, bool bSavingCac
|
||||
return JoinLineList( lines );
|
||||
}
|
||||
|
||||
bool NotesWriterSM::Write( RString sPath, const Song &out, bool bSavingCache )
|
||||
bool NotesWriterSM::Write( RString sPath, const Song &out, const vector<Steps*>& vpStepsToSave, bool bSavingCache )
|
||||
{
|
||||
/* Flush dir cache when writing steps, so the old size isn't cached. */
|
||||
FILEMAN->FlushDirCache( Dirname(sPath) );
|
||||
@@ -229,19 +229,11 @@ bool NotesWriterSM::Write( RString sPath, const Song &out, bool bSavingCache )
|
||||
}
|
||||
|
||||
//
|
||||
// Save all Steps for this file
|
||||
// Save specified Steps to this file
|
||||
//
|
||||
const vector<Steps*>& vpSteps = out.GetAllSteps();
|
||||
FOREACH_CONST( Steps*, vpSteps, s )
|
||||
FOREACH_CONST( Steps*, vpStepsToSave, s )
|
||||
{
|
||||
const 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;
|
||||
|
||||
RString sTag = GetSMNotesTag( out, *pSteps, bSavingCache );
|
||||
f.PutLine( sTag );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user