From d05911893517e4f5a653a060570635dd96e4641b Mon Sep 17 00:00:00 2001 From: sigatrev Date: Wed, 2 Apr 2014 18:09:21 -0500 Subject: [PATCH 1/2] Save/LoadProfiles ScreenProfileLoad and ScreenProfileSave do nothing except use their own lua methods to run GameState functions. Those functions might as well be available as GameState methods. --- src/GameState.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/GameState.cpp b/src/GameState.cpp index 20d9fad9e9..b08b07ce67 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -2545,6 +2545,28 @@ public: return 1; } + static int LoadProfiles( T* p, lua_State *L ) + { + bool LoadEdits = true; + if(lua_isboolean(L, 1)) + { + LoadEdits = BArg(1); + } + p->LoadProfiles( LoadEdits ); + SCREENMAN->ZeroNextUpdate(); + return 0; + } + + static int SaveProfiles( T* p, lua_State *L ) + { + p->SavePlayerProfiles(); + SCREENMAN->ZeroNextUpdate(); + return 0; + } + + DEFINE_METHOD( HaveProfileToLoad, HaveProfileToLoad() ) + DEFINE_METHOD( HaveProfileToSave, HaveProfileToSave() ) + LunaGameState() { ADD_METHOD( IsPlayerEnabled ); @@ -2655,6 +2677,10 @@ public: ADD_METHOD( ResetPlayerOptions ); ADD_METHOD( RefreshNoteSkinData ); ADD_METHOD( Dopefish ); + ADD_METHOD( LoadProfiles ); + ADD_METHOD( SaveProfiles ); + ADD_METHOD( HaveProfileToLoad ); + ADD_METHOD( HaveProfileToSave ); } }; From 47531119e1f514be996e3b5ecf27bef52e2efff4 Mon Sep 17 00:00:00 2001 From: sigatrev Date: Wed, 2 Apr 2014 18:20:44 -0500 Subject: [PATCH 2/2] luadocs added lua documentation --- Docs/Luadoc/Lua.xml | 4 ++++ Docs/Luadoc/LuaDocumentation.xml | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index b6c1f67c0f..95edf8e6f4 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -769,6 +769,8 @@ + + @@ -786,12 +788,14 @@ + + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 5d412831ae..d91ab6599a 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2289,6 +2289,12 @@ save yourself some time, copy this for undocumented things: Returns true if an extra stage was earned. + + Returns true if either player does not have a profile loaded, and there is a loadable profile. + + + Returns true if either player has a profile loaded. + Returns true if we are specifically in the Step Editor's editing portion. If in recording or playing mode, this will return @@ -2342,6 +2348,9 @@ save yourself some time, copy this for undocumented things: Similar to JoinPlayer, but checks whether the player is allowed to join and returns false if the player is not allowed to join. Also deducts coins for joining. A player can't join if PlayersCanJoin() returns false, or that side is already joined (is true for both sides when in a style that is OnePlayerTwoSides), or there are not enough coins. + + If profiles are not loaded, this will load the profiles for each player. It will load from memory cards if they are present, and local profiles otherwise. It will load edits if LoadEdits is true, or by default if the argument is omitted. + Returns true if player pn is using modifier sModifier. @@ -2357,6 +2366,9 @@ save yourself some time, copy this for undocumented things: Resets the specific Player's mods to the default settings. + + Save profiles. + Saves the bookkeeping and machine profile data.