Added GetNumLockedSongs() Lua binding.
This gets the number of songs that are locked for any reason. I wonder why the unlocked songs functions say that songs locked by unlock entries are counted there, but fair enough.
This commit is contained in:
@@ -683,6 +683,18 @@ int SongManager::GetNumSongs() const
|
||||
return m_pSongs.size();
|
||||
}
|
||||
|
||||
int SongManager::GetNumLockedSongs() const
|
||||
{
|
||||
int iNum = 0;
|
||||
FOREACH_CONST( Song*, m_pSongs, i )
|
||||
{
|
||||
// If locked for any reason, regardless of how it's locked.
|
||||
if( UNLOCKMAN->SongIsLocked(*i) )
|
||||
++iNum;
|
||||
}
|
||||
return iNum;
|
||||
}
|
||||
|
||||
int SongManager::GetNumUnlockedSongs() const
|
||||
{
|
||||
int iNum = 0;
|
||||
@@ -1896,6 +1908,7 @@ public:
|
||||
static int GetRandomSong( T* p, lua_State *L ) { Song *pS = p->GetRandomSong(); if(pS) pS->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
static int GetRandomCourse( T* p, lua_State *L ) { Course *pC = p->GetRandomCourse(); if(pC) pC->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
static int GetNumSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSongs() ); return 1; }
|
||||
static int GetNumLockedSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumLockedSongs() ); return 1; }
|
||||
static int GetNumUnlockedSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlockedSongs() ); return 1; }
|
||||
static int GetNumSelectableAndUnlockedSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumSelectableAndUnlockedSongs() ); return 1; }
|
||||
static int GetNumAdditionalSongs( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumAdditionalSongs() ); return 1; }
|
||||
@@ -2027,6 +2040,7 @@ public:
|
||||
ADD_METHOD( GetRandomCourse );
|
||||
ADD_METHOD( GetCourseGroupNames );
|
||||
ADD_METHOD( GetNumSongs );
|
||||
ADD_METHOD( GetNumLockedSongs );
|
||||
ADD_METHOD( GetNumUnlockedSongs );
|
||||
ADD_METHOD( GetNumSelectableAndUnlockedSongs );
|
||||
ADD_METHOD( GetNumAdditionalSongs );
|
||||
|
||||
@@ -126,6 +126,7 @@ public:
|
||||
* @brief Retrieve the number of songs in the game.
|
||||
* @return the number of songs. */
|
||||
int GetNumSongs() const;
|
||||
int GetNumLockedSongs() const;
|
||||
int GetNumUnlockedSongs() const;
|
||||
int GetNumSelectableAndUnlockedSongs() const;
|
||||
int GetNumAdditionalSongs() const;
|
||||
|
||||
Reference in New Issue
Block a user