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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user