Don't modify stored courses; it's far too easy to accidentally forget

to reset them in one of the (many) exit-gameplay paths, or reset it
incorrectly.

This fixes the course selection screen crashing when there is
no music.
This commit is contained in:
Glenn Maynard
2003-03-28 02:25:15 +00:00
parent 21c4f840c7
commit c7c02602d9
4 changed files with 28 additions and 57 deletions
+18 -35
View File
@@ -22,6 +22,8 @@
#include "SongOptions.h"
#include "RageUtil.h"
#include "TitleSubstitution.h"
#include "Notes.h"
#include "GameState.h"
Course::Course()
@@ -431,10 +433,26 @@ void Course::GetStageInfo(
if( !pSong || !pNotes )
continue; // this song entry isn't playable. Skip.
if(GAMESTATE->m_bDifficultCourses)
{
/* See if we can find a NoteData that's one notch more difficult than
* the one we found above. */
Difficulty dc = pNotes->GetDifficulty();
if(dc < DIFFICULTY_CHALLENGE)
{
dc = Difficulty(dc + 1);
Notes* pNewNotes = pSong->GetNotes( nt, dc );
if(pNewNotes)
pNotes = pNewNotes;
}
}
vSongsOut.push_back( pSong );
vNotesOut.push_back( pNotes );
vsModifiersOut.push_back( e.modifiers );
}
}
bool Course::GetFirstStageInfo(
@@ -609,41 +627,6 @@ void Course::AddScores( NotesType nt, bool bPlayerEnabled[NUM_PLAYERS], int iDan
}
}
bool Course::MakeNormal()
{
if( !m_bRepeat && m_iLives == -1 ) // nonstop only, not oni or endless
if(m_bDifficult) //only make it easy if it's already difficult
{
unsigned c;
for( c = 0; c < m_entries.size(); c++)
{
if( m_entries[c].difficulty == DIFFICULTY_BEGINNER || m_entries[c].difficulty == DIFFICULTY_INVALID ) // don't suddenly make things invalid or worse
continue;
m_entries[c].difficulty = Difficulty(m_entries[c].difficulty - 1);
}
m_bDifficult = false;
return true;
}
return false;
}
bool Course::MakeDifficult()
{
if( !m_bRepeat && m_iLives == -1 ) // nonstop only, not oni or endless
if(!m_bDifficult) //only make it difficult once
{
unsigned c;
for( c = 0; c < m_entries.size(); c++)
{
if( m_entries[c].difficulty < DIFFICULTY_CHALLENGE ) // don't suddenly make things invalid or worse
m_entries[c].difficulty = Difficulty(m_entries[c].difficulty + 1);
}
m_bDifficult = true;
return true;
}
return false;
}
//
// Sorting stuff