From a73e8948e7248fff86964764255d85d21560f07e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 5 Mar 2005 22:16:19 +0000 Subject: [PATCH] clamp description length when setting, not just on load --- stepmania/src/EditMenu.cpp | 4 ++-- stepmania/src/NotesLoaderSM.cpp | 2 ++ stepmania/src/Steps.cpp | 9 ++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/stepmania/src/EditMenu.cpp b/stepmania/src/EditMenu.cpp index c32305ce75..b617c668c6 100644 --- a/stepmania/src/EditMenu.cpp +++ b/stepmania/src/EditMenu.cpp @@ -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() ); } diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index db672da995..48619603db 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -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; diff --git a/stepmania/src/Steps.cpp b/stepmania/src/Steps.cpp index 305fe24ce8..bcbe4d9ad3 100644 --- a/stepmania/src/Steps.cpp +++ b/stepmania/src/Steps.cpp @@ -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)