diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt
index 2edf39b96b..aeaaeef25e 100644
--- a/Docs/Changelog_sm5.txt
+++ b/Docs/Changelog_sm5.txt
@@ -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
diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml
index 93a3ebe54a..7bab9e3bf1 100644
--- a/Docs/Luadoc/Lua.xml
+++ b/Docs/Luadoc/Lua.xml
@@ -1330,6 +1330,7 @@
+
diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml
index ac8ff98186..0b896b14e3 100644
--- a/Docs/Luadoc/LuaDocumentation.xml
+++ b/Docs/Luadoc/LuaDocumentation.xml
@@ -3513,6 +3513,9 @@
Returns the number of songs.
+
+ Returns the number of locked songs, regardless of reason for locking.
+
Returns the number of unlocked songs.
diff --git a/src/SongManager.cpp b/src/SongManager.cpp
index 5c72e4454d..d125800eb3 100644
--- a/src/SongManager.cpp
+++ b/src/SongManager.cpp
@@ -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 );
diff --git a/src/SongManager.h b/src/SongManager.h
index b3e19ca855..2ad3ff6ace 100644
--- a/src/SongManager.h
+++ b/src/SongManager.h
@@ -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;