diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index cf404939ce..0d288eed41 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,10 @@ ________________________________________________________________________________ StepMania 5.0 $next | 2011xxxx -------------------------------------------------------------------------------- +2011/10/29 +---------- +* [GameState] Add the ResetPlayerOptions lua binding. [Wolfman2000] + 2011/10/28 ---------- * [ScoreKeeperRave] Fix an issue where the super meter would not decrease back diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index e22eff351b..b6c1904d97 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -790,6 +790,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 6f2baf83d1..5374ab3cb8 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2121,6 +2121,9 @@ Resets the GameState. + + Resets the specific Player's mods to the default settings. + Saves the bookkeeping and machine profile data. diff --git a/src/GameState.cpp b/src/GameState.cpp index 2e48a84286..70c889077c 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -261,7 +261,11 @@ void GameState::ResetPlayer( PlayerNumber pn ) m_pCurTrail[pn].Set( NULL ); m_pPlayerState[pn]->Reset(); PROFILEMAN->UnloadProfile( pn ); + ResetPlayerOptions(pn); +} +void GameState::ResetPlayerOptions( PlayerNumber pn ) +{ PlayerOptions po; GetDefaultPlayerOptions( po ); m_pPlayerState[pn]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); @@ -2445,6 +2449,13 @@ public: static int GetExpandedSectionName( T* p, lua_State *L ) { lua_pushstring(L, p->sExpandedSectionName); return 1; } static int AddStageToPlayer( T* p, lua_State *L ) { p->AddStageToPlayer(Enum::Check(L, 1)); return 0; } static int CurrentOptionsDisqualifyPlayer( T* p, lua_State *L ) { lua_pushboolean(L, p->CurrentOptionsDisqualifyPlayer(Enum::Check(L, 1))); return 1; } + + static int ResetPlayerOptions( T* p, lua_State *L ) + { + p->ResetPlayerOptions(Enum::Check(L, 1)); + return 0; + } + static int Dopefish( T* p, lua_State *L ) { lua_pushboolean(L, p->m_bDopefish); @@ -2554,6 +2565,7 @@ public: ADD_METHOD( GetExpandedSectionName ); ADD_METHOD( AddStageToPlayer ); ADD_METHOD( CurrentOptionsDisqualifyPlayer ); + ADD_METHOD( ResetPlayerOptions ); ADD_METHOD( Dopefish ); } }; diff --git a/src/GameState.h b/src/GameState.h index fadb709559..58639618fc 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -48,6 +48,7 @@ public: /** @brief Reset the GameState back to initial values. */ void Reset(); void ResetPlayer( PlayerNumber pn ); + void ResetPlayerOptions( PlayerNumber pn ); void ApplyCmdline(); // called by Reset void ApplyGameCommand( const RString &sCommand, PlayerNumber pn=PLAYER_INVALID ); /** @brief Start the game when the first player joins in. */