2013-11-16 09:31:46 +00:00
|
|
|
|
|
|
|
#include "statemanagerimp.hpp"
|
|
|
|
|
2013-11-16 11:22:28 +00:00
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
#include "../mwbase/journal.hpp"
|
|
|
|
#include "../mwbase/dialoguemanager.hpp"
|
|
|
|
#include "../mwbase/windowmanager.hpp"
|
|
|
|
|
2013-11-16 09:31:46 +00:00
|
|
|
MWState::StateManager::StateManager()
|
2013-11-16 11:22:28 +00:00
|
|
|
: mQuitRequest (false), mRunning (false)
|
2013-11-16 09:31:46 +00:00
|
|
|
{
|
|
|
|
|
2013-11-16 10:07:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MWState::StateManager::requestQuit()
|
|
|
|
{
|
|
|
|
mQuitRequest = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MWState::StateManager::hasQuitRequest() const
|
|
|
|
{
|
|
|
|
return mQuitRequest;
|
2013-11-16 11:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool MWState::StateManager::isGameRunning() const
|
|
|
|
{
|
|
|
|
return mRunning;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MWState::StateManager::newGame (bool bypass)
|
|
|
|
{
|
|
|
|
if (mRunning)
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getDialogueManager()->clear();
|
|
|
|
MWBase::Environment::get().getJournal()->clear();
|
|
|
|
mRunning = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bypass)
|
|
|
|
{
|
|
|
|
/// \todo extract cleanup code
|
|
|
|
MWBase::Environment::get().getWorld()->startNewGame();
|
|
|
|
MWBase::Environment::get().getWindowManager()->setNewGame (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
mRunning = true;
|
|
|
|
}
|