Ready for the dry run.
This commit is contained in:
@@ -1682,7 +1682,9 @@ The folder "%s" appears to be a song folder. All song folders must reside in a
|
|||||||
|
|
||||||
[SongUtil]
|
[SongUtil]
|
||||||
You must supply a name for your new edit.=You must supply a name for your new edit.
|
You must supply a name for your new edit.=You must supply a name for your new edit.
|
||||||
|
The name you chose conflicts with another chart. Please use a different name.=The name you chose conflicts with another chart. Please use a different name.
|
||||||
The name you chose conflicts with another edit. Please use a different name.=The name you chose conflicts with another edit. Please use a different name.
|
The name you chose conflicts with another edit. Please use a different name.=The name you chose conflicts with another edit. Please use a different name.
|
||||||
|
The chart name cannot contain any of the following characters: %s=The chart name cannot contain any of the following characters: %s
|
||||||
The edit name cannot contain any of the following characters: %s=The edit name can not contain any of the following characters: %s
|
The edit name cannot contain any of the following characters: %s=The edit name can not contain any of the following characters: %s
|
||||||
The step author's name cannot contain any of the following characters: %s=The step author's name cannot contain any of the following characters: %s
|
The step author's name cannot contain any of the following characters: %s=The step author's name cannot contain any of the following characters: %s
|
||||||
|
|
||||||
|
|||||||
+31
-2
@@ -749,6 +749,22 @@ bool SongUtil::IsEditDescriptionUnique( const Song* pSong, StepsType st, const R
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SongUtil::IsChartNameUnique( const Song* pSong, StepsType st, const RString &name, const Steps *pExclude )
|
||||||
|
{
|
||||||
|
FOREACH_CONST( Steps*, pSong->GetAllSteps(), s )
|
||||||
|
{
|
||||||
|
Steps *pSteps = *s;
|
||||||
|
|
||||||
|
if( pSteps->m_StepsType != st )
|
||||||
|
continue;
|
||||||
|
if( pSteps == pExclude )
|
||||||
|
continue;
|
||||||
|
if( pSteps->GetChartName() == name )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
RString SongUtil::MakeUniqueEditDescription( const Song *pSong, StepsType st, const RString &sPreferredDescription )
|
RString SongUtil::MakeUniqueEditDescription( const Song *pSong, StepsType st, const RString &sPreferredDescription )
|
||||||
{
|
{
|
||||||
if( IsEditDescriptionUnique( pSong, st, sPreferredDescription, NULL ) )
|
if( IsEditDescriptionUnique( pSong, st, sPreferredDescription, NULL ) )
|
||||||
@@ -772,8 +788,11 @@ RString SongUtil::MakeUniqueEditDescription( const Song *pSong, StepsType st, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString YOU_MUST_SUPPLY_NAME ( "SongUtil", "You must supply a name for your new edit." );
|
static LocalizedString YOU_MUST_SUPPLY_NAME ( "SongUtil", "You must supply a name for your new edit." );
|
||||||
|
static LocalizedString CHART_NAME_CONFLICTS ("SongUtil", "The name you chose conflicts with another chart. Please use a different name.");
|
||||||
static LocalizedString EDIT_NAME_CONFLICTS ( "SongUtil", "The name you chose conflicts with another edit. Please use a different name." );
|
static LocalizedString EDIT_NAME_CONFLICTS ( "SongUtil", "The name you chose conflicts with another edit. Please use a different name." );
|
||||||
|
static LocalizedString CHART_NAME_CANNOT_CONTAIN ("SongUtil", "The chart name cannot contain any of the following characters: %s" );
|
||||||
static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "SongUtil", "The edit name cannot contain any of the following characters: %s" );
|
static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "SongUtil", "The edit name cannot contain any of the following characters: %s" );
|
||||||
|
|
||||||
bool SongUtil::ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut )
|
bool SongUtil::ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut )
|
||||||
{
|
{
|
||||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||||
@@ -837,6 +856,13 @@ bool SongUtil::ValidateCurrentStepsChartName(const RString &answer, RString &err
|
|||||||
{
|
{
|
||||||
if (answer.empty()) return true;
|
if (answer.empty()) return true;
|
||||||
|
|
||||||
|
static const RString sInvalidChars = "\\/:*?\"<>|";
|
||||||
|
if( strpbrk(answer, sInvalidChars) != NULL )
|
||||||
|
{
|
||||||
|
error = ssprintf( CHART_NAME_CANNOT_CONTAIN.GetValue(), sInvalidChars.c_str() );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't allow duplicate title names within the same StepsType.
|
/* Don't allow duplicate title names within the same StepsType.
|
||||||
* We need some way of identifying the unique charts. */
|
* We need some way of identifying the unique charts. */
|
||||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||||
@@ -844,8 +870,11 @@ bool SongUtil::ValidateCurrentStepsChartName(const RString &answer, RString &err
|
|||||||
if (pSteps->GetChartName() == answer) return true;
|
if (pSteps->GetChartName() == answer) return true;
|
||||||
|
|
||||||
// TODO next commit: borrow code from EditStepsDescription.
|
// TODO next commit: borrow code from EditStepsDescription.
|
||||||
|
bool result = SongUtil::IsChartNameUnique(GAMESTATE->m_pCurSong, pSteps->m_StepsType,
|
||||||
return true;
|
answer, pSteps);
|
||||||
|
if (!result)
|
||||||
|
error = CHART_NAME_CONFLICTS;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString AUTHOR_NAME_CANNOT_CONTAIN( "SongUtil", "The step author's name cannot contain any of the following characters: %s" );
|
static LocalizedString AUTHOR_NAME_CANNOT_CONTAIN( "SongUtil", "The step author's name cannot contain any of the following characters: %s" );
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ namespace SongUtil
|
|||||||
* @return true if it is unique, false otherwise.
|
* @return true if it is unique, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool IsEditDescriptionUnique( const Song* pSong, StepsType st, const RString &sPreferredDescription, const Steps *pExclude );
|
bool IsEditDescriptionUnique( const Song* pSong, StepsType st, const RString &sPreferredDescription, const Steps *pExclude );
|
||||||
|
bool IsChartNameUnique( const Song* pSong, StepsType st, const RString &name, const Steps *pExclude );
|
||||||
RString MakeUniqueEditDescription( const Song* pSong, StepsType st, const RString &sPreferredDescription );
|
RString MakeUniqueEditDescription( const Song* pSong, StepsType st, const RString &sPreferredDescription );
|
||||||
bool ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut );
|
bool ValidateCurrentEditStepsDescription( const RString &sAnswer, RString &sErrorOut );
|
||||||
bool ValidateCurrentStepsDescription( const RString &sAnswer, RString &sErrorOut );
|
bool ValidateCurrentStepsDescription( const RString &sAnswer, RString &sErrorOut );
|
||||||
|
|||||||
Reference in New Issue
Block a user