only clamp description for edits

This commit is contained in:
Chris Danford
2005-04-13 08:05:48 +00:00
parent d4df3a1431
commit ce83ae6ef0
5 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -2454,7 +2454,7 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
SM_None, SM_None,
"Enter a description.", "Enter a description.",
m_pSteps->GetDescription(), m_pSteps->GetDescription(),
MAX_DESCRIPTION_LENGTH, (dc == DIFFICULTY_EDIT) ? MAX_EDIT_DESCRIPTION_LENGTH : 255,
NULL, NULL,
ChangeDescription, ChangeDescription,
NULL NULL
+1 -1
View File
@@ -285,7 +285,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
SM_BackFromEditDescription, SM_BackFromEditDescription,
"Name the new edit.", "Name the new edit.",
GAMESTATE->m_pCurSteps[0]->GetDescription(), GAMESTATE->m_pCurSteps[0]->GetDescription(),
MAX_DESCRIPTION_LENGTH, MAX_EDIT_DESCRIPTION_LENGTH,
ValidateCurrentStepsDescription, ValidateCurrentStepsDescription,
SetCurrentStepsDescription, SetCurrentStepsDescription,
DeleteCurrentSteps ); DeleteCurrentSteps );
+1 -1
View File
@@ -1444,7 +1444,7 @@ void Song::MakeUniqueEditDescription( StepsType st, CString &sPreferredDescripti
{ {
// make name "My Edit" -> "My Edit" // make name "My Edit" -> "My Edit"
CString sNum = ssprintf("%d", i+1); 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) ) if( IsEditDescriptionUnique(st, sTemp, NULL) )
{ {
+5 -4
View File
@@ -326,14 +326,15 @@ void Steps::SetDescription(CString desc)
{ {
DeAutogen(); DeAutogen();
m_sDescription = desc; 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 true;
} }
return false; return false;
+2 -2
View File
@@ -12,7 +12,7 @@
class Profile; class Profile;
struct lua_State; struct lua_State;
const int MAX_DESCRIPTION_LENGTH = 12; const int MAX_EDIT_DESCRIPTION_LENGTH = 12;
class Steps class Steps
{ {
@@ -44,7 +44,7 @@ public:
void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; } void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; }
bool GetSavedToDisk() { return m_bSavedToDisk; } bool GetSavedToDisk() { return m_bSavedToDisk; }
void SetDescription(CString desc); 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 SetDifficulty(Difficulty d);
void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; }