diff --git a/src/NotesLoaderBMS.cpp b/src/NotesLoaderBMS.cpp index b1a2d44836..ef49a5130c 100644 --- a/src/NotesLoaderBMS.cpp +++ b/src/NotesLoaderBMS.cpp @@ -1002,7 +1002,7 @@ bool BMSChartReader::ReadNoteData() delete holdStart; delete lastNote; - td.TidyUpData(); + td.TidyUpData( false ); out->SetNoteData(nd); out->m_Timing = td; out->TidyUpData(); diff --git a/src/ScreenHowToPlay.cpp b/src/ScreenHowToPlay.cpp index 16d5ae3f62..ef5062c891 100644 --- a/src/ScreenHowToPlay.cpp +++ b/src/ScreenHowToPlay.cpp @@ -151,7 +151,7 @@ void ScreenHowToPlay::Init() Steps *pSteps = SongUtil::GetClosestNotes( &m_Song, pStyle->m_StepsType, Difficulty_Beginner ); ASSERT_M( pSteps != NULL, ssprintf("No playable steps of StepsType '%s' for ScreenHowToPlay", StringConversion::ToString(pStyle->m_StepsType).c_str()) ); - pSteps->m_Timing.TidyUpData(); + pSteps->m_Timing.TidyUpData( false ); NoteData tempNoteData; pSteps->GetNoteData( tempNoteData ); pStyle->GetTransformedNoteDataForStyle( PLAYER_1, tempNoteData, m_NoteData ); diff --git a/src/Song.cpp b/src/Song.cpp index 5404507ad0..f189c7f454 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -537,11 +537,11 @@ void Song::TidyUpData( bool fromCache, bool /* duringCache */ ) m_fMusicLengthSeconds = 0; } - m_SongTiming.TidyUpData(); + m_SongTiming.TidyUpData( false ); FOREACH( Steps *, m_vpSteps, s ) { - (*s)->m_Timing.TidyUpData(); + (*s)->m_Timing.TidyUpData( false ); } /* Generate these before we autogen notes, so the new notes can inherit diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 9fb9668cce..02653f81b8 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -863,8 +863,13 @@ float TimingData::GetDisplayedSpeedPercent( float fSongBeat, float fMusicSeconds } -void TimingData::TidyUpData() +void TimingData::TidyUpData(bool allowEmpty) { + // Empty TimingData is used to implement steps with no timing of their + // own. Don't override this. + if( allowEmpty && empty() ) + return; + // If there are no BPM segments, provide a default. vector *segs = m_avpTimingSegments; if( segs[SEGMENT_BPM].empty() ) diff --git a/src/TimingData.h b/src/TimingData.h index 4478fa6fd1..7fd1acdcd1 100644 --- a/src/TimingData.h +++ b/src/TimingData.h @@ -378,8 +378,10 @@ public: /** * @brief Tidy up the timing data, e.g. provide default BPMs, labels, tickcounts. + * @param allowEmpty true if completely empty TimingData should be left + * alone, false if it should be changed */ - void TidyUpData(); + void TidyUpData(bool allowEmpty); // Lua void PushSelf( lua_State *L );