From ac7d7a35a5af9362b0ead4ed9cfc4b4b6c70892d Mon Sep 17 00:00:00 2001 From: Andrew Livy Date: Sat, 23 May 2009 10:33:36 +0000 Subject: [PATCH] Fixes an issue with GetCurrentSteps() where if you changed song on the music select and were trying to catch it in lua using CurrentSongChangedMessage it would not have updated the current steps in time (thus, returns the previous songs steps instead). --- stepmania/src/GameState.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index bae1c1ffbd..ee75a50719 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -2134,7 +2134,25 @@ public: static int GetCurrentSteps( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); - Steps *pSteps = p->m_pCurSteps[pn]; + + Steps* pSteps; + if(p->m_pCurSong.Get() != NULL) + { + pSteps = p->m_pCurSong.Get()->GetStepsByStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType)[pn]; + + if(pSteps == NULL) + pSteps = p->m_pCurSteps[pn]; + } + else + { + pSteps = p->m_pCurSteps[pn]; + } + + // if you're on the music select and change song, the current steps are not + // updated correctly/in time for CurrentSongChangedMessageCommand + // (as such the returned steps are that of the previous song + +// Steps *pSteps = p->m_pCurSteps[pn]; if( pSteps ) { pSteps->PushSelf(L); } else { lua_pushnil(L); } return 1;