Changed Song and ScreenEdit to not save a .sm file when split timing is used.

This commit is contained in:
Kyzentun Keeslala
2015-10-02 16:26:59 -06:00
parent 751caba360
commit 2d64694f14
6 changed files with 48 additions and 6 deletions
+19 -4
View File
@@ -115,6 +115,7 @@ AutoScreenMessage( SM_DoSaveAndExit );
AutoScreenMessage( SM_DoExit );
AutoScreenMessage( SM_AutoSaveSuccessful );
AutoScreenMessage( SM_SaveSuccessful );
AutoScreenMessage( SM_SaveSuccessNoSM );
AutoScreenMessage( SM_SaveFailed );
static const char *EditStateNames[] = {
@@ -3596,6 +3597,7 @@ void ScreenEdit::HandleMessage( const Message &msg )
static LocalizedString SAVE_SUCCESSFUL ( "ScreenEdit", "Save successful." );
static LocalizedString AUTOSAVE_SUCCESSFUL ( "ScreenEdit", "Autosave successful." );
static LocalizedString SAVE_SUCCESS_NO_SM_SPLIT_TIMING("ScreenEdit", "save_success_no_sm_split_timing");
static LocalizedString ADD_NEW_MOD ("ScreenEdit", "Adding New Mod");
static LocalizedString ADD_NEW_ATTACK ("ScreenEdit", "Adding New Attack");
@@ -4311,17 +4313,27 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
break; // do nothing
}
}
else if( SM == SM_SaveSuccessful )
else if(SM == SM_SaveSuccessful || SM == SM_SaveSuccessNoSM)
{
LOG->Trace( "Save successful." );
CopyToLastSave();
SetDirty( false );
SONGMAN->Invalidate( GAMESTATE->m_pCurSong );
LocalizedString const* message= &SAVE_SUCCESSFUL;
if(SM == SM_SaveSuccessNoSM)
{
message= &SAVE_SUCCESS_NO_SM_SPLIT_TIMING;
}
if( m_CurrentAction == save_on_exit )
ScreenPrompt::Prompt( SM_DoExit, SAVE_SUCCESSFUL );
{
ScreenPrompt::Prompt( SM_DoExit, *message );
}
else
SCREENMAN->SystemMessage( SAVE_SUCCESSFUL );
{
SCREENMAN->SystemMessage( *message );
}
}
else if( SM == SM_AutoSaveSuccessful )
{
@@ -4425,8 +4437,11 @@ void ScreenEdit::PerformSave(bool autosave)
m_pSteps->m_Attacks = GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks;
m_pSteps->m_sAttackString = GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.ToVectorString();
// If one of the charts uses split timing, then it cannot be accurately
// saved in the .sm format. So saving the .sm is disabled.
bool uses_split= m_pSong->AnyChartUsesSplitTiming();
const ScreenMessage save_message= autosave ? SM_AutoSaveSuccessful
: SM_SaveSuccessful;
: (uses_split ? SM_SaveSuccessNoSM : SM_SaveSuccessful);
switch( EDIT_MODE.GetValue() )
{
+19 -2
View File
@@ -1157,7 +1157,12 @@ void Song::Save(bool autosave)
return;
}
SaveToCacheFile();
SaveToSMFile();
// If one of the charts uses split timing, then it cannot be accurately
// saved in the .sm format. So saving the .sm is disabled.
if(!AnyChartUsesSplitTiming())
{
SaveToSMFile();
}
//SaveToDWIFile();
/* We've safely written our files and created backups. Rename non-SM and
@@ -1884,6 +1889,18 @@ bool Song::IsStepsUsingDifferentTiming(Steps *pSteps) const
return !pSteps->m_Timing.empty();
}
bool Song::AnyChartUsesSplitTiming() const
{
FOREACH_CONST(Steps*, m_vpSteps, s)
{
if(!(*s)->m_Timing.empty())
{
return true;
}
}
return false;
}
bool Song::HasSignificantBpmChangesOrStops() const
{
if( m_SongTiming.HasStops() || m_SongTiming.HasDelays() )
@@ -2377,4 +2394,4 @@ LUA_REGISTER_CLASS( Song )
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
*/
+1
View File
@@ -436,6 +436,7 @@ public:
bool IsEditAlreadyLoaded( Steps* pSteps ) const;
bool IsStepsUsingDifferentTiming(Steps *pSteps ) const;
bool AnyChartUsesSplitTiming() const;
/**
* @brief An array of keysound file names (e.g. "beep.wav").