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:
Steve Checkoway
2006-07-08 06:07:54 +00:00
parent 5774a0a70d
commit 4130874a41
+8 -2
View File
@@ -79,16 +79,22 @@ 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") )
{ {
RString step = sParams[1]; RString step = sParams[1];
TrimLeft(step); TrimLeft( step );
split( step, "\n", asRows, true ); split( step, "\n", asRows, true );
} }
else if( 0==stricmp(sValueName,"DIFFICULTY") ) else if( 0==stricmp(sValueName,"DIFFICULTY") )
{ {
out.SetMeter( atoi(sParams[1]) ); out.SetMeter( max(atoi(sParams[1]), 0) );
} }
} }