[CourseLoaderCRS] Don't load BEST# and WORST# where # is greater than the number of songs installed. Fixes issue 373.
This commit is contained in:
@@ -11,6 +11,8 @@ StepMania 5.0 ????????? | 20110???
|
|||||||
2011/07/07
|
2011/07/07
|
||||||
----------
|
----------
|
||||||
* [ScreenEdit] Fix the NoMines transformation bug, issue 363. [Wolfman2000]
|
* [ScreenEdit] Fix the NoMines transformation bug, issue 363. [Wolfman2000]
|
||||||
|
* [CourseLoaderCRS] Don't load BEST# and WORST# where # is greater than the
|
||||||
|
number of songs installed. Fixes issue 373. [AJ]
|
||||||
|
|
||||||
2011/07/06
|
2011/07/06
|
||||||
----------
|
----------
|
||||||
|
|||||||
+23
-2
@@ -163,18 +163,39 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
// infer entry::Type from the first param
|
// infer entry::Type from the first param
|
||||||
// todo: make sure these aren't generating bogus entries due
|
// todo: make sure these aren't generating bogus entries due
|
||||||
// to a lack of songs. -aj
|
// to a lack of songs. -aj
|
||||||
|
int iNumSongs = SONGMAN->GetNumSongs();
|
||||||
LOG->Trace("[CourseLoaderCRS] sParams[1] = %s",sParams[1].c_str());
|
LOG->Trace("[CourseLoaderCRS] sParams[1] = %s",sParams[1].c_str());
|
||||||
// most played
|
// most played
|
||||||
if( sParams[1].Left(strlen("BEST")) == "BEST" )
|
if( sParams[1].Left(strlen("BEST")) == "BEST" )
|
||||||
{
|
{
|
||||||
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
int iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
||||||
|
if( iChooseIndex > iNumSongs )
|
||||||
|
{
|
||||||
|
// looking up a song that doesn't exist.
|
||||||
|
LOG->UserLog( "Course file", sPath, "is trying to load BEST%i with only %i songs installed. "
|
||||||
|
"This entry will be ignored.", iChooseIndex, iNumSongs);
|
||||||
|
out.m_bIncomplete = true;
|
||||||
|
continue; // skip this #SONG
|
||||||
|
}
|
||||||
|
|
||||||
|
new_entry.iChooseIndex = iChooseIndex;
|
||||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||||
new_entry.songSort = SongSort_MostPlays;
|
new_entry.songSort = SongSort_MostPlays;
|
||||||
}
|
}
|
||||||
// least played
|
// least played
|
||||||
else if( sParams[1].Left(strlen("WORST")) == "WORST" )
|
else if( sParams[1].Left(strlen("WORST")) == "WORST" )
|
||||||
{
|
{
|
||||||
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("WORST")) ) - 1;
|
int iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
||||||
|
if( iChooseIndex > iNumSongs )
|
||||||
|
{
|
||||||
|
// looking up a song that doesn't exist.
|
||||||
|
LOG->UserLog( "Course file", sPath, "is trying to load WORST%i with only %i songs installed. "
|
||||||
|
"This entry will be ignored.", iChooseIndex, iNumSongs);
|
||||||
|
out.m_bIncomplete = true;
|
||||||
|
continue; // skip this #SONG
|
||||||
|
}
|
||||||
|
|
||||||
|
new_entry.iChooseIndex = iChooseIndex;
|
||||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||||
new_entry.songSort = SongSort_FewestPlays;
|
new_entry.songSort = SongSort_FewestPlays;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user