2013-11-16 09:31:46 +00:00
|
|
|
#ifndef GAME_STATE_STATEMANAGER_H
|
|
|
|
#define GAME_STATE_STATEMANAGER_H
|
|
|
|
|
2014-01-27 12:27:42 +00:00
|
|
|
#include <map>
|
|
|
|
|
2013-11-16 09:31:46 +00:00
|
|
|
#include "../mwbase/statemanager.hpp"
|
|
|
|
|
2013-11-19 14:38:26 +00:00
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
|
|
|
#include "charactermanager.hpp"
|
|
|
|
|
2013-11-16 09:31:46 +00:00
|
|
|
namespace MWState
|
|
|
|
{
|
|
|
|
class StateManager : public MWBase::StateManager
|
|
|
|
{
|
2013-11-16 10:07:23 +00:00
|
|
|
bool mQuitRequest;
|
2013-12-19 20:08:34 +00:00
|
|
|
bool mAskLoadRecent;
|
2013-11-18 14:15:47 +00:00
|
|
|
State mState;
|
2013-11-19 14:38:26 +00:00
|
|
|
CharacterManager mCharacterManager;
|
2013-11-28 08:33:50 +00:00
|
|
|
double mTimePlayed;
|
2013-11-16 10:07:23 +00:00
|
|
|
|
2013-11-28 10:22:34 +00:00
|
|
|
private:
|
|
|
|
|
2014-01-23 10:29:40 +00:00
|
|
|
void cleanup (bool force = false);
|
2013-11-28 10:22:34 +00:00
|
|
|
|
2014-01-27 12:27:42 +00:00
|
|
|
std::map<int, int> buildContentFileIndexMap (const ESM::ESMReader& reader) const;
|
|
|
|
|
2013-11-16 09:31:46 +00:00
|
|
|
public:
|
|
|
|
|
2013-11-25 12:00:05 +00:00
|
|
|
StateManager (const boost::filesystem::path& saves, const std::string& game);
|
2013-11-16 09:31:46 +00:00
|
|
|
|
2013-11-16 10:07:23 +00:00
|
|
|
virtual void requestQuit();
|
|
|
|
|
|
|
|
virtual bool hasQuitRequest() const;
|
2013-11-16 11:22:28 +00:00
|
|
|
|
2013-12-19 20:08:34 +00:00
|
|
|
virtual void askLoadRecent();
|
|
|
|
|
2013-11-18 14:15:47 +00:00
|
|
|
virtual State getState() const;
|
2013-11-16 11:22:28 +00:00
|
|
|
|
|
|
|
virtual void newGame (bool bypass = false);
|
|
|
|
///< Start a new game.
|
|
|
|
///
|
|
|
|
/// \param bypass Skip new game mechanics.
|
2013-11-18 14:38:08 +00:00
|
|
|
|
|
|
|
virtual void endGame();
|
2013-11-19 14:38:26 +00:00
|
|
|
|
2013-11-24 14:19:56 +00:00
|
|
|
virtual void saveGame (const std::string& description, const Slot *slot = 0);
|
2013-11-19 14:38:26 +00:00
|
|
|
///< Write a saved game to \a slot or create a new slot if \a slot == 0.
|
|
|
|
///
|
|
|
|
/// \note Slot must belong to the current character.
|
|
|
|
|
2013-11-21 11:24:24 +00:00
|
|
|
virtual void loadGame (const Character *character, const Slot *slot);
|
|
|
|
///< Load a saved game file from \a slot.
|
|
|
|
///
|
|
|
|
/// \note \a slot must belong to \a character.
|
|
|
|
|
2013-11-24 15:58:41 +00:00
|
|
|
virtual Character *getCurrentCharacter (bool create = true);
|
|
|
|
///< \param create Create a new character, if there is no current character.
|
2013-11-21 10:10:18 +00:00
|
|
|
|
|
|
|
virtual CharacterIterator characterBegin();
|
2013-11-21 11:29:24 +00:00
|
|
|
///< Any call to SaveGame and getCurrentCharacter can invalidate the returned
|
|
|
|
/// iterator.
|
2013-11-21 10:10:18 +00:00
|
|
|
|
|
|
|
virtual CharacterIterator characterEnd();
|
2013-11-28 08:33:50 +00:00
|
|
|
|
|
|
|
virtual void update (float duration);
|
2013-11-16 09:31:46 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|