diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 8652b57b2f..d2460d2685 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -11,6 +11,8 @@ StepMania 5.0 $next | 2011???? 2011/08/22 ---------- * [PrefsManager, X11Helper] Added ShowMouseCursor preference. [AJ] +* [UnlockManager] Added GetStepOfAllTypes Lua binding. This gets the locked + Steps for all game types based on the difficulty specified. [Wolfman2000] 2011/08/21 ---------- diff --git a/src/UnlockManager.cpp b/src/UnlockManager.cpp index ea4948d894..67221c7936 100644 --- a/src/UnlockManager.cpp +++ b/src/UnlockManager.cpp @@ -799,6 +799,27 @@ public: if( pSong ) { pSong->PushSelf(L); return 1; } return 0; } + // Get all of the steps locked based on difficulty (similar to In The Groove 2). + static int GetStepOfAllTypes( T* p, lua_State *L ) + { + Song *pSong = p->m_Song.ToSong(); + if (pSong) + { + const vector& allSteps = pSong->GetAllSteps(); + vector toRet; + FOREACH_CONST(Steps*, allSteps, step) + { + if ((*step)->GetDifficulty() == p->m_dc) + { + toRet.push_back(*step); + } + } + LuaHelpers::CreateTableFromArray( toRet, L ); + return 1; + } + return 0; + } + // TODO: Add a function to just get all steps. static int GetStepByStepsType( T* p, lua_State *L ) { @@ -866,6 +887,7 @@ public: ADD_METHOD( GetRequirePassChallengeSteps ); ADD_METHOD( GetSong ); ADD_METHOD( GetCourse ); + ADD_METHOD( GetStepOfAllTypes ); ADD_METHOD( GetStepByStepsType ); ADD_METHOD( song ); ADD_METHOD( steps );