Fixed SwitchThemeAndLanguage to run lua scripts when reloading the theme. Removed ForceThemeReload param from GameLoop::ChangeTheme.
This commit is contained in:
+4
-4
@@ -115,12 +115,10 @@ static void CheckFocus()
|
||||
|
||||
// On the next update, change themes, and load sNewScreen.
|
||||
static RString g_NewTheme;
|
||||
static bool g_bForceThemeReload;
|
||||
static RString g_NewGame;
|
||||
void GameLoop::ChangeTheme( const RString &sNewTheme, bool bForced )
|
||||
void GameLoop::ChangeTheme(const RString &sNewTheme)
|
||||
{
|
||||
g_NewTheme = sNewTheme;
|
||||
g_bForceThemeReload = bForced;
|
||||
}
|
||||
|
||||
void GameLoop::ChangeGame(const RString& new_game, const RString& new_theme)
|
||||
@@ -142,7 +140,9 @@ namespace
|
||||
// In case the previous theme overloaded class bindings, reinitialize them.
|
||||
LUA->RegisterTypes();
|
||||
|
||||
THEME->SwitchThemeAndLanguage( g_NewTheme, THEME->GetCurLanguage(), PREFSMAN->m_bPseudoLocalize, g_bForceThemeReload );
|
||||
// We always need to force the theme to reload because we cleared the lua
|
||||
// state by calling RegisterTypes so the scripts in Scripts/ need to run.
|
||||
THEME->SwitchThemeAndLanguage( g_NewTheme, THEME->GetCurLanguage(), PREFSMAN->m_bPseudoLocalize, true );
|
||||
PREFSMAN->m_sTheme.Set( g_NewTheme );
|
||||
|
||||
// Apply the new window title, icon and aspect ratio.
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ namespace GameLoop
|
||||
{
|
||||
void RunGameLoop();
|
||||
void SetUpdateRate( float fUpdateRate );
|
||||
void ChangeTheme( const RString &sNewTheme, bool bForced = false );
|
||||
void ChangeTheme(const RString &sNewTheme);
|
||||
void ChangeGame(const RString& new_game, const RString& new_theme= "");
|
||||
void StartConcurrentRendering();
|
||||
void FinishConcurrentRendering();
|
||||
|
||||
@@ -127,8 +127,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
|
||||
/* If the resolution or aspect ratio changes, always reload the theme.
|
||||
* Otherwise, only reload it if it changed. */
|
||||
RString sNewTheme = PREFSMAN->m_sTheme.Get();
|
||||
bool bForceThemeReload = !!(m_iChangeMask & OPT_APPLY_ASPECT_RATIO) || !!(m_iChangeMask & OPT_APPLY_GRAPHICS);
|
||||
GameLoop::ChangeTheme( sNewTheme, bForceThemeReload );
|
||||
GameLoop::ChangeTheme(sNewTheme);
|
||||
}
|
||||
|
||||
if( m_iChangeMask & OPT_SAVE_PREFERENCES )
|
||||
|
||||
@@ -412,7 +412,7 @@ void ThemeManager::SwitchThemeAndLanguage( const RString &sThemeName_, const RSt
|
||||
// Clear the theme path cache. This caches language-specific graphic paths,
|
||||
// so do this even if only the language is changing.
|
||||
ClearThemePathCache();
|
||||
if( bThemeChanging )
|
||||
if(bThemeChanging || bForceThemeReload)
|
||||
{
|
||||
#if !defined(SMPACKAGE)
|
||||
// reload common sounds
|
||||
|
||||
Reference in New Issue
Block a user