Disallow nonpositive tick counts and negative difficulties. (I'm not sure if the latter should be positive or merely nonnegative.)
This commit is contained in:
@@ -79,6 +79,12 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
if( 0==stricmp(sValueName,"TICKCOUNT") )
|
if( 0==stricmp(sValueName,"TICKCOUNT") )
|
||||||
{
|
{
|
||||||
iTickCount = atoi( sParams[1] );
|
iTickCount = atoi( sParams[1] );
|
||||||
|
if( iTickCount <= 0 )
|
||||||
|
{
|
||||||
|
// XXX need a place for user warnings.
|
||||||
|
LOG->Warn( "Invalid tick count: %d", iTickCount );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( 0==stricmp(sValueName,"STEP") )
|
else if( 0==stricmp(sValueName,"STEP") )
|
||||||
{
|
{
|
||||||
@@ -88,7 +94,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
}
|
}
|
||||||
else if( 0==stricmp(sValueName,"DIFFICULTY") )
|
else if( 0==stricmp(sValueName,"DIFFICULTY") )
|
||||||
{
|
{
|
||||||
out.SetMeter( atoi(sParams[1]) );
|
out.SetMeter( max(atoi(sParams[1]), 0) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user