From 779e3da2866917f87e3b84074e50f5755fd3a6ec Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 12 Feb 2014 17:18:13 -0700 Subject: [PATCH] Added SetAllowLateJoin to ScreenWithMenuElements. --- Docs/Luadoc/Lua.xml | 1 + Docs/Luadoc/LuaDocumentation.xml | 3 +++ src/ScreenWithMenuElements.cpp | 8 ++++++++ src/ScreenWithMenuElements.h | 3 +++ 4 files changed, 15 insertions(+) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 994dd0d681..0f26684e4b 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1377,6 +1377,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index d40e06f3b2..62b16f91c5 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -3903,6 +3903,9 @@ save yourself some time, copy this for undocumented things: Tells the screen to go to the previous screen. + + Sets whether the screen allows late joining. This only works for screens that are just ScreenWithMenuElements, as most derived screens have their own hard coded function for whether late joining is allowed. + diff --git a/src/ScreenWithMenuElements.cpp b/src/ScreenWithMenuElements.cpp index f02d2e1cb4..21bfbd140e 100644 --- a/src/ScreenWithMenuElements.cpp +++ b/src/ScreenWithMenuElements.cpp @@ -25,6 +25,7 @@ ScreenWithMenuElements::ScreenWithMenuElements() FOREACH_PlayerNumber( p ) m_MemoryCardDisplay[p] = NULL; m_MenuTimer = NULL; + m_bShouldAllowLateJoin= false; } void ScreenWithMenuElements::Init() @@ -377,11 +378,18 @@ class LunaScreenWithMenuElements: public Luna public: static int Cancel( T* p, lua_State *L ) { p->Cancel( SM_GoToPrevScreen ); return 0; } static int IsTransitioning( T* p, lua_State *L ) { lua_pushboolean( L, p->IsTransitioning() ); return 1; } + static int SetAllowLateJoin( T* p, lua_State *L ) + { + p->m_bShouldAllowLateJoin= BArg(1); + return 0; + } + LunaScreenWithMenuElements() { ADD_METHOD( Cancel ); ADD_METHOD( IsTransitioning ); + ADD_METHOD( SetAllowLateJoin ); } }; diff --git a/src/ScreenWithMenuElements.h b/src/ScreenWithMenuElements.h index 01d55b7b27..2879e96d64 100644 --- a/src/ScreenWithMenuElements.h +++ b/src/ScreenWithMenuElements.h @@ -33,6 +33,9 @@ public: // Lua virtual void PushSelf( lua_State *L ); + virtual bool AllowLateJoin() const { return m_bShouldAllowLateJoin; } + bool m_bShouldAllowLateJoin; // So that it can be exposed to Lua. + protected: virtual void StartPlayingMusic(); void SetHelpText( RString s );