From cea0103b59f0e6f32b0daf3f3373d57866067290 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 12 Feb 2005 08:18:31 +0000 Subject: [PATCH] DWI read/write fixes --- stepmania/src/NotesLoaderDWI.cpp | 16 ++++++++++++++-- stepmania/src/NotesWriterDWI.cpp | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/stepmania/src/NotesLoaderDWI.cpp b/stepmania/src/NotesLoaderDWI.cpp index bb386f02bb..f21bb20b99 100644 --- a/stepmania/src/NotesLoaderDWI.cpp +++ b/stepmania/src/NotesLoaderDWI.cpp @@ -300,7 +300,8 @@ bool DWILoader::LoadFromDWITokens( continue; int iTailRow = iHeadRow; - while( newNoteData.GetNextTapNoteRowForTrack(t, iTailRow) ) + bool bFound = false; + while( !bFound && newNoteData.GetNextTapNoteRowForTrack(t, iTailRow) ) { const TapNote &TailTap = newNoteData.GetTapNote( t, iTailRow ); if( TailTap.type == TapNote::empty ) @@ -309,7 +310,18 @@ bool DWILoader::LoadFromDWITokens( newNoteData.SetTapNote( t, iTailRow, TAP_EMPTY ); tn.iDuration = iTailRow - iHeadRow; newNoteData.SetTapNote( t, iHeadRow, tn ); - break; + bFound = true; + } + + if( !bFound ) + { + /* The hold was never closed. */ + LOG->Warn( "File \"%s\":\"%s\" failed to close a hold note on track %i", + m_sLoadingFile.c_str(), + sDescription.c_str(), + t ); + + newNoteData.SetTapNote( t, iHeadRow, TAP_EMPTY ); } } } diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 50866820a3..660ec16eca 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -190,6 +190,7 @@ void NotesWriterDWI::WriteDWINotesField( RageFile &f, const Steps &out, int star { NoteData notedata; out.GetNoteData( notedata ); + NoteDataUtil::InsertHoldTails( notedata ); const int iLastMeasure = int( notedata.GetLastBeat()/BEATS_PER_MEASURE ); for( int m=0; m<=iLastMeasure; m++ ) // foreach measure