From cf2b25fdcce614fae36880bc74260a3789517e67 Mon Sep 17 00:00:00 2001 From: MrThatKid Date: Wed, 30 Aug 2017 11:57:23 -0700 Subject: [PATCH] Implemented SetActualDancePoints & SetPossibleDancePoints (#1527) * Implemented Dance Point setting Methods added: SetPossibleDancePoints SetActualDancePoints * Update luadocs to reflect changes * Fix possible divide by zero * Merge DP setting functions into one. (#5) * Merge DP setting functions into one. Also, ensure that scores of >100% aren't possible Function usage: SetDancePointLimits(actual, possible) Clamps to 100% if actual/possible >100% * Update the luadocs again --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 3 +++ src/PlayerStageStats.cpp | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index b928b96f2d..3e746894f0 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1366,6 +1366,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 1dfb848a0e..4c342b1fe5 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -3975,6 +3975,9 @@ save yourself some time, copy this for undocumented things: Returns true if the player was disqualified from ranking. + + Sets the Dance Point limits of the stage. + diff --git a/src/PlayerStageStats.cpp b/src/PlayerStageStats.cpp index d50bd83a95..7178216ea2 100644 --- a/src/PlayerStageStats.cpp +++ b/src/PlayerStageStats.cpp @@ -865,6 +865,25 @@ public: } COMMON_RETURN_SELF; } + static int SetDancePointLimits( T* p, lua_State *L ) + { + int actual = IArg(1); + int possible = IArg(2); + if( actual >= 0 && possible > 0 ) + { + p->m_iPossibleDancePoints = possible; + if( actual <= possible ) + { + p->m_iActualDancePoints = actual; + } + else + { + p->m_iActualDancePoints = possible; + } + return 1; + } + COMMON_RETURN_SELF; + } static int FailPlayer( T* p, lua_State *L ) { @@ -915,6 +934,7 @@ public: ADD_METHOD( SetScore ); ADD_METHOD( GetCurMaxScore ); ADD_METHOD( SetCurMaxScore ); + ADD_METHOD( SetDancePointLimits ); ADD_METHOD( FailPlayer ); ADD_METHOD( GetSongsPassed ); ADD_METHOD( GetSongsPlayed );