TimingData: add allowEmpty parameter to TidyUpData. always false for now...

This commit is contained in:
Devin J. Pohly
2013-01-23 14:38:57 -05:00
parent 3d6f1c5227
commit 0ae7b0da85
5 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -1002,7 +1002,7 @@ bool BMSChartReader::ReadNoteData()
delete holdStart; delete holdStart;
delete lastNote; delete lastNote;
td.TidyUpData(); td.TidyUpData( false );
out->SetNoteData(nd); out->SetNoteData(nd);
out->m_Timing = td; out->m_Timing = td;
out->TidyUpData(); out->TidyUpData();
+1 -1
View File
@@ -151,7 +151,7 @@ void ScreenHowToPlay::Init()
Steps *pSteps = SongUtil::GetClosestNotes( &m_Song, pStyle->m_StepsType, Difficulty_Beginner ); 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()) ); 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; NoteData tempNoteData;
pSteps->GetNoteData( tempNoteData ); pSteps->GetNoteData( tempNoteData );
pStyle->GetTransformedNoteDataForStyle( PLAYER_1, tempNoteData, m_NoteData ); pStyle->GetTransformedNoteDataForStyle( PLAYER_1, tempNoteData, m_NoteData );
+2 -2
View File
@@ -537,11 +537,11 @@ void Song::TidyUpData( bool fromCache, bool /* duringCache */ )
m_fMusicLengthSeconds = 0; m_fMusicLengthSeconds = 0;
} }
m_SongTiming.TidyUpData(); m_SongTiming.TidyUpData( false );
FOREACH( Steps *, m_vpSteps, s ) 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 /* Generate these before we autogen notes, so the new notes can inherit
+6 -1
View File
@@ -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. // If there are no BPM segments, provide a default.
vector<TimingSegment *> *segs = m_avpTimingSegments; vector<TimingSegment *> *segs = m_avpTimingSegments;
if( segs[SEGMENT_BPM].empty() ) if( segs[SEGMENT_BPM].empty() )
+3 -1
View File
@@ -378,8 +378,10 @@ public:
/** /**
* @brief Tidy up the timing data, e.g. provide default BPMs, labels, tickcounts. * @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 // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );