[sm130labels] Do not allow duplicate label names.
This commit is contained in:
+2
-2
@@ -2669,14 +2669,14 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
else if ( SM == SM_BackFromLabelChange )
|
else if ( SM == SM_BackFromLabelChange )
|
||||||
{
|
{
|
||||||
RString sLabel = ScreenTextEntry::s_sLastAnswer;
|
RString sLabel = ScreenTextEntry::s_sLastAnswer;
|
||||||
if ( sLabel.length() > 0 )
|
if ( !m_pSong->m_Timing.DoesLabelExist(sLabel) )
|
||||||
{
|
{
|
||||||
sLabel.Replace("=", "_");
|
sLabel.Replace("=", "_");
|
||||||
sLabel.Replace(",", "_");
|
sLabel.Replace(",", "_");
|
||||||
m_pSong->m_Timing.SetLabelAtBeat( GAMESTATE->m_fSongBeat, sLabel );
|
m_pSong->m_Timing.SetLabelAtBeat( GAMESTATE->m_fSongBeat, sLabel );
|
||||||
}
|
|
||||||
SetDirty( true );
|
SetDirty( true );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if ( SM == SM_BackFromWarpChange )
|
else if ( SM == SM_BackFromWarpChange )
|
||||||
{
|
{
|
||||||
float fWarp = StringToFloat( ScreenTextEntry::s_sLastAnswer );
|
float fWarp = StringToFloat( ScreenTextEntry::s_sLastAnswer );
|
||||||
|
|||||||
+11
-1
@@ -238,7 +238,7 @@ void TimingData::SetLabelAtRow( int iRow, const RString sLabel )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( i > 0 && m_LabelSegments[i-1].m_sLabel == sLabel )
|
if( i > 0 && ( m_LabelSegments[i-1].m_sLabel == sLabel || sLabel == "" ) )
|
||||||
m_LabelSegments.erase( m_LabelSegments.begin()+i, m_LabelSegments.begin()+i+1 );
|
m_LabelSegments.erase( m_LabelSegments.begin()+i, m_LabelSegments.begin()+i+1 );
|
||||||
else
|
else
|
||||||
m_LabelSegments[i].m_sLabel = sLabel;
|
m_LabelSegments[i].m_sLabel = sLabel;
|
||||||
@@ -545,6 +545,16 @@ float TimingData::GetNextLabelSegmentBeatAtRow( int iRow ) const
|
|||||||
return NoteRowToBeat(iRow);
|
return NoteRowToBeat(iRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TimingData::DoesLabelExist( RString sLabel ) const
|
||||||
|
{
|
||||||
|
FOREACH_CONST( LabelSegment, m_LabelSegments, seg )
|
||||||
|
{
|
||||||
|
if( seg->m_sLabel == sLabel )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void TimingData::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, float &fWarpLengthOut ) const
|
void TimingData::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, float &fWarpLengthOut ) const
|
||||||
{
|
{
|
||||||
fElapsedTime += PREFSMAN->m_fGlobalOffsetSeconds;
|
fElapsedTime += PREFSMAN->m_fGlobalOffsetSeconds;
|
||||||
|
|||||||
@@ -1215,6 +1215,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
float GetPreviousLabelSegmentBeatAtBeat( float fBeat ) const { return GetPreviousLabelSegmentBeatAtRow( BeatToNoteRow(fBeat) ); }
|
float GetPreviousLabelSegmentBeatAtBeat( float fBeat ) const { return GetPreviousLabelSegmentBeatAtRow( BeatToNoteRow(fBeat) ); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Determine if the requisite label already exists.
|
||||||
|
* @param sLabel the label to check.
|
||||||
|
* @return true if it exists, false otherwise. */
|
||||||
|
bool DoesLabelExist( RString sLabel ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieve the next beat that contains a LabelSegment.
|
* @brief Retrieve the next beat that contains a LabelSegment.
|
||||||
* @param iRow the present row.
|
* @param iRow the present row.
|
||||||
|
|||||||
Reference in New Issue
Block a user