From aa525eeb446a7b9f3313da72baf0581acc412e12 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 16 Aug 2006 05:36:40 +0000 Subject: [PATCH] add GetArtists --- stepmania/src/Trail.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/stepmania/src/Trail.cpp b/stepmania/src/Trail.cpp index f7a528f050..c5abd3af80 100644 --- a/stepmania/src/Trail.cpp +++ b/stepmania/src/Trail.cpp @@ -6,6 +6,7 @@ #include "PlayerOptions.h" #include "NoteData.h" #include "NoteDataUtil.h" +#include "CommonMetrics.h" void TrailEntry::GetAttackArray( AttackArray &out ) const { @@ -200,12 +201,42 @@ public: rv.PushSelf(L); return 1; } + static int GetArtists( T* p, lua_State *L ) + { + vector asArtists, asAltArtists; + FOREACH_CONST( TrailEntry, p->m_vEntries, e ) + { + if( e->bSecret ) + { + asArtists.push_back( "???" ); + asAltArtists.push_back( "???" ); + } + else + { + asArtists.push_back( e->pSong->GetDisplayArtist() ); + asAltArtists.push_back( e->pSong->GetTranslitArtist() ); + } + } + + if( (int) asArtists.size() > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS ) + { + asArtists.clear(); + asAltArtists.clear(); + asArtists.push_back( "Various Artists" ); + asAltArtists.push_back( "Various Artists" ); + } + + LuaHelpers::CreateTableFromArray( asArtists, L ); + LuaHelpers::CreateTableFromArray( asAltArtists, L ); + return 2; + } static void Register(lua_State *L) { ADD_METHOD( GetCourseDifficulty ); ADD_METHOD( GetStepsType ); ADD_METHOD( GetRadarValues ); + ADD_METHOD( GetArtists ); Luna::Register( L ); }