From ce83ae6ef089c4a38932e0539d1d1bd7de7c9900 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 13 Apr 2005 08:05:48 +0000 Subject: [PATCH] only clamp description for edits --- stepmania/src/ScreenEdit.cpp | 2 +- stepmania/src/ScreenEditMenu.cpp | 2 +- stepmania/src/Song.cpp | 2 +- stepmania/src/Steps.cpp | 9 +++++---- stepmania/src/Steps.h | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 6667856dc1..460f57be81 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -2454,7 +2454,7 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v SM_None, "Enter a description.", m_pSteps->GetDescription(), - MAX_DESCRIPTION_LENGTH, + (dc == DIFFICULTY_EDIT) ? MAX_EDIT_DESCRIPTION_LENGTH : 255, NULL, ChangeDescription, NULL diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index f5e5a474b0..0142760eea 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -285,7 +285,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn ) SM_BackFromEditDescription, "Name the new edit.", GAMESTATE->m_pCurSteps[0]->GetDescription(), - MAX_DESCRIPTION_LENGTH, + MAX_EDIT_DESCRIPTION_LENGTH, ValidateCurrentStepsDescription, SetCurrentStepsDescription, DeleteCurrentSteps ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 0084a410a6..59ceee9fe4 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1444,7 +1444,7 @@ void Song::MakeUniqueEditDescription( StepsType st, CString &sPreferredDescripti { // make name "My Edit" -> "My Edit" CString sNum = ssprintf("%d", i+1); - sTemp = sPreferredDescriptionInOut.Left( MAX_DESCRIPTION_LENGTH - sNum.size() ) + sNum; + sTemp = sPreferredDescriptionInOut.Left( MAX_EDIT_DESCRIPTION_LENGTH - sNum.size() ) + sNum; if( IsEditDescriptionUnique(st, sTemp, NULL) ) { diff --git a/stepmania/src/Steps.cpp b/stepmania/src/Steps.cpp index c9e4eef35a..9f3570d5e9 100644 --- a/stepmania/src/Steps.cpp +++ b/stepmania/src/Steps.cpp @@ -326,14 +326,15 @@ void Steps::SetDescription(CString desc) { DeAutogen(); m_sDescription = desc; - MakeValidDescription( m_sDescription ); + if( GetDifficulty() == DIFFICULTY_EDIT ) + MakeValidEditDescription( m_sDescription ); } -bool Steps::MakeValidDescription( CString &sPreferredDescription ) +bool Steps::MakeValidEditDescription( CString &sPreferredDescription ) { - if( int(sPreferredDescription.size()) > MAX_DESCRIPTION_LENGTH ) + if( int(sPreferredDescription.size()) > MAX_EDIT_DESCRIPTION_LENGTH ) { - sPreferredDescription = sPreferredDescription.Left( MAX_DESCRIPTION_LENGTH ); + sPreferredDescription = sPreferredDescription.Left( MAX_EDIT_DESCRIPTION_LENGTH ); return true; } return false; diff --git a/stepmania/src/Steps.h b/stepmania/src/Steps.h index 0c87c6c962..0c7323ebc0 100644 --- a/stepmania/src/Steps.h +++ b/stepmania/src/Steps.h @@ -12,7 +12,7 @@ class Profile; struct lua_State; -const int MAX_DESCRIPTION_LENGTH = 12; +const int MAX_EDIT_DESCRIPTION_LENGTH = 12; class Steps { @@ -44,7 +44,7 @@ public: void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; } bool GetSavedToDisk() { return m_bSavedToDisk; } void SetDescription(CString desc); - static bool MakeValidDescription( CString &sPreferredDescription ); // return true if was modified + static bool MakeValidEditDescription( CString &sPreferredDescription ); // return true if was modified void SetDifficulty(Difficulty d); void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; }