From 939b46c01e04d3474723922d6dfa3eab41249d14 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Fri, 12 Aug 2011 23:55:36 -0400 Subject: [PATCH] Trying lua code to get the unlocked Step. Untested right now. Will doc it when confirmed working. --- src/UnlockManager.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/UnlockManager.cpp b/src/UnlockManager.cpp index e8075bbb2c..ea4948d894 100644 --- a/src/UnlockManager.cpp +++ b/src/UnlockManager.cpp @@ -799,6 +799,24 @@ public: if( pSong ) { pSong->PushSelf(L); return 1; } return 0; } + // TODO: Add a function to just get all steps. + static int GetStepByStepsType( T* p, lua_State *L ) + { + Song *pSong = p->m_Song.ToSong(); + if (pSong) + { + const vector& allStepsType = pSong->GetStepsByStepsType(p->m_StepsType); + FOREACH_CONST(Steps*, allStepsType, step) + { + if ((*step)->GetDifficulty() == p->m_dc) + { + (*step)->PushSelf(L); return 1; + } + } + } + return 0; + } + static int GetCourse( T* p, lua_State *L ) { Course *pCourse = p->m_Course.ToCourse(); @@ -848,6 +866,7 @@ public: ADD_METHOD( GetRequirePassChallengeSteps ); ADD_METHOD( GetSong ); ADD_METHOD( GetCourse ); + ADD_METHOD( GetStepByStepsType ); ADD_METHOD( song ); ADD_METHOD( steps ); ADD_METHOD( steps_type );