[UnlockManager] Added GetPoints(UnlockRequirement), GetPointsForProfile(Profile,UnlockRequirement) Lua bindings.

This commit is contained in:
AJ Kelly
2011-04-30 19:35:51 -05:00
parent 93d3f2a063
commit 56f503e29b
2 changed files with 27 additions and 8 deletions
+2
View File
@@ -22,6 +22,8 @@ sm-ssc v1.2.5 | 20110???
* [UnlockEntry] Added GetCourse, GetCode Lua bindings. [AJ] * [UnlockEntry] Added GetCourse, GetCode Lua bindings. [AJ]
* [UnlockManager] Added UnlockRequirement_NumUnlocked enum. [AJ] * [UnlockManager] Added UnlockRequirement_NumUnlocked enum. [AJ]
* [Song] Added Origin (#ORIGIN tag in .ssc) [AJ] * [Song] Added Origin (#ORIGIN tag in .ssc) [AJ]
* [UnlockManager] Added GetPoints(UnlockRequirement),
GetPointsForProfile(Profile,UnlockRequirement) Lua bindings. [AJ]
20110428 20110428
-------- --------
+25 -8
View File
@@ -685,6 +685,7 @@ public:
return 1; return 1;
} }
// internal
static int GetArgs( T* p, lua_State *L ) static int GetArgs( T* p, lua_State *L )
{ {
Command cmd; Command cmd;
@@ -761,7 +762,7 @@ public:
static int GetStepsUnlockedByEntryID( T* p, lua_State *L ) static int GetStepsUnlockedByEntryID( T* p, lua_State *L )
{ {
// Return the song each steps are associated with, too. // Return the Song each Steps are associated with, too.
vector<Song *> apSongs; vector<Song *> apSongs;
vector<Difficulty> apDifficulty; vector<Difficulty> apDifficulty;
UNLOCKMAN->GetStepsUnlockedByEntryID( apSongs, apDifficulty, SArg(1) ); UNLOCKMAN->GetStepsUnlockedByEntryID( apSongs, apDifficulty, SArg(1) );
@@ -770,20 +771,36 @@ public:
return 2; return 2;
} }
static int GetPoints( T* p, lua_State *L ) {
float fScores[NUM_UnlockRequirement];
UNLOCKMAN->GetPoints( PROFILEMAN->GetMachineProfile(), fScores );
lua_pushnumber( fScores[Enum::Check<UnlockRequirement>(L, 1)] );
return 1;
}
static int GetPointsForProfile( T* p, lua_State *L ) {
float fScores[NUM_UnlockRequirement];
UNLOCKMAN->GetPoints( Luna<Profile>::check(L,1), fScores );
lua_pushnumber( fScores[Enum::Check<UnlockRequirement>(L, 2)] );
return 1;
}
LunaUnlockManager() LunaUnlockManager()
{ {
ADD_METHOD( GetPointsUntilNextUnlock ); ADD_METHOD( AnyUnlocksToCelebrate );
ADD_METHOD( FindEntryID ); ADD_METHOD( FindEntryID );
ADD_METHOD( UnlockEntryID );
ADD_METHOD( UnlockEntryIndex );
ADD_METHOD( PreferUnlockEntryID );
ADD_METHOD( GetNumUnlocks ); ADD_METHOD( GetNumUnlocks );
ADD_METHOD( GetNumUnlocked ); ADD_METHOD( GetNumUnlocked );
ADD_METHOD( GetUnlockEntryIndexToCelebrate ); ADD_METHOD( GetPoints );
ADD_METHOD( AnyUnlocksToCelebrate ); ADD_METHOD( GetPointsForProfile );
ADD_METHOD( GetUnlockEntry ); ADD_METHOD( GetPointsUntilNextUnlock );
ADD_METHOD( GetSongsUnlockedByEntryID ); ADD_METHOD( GetSongsUnlockedByEntryID );
ADD_METHOD( GetStepsUnlockedByEntryID ); ADD_METHOD( GetStepsUnlockedByEntryID );
ADD_METHOD( GetUnlockEntry );
ADD_METHOD( GetUnlockEntryIndexToCelebrate );
ADD_METHOD( PreferUnlockEntryID );
ADD_METHOD( UnlockEntryID );
ADD_METHOD( UnlockEntryIndex );
} }
}; };