Added check for default gamestate

This commit is contained in:
Grayson Riffe (Laptop) 2021-08-17 14:26:01 -05:00
parent e540c19860
commit c3599ed150
2 changed files with 9 additions and 2 deletions

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() {

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;
};
}