diff --git a/NothinFancy/src/Application.cpp b/NothinFancy/src/Application.cpp index d753e5d..db14924 100644 --- a/NothinFancy/src/Application.cpp +++ b/NothinFancy/src/Application.cpp @@ -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() { diff --git a/NothinFancy/src/include/Application.h b/NothinFancy/src/include/Application.h index de9092d..5fdfc96 100644 --- a/NothinFancy/src/include/Application.h +++ b/NothinFancy/src/include/Application.h @@ -56,5 +56,6 @@ namespace nf { //The currently active and loaded states where the top-most is the current one std::vector m_activeStates; IntroGamestate* m_sIntro; + bool m_defaultStateAdded = false; }; } \ No newline at end of file