clamp description length when setting, not just on load

This commit is contained in:
Chris Danford
2005-03-05 22:16:19 +00:00
parent b60d135493
commit a73e8948e7
3 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -280,8 +280,8 @@ void EditMenu::OnRowValueChanged( Row row )
{
CString s = DifficultyToThemedString(GetSelectedDifficulty());
Steps *pSteps = GetSelectedSteps();
if( GetSelectedDifficulty() == DIFFICULTY_EDIT )
s += " - " + (pSteps ? pSteps->GetDescription() : "New" );
if( pSteps && GetSelectedDifficulty() == DIFFICULTY_EDIT )
s += " - " pSteps->GetDescription();
m_textValue[ROW_STEPS].SetText( s );
m_Meter.SetFromSteps( GetSelectedSteps() );
}
+2
View File
@@ -496,7 +496,9 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, CString sEditFilePath, Profi
return true; // Only allow one Steps per edit file!
}
else
{
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
}
}
return true;
+4 -5
View File
@@ -31,7 +31,7 @@
#include "PrefsManager.h"
#include "NotesLoaderSM.h"
const int MAX_DESCRIPTION_LENGTH = 20;
const int MAX_DESCRIPTION_LENGTH = 12;
Steps::Steps()
{
@@ -147,9 +147,6 @@ void Steps::TidyUpData()
if( GetMeter() < 1) // meter is invalid
SetMeter( int(PredictMeter()) );
if( int(m_sDescription.size()) > MAX_DESCRIPTION_LENGTH )
m_sDescription = m_sDescription.Left( MAX_DESCRIPTION_LENGTH );
}
void Steps::Decompress() const
@@ -270,7 +267,7 @@ void Steps::CopyFrom( Steps* pSource, StepsType ntTo ) // pSource does not have
pSource->GetNoteData( noteData );
noteData.SetNumTracks( GameManager::StepsTypeToNumTracks(ntTo) );
this->SetNoteData( noteData );
this->SetDescription( "Copied from "+pSource->GetDescription() );
this->SetDescription( "From " + pSource->GetDescription() );
this->SetDifficulty( pSource->GetDifficulty() );
this->SetMeter( pSource->GetMeter() );
this->SetRadarValues( pSource->GetRadarValues() );
@@ -306,6 +303,8 @@ void Steps::SetDescription(CString desc)
{
DeAutogen();
m_sDescription = desc;
if( int(m_sDescription.size()) > MAX_DESCRIPTION_LENGTH )
m_sDescription = m_sDescription.Left( MAX_DESCRIPTION_LENGTH );
}
void Steps::SetDifficulty(Difficulty d)