From 183888f4f1b9430f9c3f43b481a54ae5052125dc Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sat, 27 Aug 2011 15:23:20 -0500 Subject: [PATCH] [SongManager] Add SongToPreferredSortSectionName(song), WasLoadedFromAdditionalSongs(song), and WasLoadedFromAdditionalCourses(course) Lua bindings --- Docs/Changelog_sm5.txt | 2 ++ src/SongManager.cpp | 26 +++++++++++++++++++++----- src/SongManager.h | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index e71279ea1e..cc048ed4ee 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -16,6 +16,8 @@ StepMania 5.0 $next | 2011???? GetPopularSongs() Lua bindings. [AJ] * [SongManager] Added GetPreferredSortSongs(), GetPreferredSortCourses(courseType,bIncludeAutogen), and GetPopularCourses(courseType) Lua bindings. [AJ] +* [SongManager] Add SongToPreferredSortSectionName(song), WasLoadedFromAdditionalSongs(song), + and WasLoadedFromAdditionalCourses(course) Lua bindings. [AJ] 2011/08/23 ---------- diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 1b021dfcca..a3795a8206 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -1987,6 +1987,24 @@ public: LuaHelpers::CreateTableFromArray( v, L ); return 1; } + static int SongToPreferredSortSectionName( T* p, lua_State *L ) + { + const Song* pSong = Luna::check(L,1); + lua_pushstring(L, p->SongToPreferredSortSectionName(pSong)); + return 1; + } + static int WasLoadedFromAdditionalSongs( T* p, lua_State *L ) + { + const Song* pSong = Luna::check(L,1); + lua_pushboolean(L, p->WasLoadedFromAdditionalSongs(pSong)); + return 1; + } + static int WasLoadedFromAdditionalCourses( T* p, lua_State *L ) + { + const Course* pCourse = Luna::check(L,1); + lua_pushboolean(L, p->WasLoadedFromAdditionalCourses(pCourse)); + return 1; + } LunaSongManager() { @@ -2025,11 +2043,9 @@ public: ADD_METHOD( DoesCourseGroupExist ); ADD_METHOD( GetPopularSongs ); ADD_METHOD( GetPopularCourses ); - //ADD_METHOD( GetSongsOfCurrentGame ); - //ADD_METHOD( GetAllSongsOfCurrentGame ); - //ADD_METHOD( SongToPreferredSortSectionName ); - //ADD_METHOD( WasLoadedFromAdditionalSongs ); - //ADD_METHOD( WasLoadedFromAdditionalCourses ); + ADD_METHOD( SongToPreferredSortSectionName ); + ADD_METHOD( WasLoadedFromAdditionalSongs ); + ADD_METHOD( WasLoadedFromAdditionalCourses ); } }; diff --git a/src/SongManager.h b/src/SongManager.h index 807b8f7e99..b3e19ca855 100644 --- a/src/SongManager.h +++ b/src/SongManager.h @@ -102,7 +102,7 @@ public: * a song is chosen. * @return all of the popular songs. */ const vector &GetPopularSongs() const { return m_pPopularSongs; } - + /** * @brief Retrieve all of the songs in a group that have at least one * valid step for the current gametype. @@ -114,7 +114,7 @@ public: * valid step for the current gametype. * @return the songs within the game that have at least one valid Step. */ const vector &GetAllSongsOfCurrentGame() const; - + void GetPreferredSortSongs( vector &AddTo ) const; RString SongToPreferredSortSectionName( const Song *pSong ) const; const vector &GetPopularCourses( CourseType ct ) const { return m_pPopularCourses[ct]; }