Added check for default gamestate
This commit is contained in:
parent
e540c19860
commit
c3599ed150
@ -47,8 +47,14 @@ namespace nf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::addDefaultState(IGamestate* in) {
|
void Application::addDefaultState(IGamestate* in) {
|
||||||
|
if (!m_defaultStateAdded) {
|
||||||
(*in).onEnter();
|
(*in).onEnter();
|
||||||
m_activeStates.push_back(in);
|
m_activeStates.push_back(in);
|
||||||
|
m_defaultStateAdded = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Error("More than one default state defined"); //TODO: Test this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::run() {
|
void Application::run() {
|
||||||
|
@ -56,5 +56,6 @@ namespace nf {
|
|||||||
//The currently active and loaded states where the top-most is the current one
|
//The currently active and loaded states where the top-most is the current one
|
||||||
std::vector<IGamestate*> m_activeStates;
|
std::vector<IGamestate*> m_activeStates;
|
||||||
IntroGamestate* m_sIntro;
|
IntroGamestate* m_sIntro;
|
||||||
|
bool m_defaultStateAdded = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
Reference in New Issue
Block a user