Skip to content

Commit 78b09ea

Browse files
authored
Merge pull request #1 from Kingminer7/patch-1
fix creating a new splashread every menulayer
2 parents e3aafe7 + d0a6c08 commit 78b09ea

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/MenuLayer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class $modify(ST_MenuLayer, MenuLayer)
1010
struct Fields
1111
{
1212
std::string m_SplashStr;
13-
SplashRead* m_SplashRead;
13+
static SplashRead* m_SplashRead;
1414
ScalingLabel* m_SplashText = nullptr;
1515
};
1616

@@ -21,7 +21,7 @@ class $modify(ST_MenuLayer, MenuLayer)
2121
return false;
2222
}
2323

24-
m_fields->m_SplashRead = new SplashRead("splash.splash");
24+
if (!m_fields->m_SplashRead) m_fields->m_SplashRead = new SplashRead("splash.splash");
2525
m_fields->m_SplashStr = m_fields->m_SplashRead->getRandomLine();
2626
auto mainTitle = getChildByID("main-title");
2727

@@ -46,4 +46,6 @@ class $modify(ST_MenuLayer, MenuLayer)
4646
MenuLayer::onExit();
4747
m_fields->m_SplashStr = m_fields->m_SplashRead->getRandomLine();
4848
}
49-
};
49+
};
50+
51+
SplashRead* ST_MenuLayer::Fields::m_SplashRead = nullptr;

0 commit comments

Comments
 (0)