Fixed music crash bug

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1849 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-05-10 23:29:04 +00:00
parent 228c5fb117
commit 89617347fe
2 changed files with 9 additions and 2 deletions

View File

@ -170,6 +170,8 @@ void MusicInformation::update(float dt)
switch(m_mode) switch(m_mode)
{ {
case SOUND_FADING: { case SOUND_FADING: {
if ( m_normal_music == NULL || m_fast_music == NULL ) break;
m_time_since_faster +=dt; m_time_since_faster +=dt;
if(m_time_since_faster>=m_faster_time) if(m_time_since_faster>=m_faster_time)
{ {
@ -184,10 +186,12 @@ void MusicInformation::update(float dt)
break; break;
} }
case SOUND_FASTER: { case SOUND_FASTER: {
if ( m_normal_music == NULL ) break;
m_time_since_faster +=dt; m_time_since_faster +=dt;
if(m_time_since_faster>=m_faster_time) if(m_time_since_faster>=m_faster_time)
{ {
// Once the pitch is adjusted, just switch back to normal // Once the pitch is adjusted, just switch back to normal
// mode. We can't switch to fast music mode, since this would // mode. We can't switch to fast music mode, since this would
// play m_fast_music, which isn't available. // play m_fast_music, which isn't available.
m_mode=SOUND_NORMAL; m_mode=SOUND_NORMAL;
@ -199,9 +203,13 @@ void MusicInformation::update(float dt)
break; break;
} }
case SOUND_NORMAL: case SOUND_NORMAL:
if ( m_normal_music == NULL ) break;
m_normal_music->update(); m_normal_music->update();
break; break;
case SOUND_FAST: case SOUND_FAST:
if ( m_fast_music == NULL ) break;
m_fast_music->update(); m_fast_music->update();
break; break;
} // switch } // switch

View File

@ -60,7 +60,6 @@ bool MusicOggStream::load(const std::string& filename)
return false; return false;
} }
//m_fileName = file_manager->getMusicFile(filename);
m_fileName = filename; m_fileName = filename;
if(m_fileName=="") return false; if(m_fileName=="") return false;