Split *Options::FromString into FromString and FromOneModString.

Check for invalid mod names when loading a course by checking whether the mod is a valid PlayerOption or a valid SongOption.  Previously, SongOption mods were being flagged as errors by PlayerOptions.
This commit is contained in:
Chris Danford
2007-08-20 02:57:05 +00:00
parent e2d8d6d718
commit 4311158735
9 changed files with 265 additions and 226 deletions
+25
View File
@@ -11,6 +11,8 @@
#include "Foreach.h"
#include "GameState.h"
#include "LocalizedString.h"
#include "RageLog.h"
#include "arch/Dialog/Dialog.h"
//
@@ -315,6 +317,29 @@ bool CourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sError
return true;
}
void CourseUtil::WarnOnInvalidMods( RString sMods )
{
PlayerOptions po;
SongOptions so;
vector<RString> vs;
split( sMods, ",", vs, true );
FOREACH_CONST( RString, vs, s )
{
bool bValid = false;
RString sErrorDetail;
bValid |= po.FromOneModString( *s, sErrorDetail );
bValid |= so.FromOneModString( *s, sErrorDetail );
if( !bValid )
{
RString sFullError = ssprintf("Error processing '%s' in '%s'", (*s).c_str(), sMods.c_str() );
if( !sErrorDetail.empty() )
sFullError += ": " + sErrorDetail;
LOG->UserLog( "", "", "%s", sFullError.c_str() );
Dialog::OK( sFullError, "INVALID_PLAYER_OPTION_WARNING" );
}
}
}
//////////////////////////////////
// CourseID