mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 02:19:55 +00:00
48 lines
991 B
C++
48 lines
991 B
C++
|
|
#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), mRunning (false)
|
|
{
|
|
|
|
}
|
|
|
|
void MWState::StateManager::requestQuit()
|
|
{
|
|
mQuitRequest = true;
|
|
}
|
|
|
|
bool MWState::StateManager::hasQuitRequest() const
|
|
{
|
|
return mQuitRequest;
|
|
}
|
|
|
|
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;
|
|
}
|