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:
@@ -8,6 +8,10 @@ ________________________________________________________________________________
|
||||
StepMania 5.0 $next | 2011????
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
2011/09/16
|
||||
----------
|
||||
* [UnlockManager] Added GetNumLockedSongs() Lua binding. [Wolfman2000]
|
||||
|
||||
2011/09/12
|
||||
----------
|
||||
* [NotesLoaderSSC/WriterSSC] Allow all timing tags regardless of what timing
|
||||
|
||||
@@ -1330,6 +1330,7 @@
|
||||
<Function name='GetNumAdditionalSongs'/>
|
||||
<Function name='GetNumCourseGroups'/>
|
||||
<Function name='GetNumCourses'/>
|
||||
<Function name='GetNumLockedSongs'/>
|
||||
<Function name='GetNumSelectableAndUnlockedSongs'/>
|
||||
<Function name='GetNumSongGroups'/>
|
||||
<Function name='GetNumSongs'/>
|
||||
|
||||
@@ -3513,6 +3513,9 @@
|
||||
<Function name='GetNumSongs' return='int' arguments=''>
|
||||
Returns the number of songs.
|
||||
</Function>
|
||||
<Function name='GetNumLockedSongs' return='int' arguments=''>
|
||||
Returns the number of locked songs, regardless of reason for locking.
|
||||
</Function>
|
||||
<Function name='GetNumUnlockedSongs' return='int' arguments=''>
|
||||
Returns the number of unlocked songs.
|
||||
</Function>
|
||||
|
||||
@@ -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