Added check for default gamestate

This commit is contained in:
grayson committed 2021-08-17 14:26:01 -05:00
1 parent e540c19860
commit c3599ed150
2 files changed
+9 -2

No files matched your search

+8 -2
View File
@@ -47,8 +47,14 @@ namespace nf {
}
void Application::addDefaultState(IGamestate* in) {
(*in).onEnter();
m_activeStates.push_back(in);
if (!m_defaultStateAdded) {
(*in).onEnter();
m_activeStates.push_back(in);
m_defaultStateAdded = true;
}
else {
Error("More than one default state defined"); //TODO: Test this
}
}
void Application::run() {
+1
View File
@@ -56,5 +56,6 @@ namespace nf {
//The currently active and loaded states where the top-most is the current one
std::vector<IGamestate*> m_activeStates;
IntroGamestate* m_sIntro;
bool m_defaultStateAdded = false;
};
}