2013-11-16 09:31:46 +00:00
|
|
|
#ifndef GAME_MWSTATE_STATEMANAGER_H
|
|
|
|
#define GAME_MWSTATE_STATEMANAGER_H
|
|
|
|
|
2013-11-21 10:10:18 +00:00
|
|
|
#include <vector>
|
2013-11-24 14:19:56 +00:00
|
|
|
#include <string>
|
2013-11-21 10:10:18 +00:00
|
|
|
|
2013-11-19 14:38:26 +00:00
|
|
|
namespace MWState
|
|
|
|
{
|
|
|
|
struct Slot;
|
|
|
|
class Character;
|
|
|
|
}
|
|
|
|
|
2013-11-16 09:31:46 +00:00
|
|
|
namespace MWBase
|
|
|
|
{
|
|
|
|
/// \brief Interface for game state manager (implemented in MWState)
|
|
|
|
class StateManager
|
|
|
|
{
|
2013-11-18 14:15:47 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum State
|
|
|
|
{
|
|
|
|
State_NoGame,
|
|
|
|
State_Ended,
|
|
|
|
State_Running
|
|
|
|
};
|
|
|
|
|
2013-11-21 10:10:18 +00:00
|
|
|
typedef std::vector<MWState::Character>::const_iterator CharacterIterator;
|
|
|
|
|
2013-11-16 09:31:46 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
StateManager (const StateManager&);
|
|
|
|
///< not implemented
|
|
|
|
|
|
|
|
StateManager& operator= (const StateManager&);
|
|
|
|
///< not implemented
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
StateManager() {}
|
|
|
|
|
|
|
|
virtual ~StateManager() {}
|
2013-11-16 10:07:23 +00:00
|
|
|
|
|
|
|
virtual void requestQuit() = 0;
|
|
|
|
|
|
|
|
virtual bool hasQuitRequest() const = 0;
|
2013-11-16 11:22:28 +00:00
|
|
|
|
2013-12-19 20:08:34 +00:00
|
|
|
virtual void askLoadRecent() = 0;
|
|
|
|
|
2013-11-18 14:15:47 +00:00
|
|
|
virtual State getState() const = 0;
|
2013-11-16 11:22:28 +00:00
|
|
|
|
|
|
|
virtual void newGame (bool bypass = false) = 0;
|
|
|
|
///< Start a new game.
|
|
|
|
///
|
|
|
|
/// \param bypass Skip new game mechanics.
|
2013-11-18 14:38:08 +00:00
|
|
|
|
|
|
|
virtual void endGame() = 0;
|
2013-11-19 14:38:26 +00:00
|
|
|
|
2014-04-28 18:57:45 +00:00
|
|
|
virtual void deleteGame (const MWState::Character *character, const MWState::Slot *slot) = 0;
|
|
|
|
|
2013-11-24 14:19:56 +00:00
|
|
|
virtual void saveGame (const std::string& description, const MWState::Slot *slot = 0) = 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 MWState::Character *character, const MWState::Slot *slot) = 0;
|
|
|
|
///< Load a saved game file from \a slot.
|
|
|
|
///
|
|
|
|
/// \note \a slot must belong to \a character.
|
|
|
|
|
2014-04-24 07:06:36 +00:00
|
|
|
///Simple saver, writes over the file if already existing
|
|
|
|
/** Used for quick save and autosave **/
|
|
|
|
virtual void quickSave(std::string = "Quicksave")=0;
|
|
|
|
|
2014-04-24 07:14:47 +00:00
|
|
|
///Simple loader, loads the last saved file
|
|
|
|
/** Used for quickload **/
|
|
|
|
virtual void quickLoad()=0;
|
|
|
|
|
2013-11-24 15:58:41 +00:00
|
|
|
virtual MWState::Character *getCurrentCharacter (bool create = true) = 0;
|
|
|
|
///< \param create Create a new character, if there is no current character.
|
2013-11-21 10:10:18 +00:00
|
|
|
|
|
|
|
virtual CharacterIterator characterBegin() = 0;
|
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() = 0;
|
2013-11-28 08:33:50 +00:00
|
|
|
|
|
|
|
virtual void update (float duration) = 0;
|
2013-11-16 09:31:46 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|