|
|
|
|
|
|
|
#include "statemanagerimp.hpp"
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
#include "../mwbase/journal.hpp"
|
|
|
|
#include "../mwbase/dialoguemanager.hpp"
|
|
|
|
#include "../mwbase/windowmanager.hpp"
|
|
|
|
|
|
|
|
MWState::StateManager::StateManager()
|
|
|
|
: mQuitRequest (false), mState (State_NoGame)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MWState::StateManager::requestQuit()
|
|
|
|
{
|
|
|
|
mQuitRequest = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MWState::StateManager::hasQuitRequest() const
|
|
|
|
{
|
|
|
|
return mQuitRequest;
|
|
|
|
}
|
|
|
|
|
|
|
|
MWState::StateManager::State MWState::StateManager::getState() const
|
|
|
|
{
|
|
|
|
return mState;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MWState::StateManager::newGame (bool bypass)
|
|
|
|
{
|
|
|
|
if (mState!=State_NoGame)
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getDialogueManager()->clear();
|
|
|
|
MWBase::Environment::get().getJournal()->clear();
|
|
|
|
mState = State_NoGame;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bypass)
|
|
|
|
{
|
|
|
|
/// \todo extract cleanup code
|
|
|
|
MWBase::Environment::get().getWorld()->startNewGame();
|
|
|
|
MWBase::Environment::get().getWindowManager()->setNewGame (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
mState = State_Running;
|
|
|
|
}
|