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()); CString s = DifficultyToThemedString(GetSelectedDifficulty());
Steps *pSteps = GetSelectedSteps(); Steps *pSteps = GetSelectedSteps();
if( GetSelectedDifficulty() == DIFFICULTY_EDIT ) if( pSteps && GetSelectedDifficulty() == DIFFICULTY_EDIT )
s += " - " + (pSteps ? pSteps->GetDescription() : "New" ); s += " - " pSteps->GetDescription();
m_textValue[ROW_STEPS].SetText( s ); m_textValue[ROW_STEPS].SetText( s );
m_Meter.SetFromSteps( GetSelectedSteps() ); m_Meter.SetFromSteps( GetSelectedSteps() );
} }
+2
View File
@@ -496,8 +496,10 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, CString sEditFilePath, Profi
return true; // Only allow one Steps per edit file! return true; // Only allow one Steps per edit file!
} }
else else
{
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() ); LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
} }
}
return true; return true;
+4 -5
View File
@@ -31,7 +31,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "NotesLoaderSM.h" #include "NotesLoaderSM.h"
const int MAX_DESCRIPTION_LENGTH = 20; const int MAX_DESCRIPTION_LENGTH = 12;
Steps::Steps() Steps::Steps()
{ {
@@ -147,9 +147,6 @@ void Steps::TidyUpData()
if( GetMeter() < 1) // meter is invalid if( GetMeter() < 1) // meter is invalid
SetMeter( int(PredictMeter()) ); SetMeter( int(PredictMeter()) );
if( int(m_sDescription.size()) > MAX_DESCRIPTION_LENGTH )
m_sDescription = m_sDescription.Left( MAX_DESCRIPTION_LENGTH );
} }
void Steps::Decompress() const void Steps::Decompress() const
@@ -270,7 +267,7 @@ void Steps::CopyFrom( Steps* pSource, StepsType ntTo ) // pSource does not have
pSource->GetNoteData( noteData ); pSource->GetNoteData( noteData );
noteData.SetNumTracks( GameManager::StepsTypeToNumTracks(ntTo) ); noteData.SetNumTracks( GameManager::StepsTypeToNumTracks(ntTo) );
this->SetNoteData( noteData ); this->SetNoteData( noteData );
this->SetDescription( "Copied from "+pSource->GetDescription() ); this->SetDescription( "From " + pSource->GetDescription() );
this->SetDifficulty( pSource->GetDifficulty() ); this->SetDifficulty( pSource->GetDifficulty() );
this->SetMeter( pSource->GetMeter() ); this->SetMeter( pSource->GetMeter() );
this->SetRadarValues( pSource->GetRadarValues() ); this->SetRadarValues( pSource->GetRadarValues() );
@@ -306,6 +303,8 @@ void Steps::SetDescription(CString desc)
{ {
DeAutogen(); DeAutogen();
m_sDescription = desc; m_sDescription = desc;
if( int(m_sDescription.size()) > MAX_DESCRIPTION_LENGTH )
m_sDescription = m_sDescription.Left( MAX_DESCRIPTION_LENGTH );
} }
void Steps::SetDifficulty(Difficulty d) void Steps::SetDifficulty(Difficulty d)