From ffd3d16a5fb6a951858843732b3f8b4e58f9598d Mon Sep 17 00:00:00 2001 From: infamouspat Date: Sat, 25 Feb 2012 16:31:37 -0800 Subject: [PATCH] Fix songinprogress write crashing on marathons --- src/GameState.cpp | 4 ++-- src/GameState.h | 2 +- src/ScreenGameplay.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/GameState.cpp b/src/GameState.cpp index 33f8d69b..7e9d3066 100755 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -309,10 +309,10 @@ int GameState::GetCoinsNeededToJoin() const return iCoinsToCharge; } -void GameState::SetSongInProgress( bool bInProgress ) +void GameState::SetSongInProgress( const CString &sWriteOut ) { CString sLockFile = "Data/songinprogress"; - CString sWriteOut = (bInProgress) ? this->m_pCurSong->GetSongDir() : "(none)"; + LOG->Debug("GameState::SetSongInProgress( %s )", sWriteOut.c_str()); RageFile f; f.Open(sLockFile, RageFile::WRITE); diff --git a/src/GameState.h b/src/GameState.h index 7abc1907..76b122ee 100755 --- a/src/GameState.h +++ b/src/GameState.h @@ -42,7 +42,7 @@ public: void EndGame(); // called on ScreenGameOver, ScreenMusicScroll, ScreenCredits void SaveCurrentSettingsToProfile( PlayerNumber pn ); // called at the beginning of each stage - void SetSongInProgress( bool bInProgress ); + void SetSongInProgress( const CString &sWriteOut ); void Update( float fDelta ); diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 77d5db99..f282a7e9 100755 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -120,7 +120,6 @@ void ScreenGameplay::Init() if( !GAMESTATE->m_bDemonstrationOrJukebox ) { MEMCARDMAN->PauseMountingThread(); - GAMESTATE->SetSongInProgress(true); } m_pSoundMusic = NULL; @@ -885,6 +884,7 @@ void ScreenGameplay::LoadNextSong() int iPlaySongIndex = GAMESTATE->GetCourseSongIndex(); iPlaySongIndex %= m_apSongsQueue.size(); GAMESTATE->m_pCurSong.Set( m_apSongsQueue[iPlaySongIndex] ); + GAMESTATE->SetSongInProgress( GAMESTATE->m_pCurSong->GetSongDir() ); STATSMAN->m_CurStageStats.vpPlayedSongs.push_back( GAMESTATE->m_pCurSong ); // No need to do this here. We do it in SongFinished(). @@ -1976,10 +1976,12 @@ void ScreenGameplay::BackOutFromGameplay() void ScreenGameplay::AbortGiveUp( bool bShowText ) { - GAMESTATE->SetSongInProgress(false); if( m_GiveUpTimer.IsZero() ) return; + if ( !bShowText ) + GAMESTATE->SetSongInProgress("(none)"); + m_textDebug.StopTweening(); if( bShowText ) m_textDebug.SetText( GIVE_UP_ABORTED_TEXT ); @@ -2129,6 +2131,7 @@ void ScreenGameplay::SongFinished() /* Extremely important: if we don't remove attacks before moving on to the next * screen, they'll still be turned on eventually. */ + GAMESTATE->SetSongInProgress("(none)"); GAMESTATE->RemoveAllActiveAttacks(); FOREACH_EnabledPlayer( p ) m_ActiveAttackList[p].Refresh(); -- 2.11.0