diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt
index 5c8753740a..e4c5a6d79e 100644
--- a/Docs/Changelog_sm5.txt
+++ b/Docs/Changelog_sm5.txt
@@ -14,6 +14,9 @@ StepMania 5.0 ????????? | 20110???
Saving should still work, but this was never tested yet. [Wolfman2000]
* [ScreenOptions] Mini is now ITG Mini, and Tiny is now Pump Pro Mini.
This will prevent many prior courses from breaking. [sharksoda, Wolfman2000]
+* [CharacterManager] Add a lua function to check how many characters you have.
+ For an example of how this is used, check the default theme's scripts
+ folder, specifically 03 ThemePrefs.lua. [Wolfman2000]
2011/07/04
----------
diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml
index 4f56b8b1a2..a3bf6efb82 100644
--- a/Docs/Luadoc/Lua.xml
+++ b/Docs/Luadoc/Lua.xml
@@ -580,6 +580,7 @@
+
diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml
index d1d6f53eda..3163e5b0da 100644
--- a/Docs/Luadoc/LuaDocumentation.xml
+++ b/Docs/Luadoc/LuaDocumentation.xml
@@ -1540,6 +1540,9 @@
Returns a random character.
+
+ Returns the number of characters available.
+
diff --git a/Themes/default/Scripts/03 ThemePrefs.lua b/Themes/default/Scripts/03 ThemePrefs.lua
index d7c1555728..221ced5288 100644
--- a/Themes/default/Scripts/03 ThemePrefs.lua
+++ b/Themes/default/Scripts/03 ThemePrefs.lua
@@ -231,9 +231,9 @@ function UserPrefShowLotsaOptions()
end
function GetDefaultOptionLines()
- local LineSets = {
- "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,16,17,18", -- All
- "1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx )
+ local LineSets = { -- none of these include characters yet.
+ "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,16,17", -- All
+ "1,8,14,2,7,13,16,17", -- DDR Essentials ( no turns, fx )
};
local function IsExtra()
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then
@@ -242,15 +242,22 @@ function GetDefaultOptionLines()
return false
end
end
- if not IsExtra() then
- if GetUserPrefB("UserPrefShowLotsaOptions") then
- return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2];
- else
- return LineSets[2]; -- Just make sure!
+
+ local function CheckCharacters(mods)
+ if CHARMAN:GetCharacterCount() > 0 then
+ return mods .. ",18"; --TODO: Better line name.
end
- else
- return "1,8,14,2,7,13,16,17,18" -- "failsafe" list
+ return mods;
end
+
+ modLines = LineSets[2];
+
+ if not IsExtra() then
+ modLines = GetUserPrefB("UserPrefShowLotsaOptions")
+ and LineSets[1] or LineSets[2];
+ end
+
+ return CheckCharacters(modLines);
end;
function UserPrefAutoSetStyle()
diff --git a/src/CharacterManager.cpp b/src/CharacterManager.cpp
index 10cf6a26d6..30fc1ab6ac 100644
--- a/src/CharacterManager.cpp
+++ b/src/CharacterManager.cpp
@@ -152,6 +152,13 @@ public:
LuaHelpers::CreateTableFromArray(vChars, L);
return 1;
}
+ static int GetCharacterCount(T* p, lua_State *L)
+ {
+ vector chars;
+ p->GetCharacters(chars);
+ lua_pushnumber(L, chars.size());
+ return 1;
+ }
LunaCharacterManager()
{
@@ -159,6 +166,7 @@ public:
// sm-ssc adds:
ADD_METHOD( GetRandomCharacter );
ADD_METHOD( GetAllCharacters );
+ ADD_METHOD( GetCharacterCount );
}
};