1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-29 12:20:41 +00:00
OpenMW/apps/openmw/mwbase/statemanager.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
2.6 KiB
C++
Raw Normal View History

2013-11-16 09:31:46 +00:00
#ifndef GAME_MWSTATE_STATEMANAGER_H
#define GAME_MWSTATE_STATEMANAGER_H
#include <filesystem>
#include <list>
#include <string>
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
{
public:
enum State
2022-09-22 18:26:05 +00:00
{
State_NoGame,
State_Ended,
State_Running
2022-09-22 18:26:05 +00:00
};
typedef std::list<MWState::Character>::const_iterator CharacterIterator;
private:
StateManager(const StateManager&);
///< not implemented
2013-11-16 09:31:46 +00:00
StateManager& operator=(const StateManager&);
///< not implemented
2022-09-22 18:26:05 +00:00
public:
2013-11-16 09:31:46 +00:00
StateManager() {}
virtual ~StateManager() {}
virtual void requestQuit() = 0;
2013-11-16 09:31:46 +00:00
virtual bool hasQuitRequest() const = 0;
virtual void askLoadRecent() = 0;
virtual State getState() const = 0;
virtual void newGame(bool bypass = false) = 0;
///< Start a new game.
2022-09-22 18:26:05 +00:00
///
/// \param bypass Skip new game mechanics.
2013-12-19 20:08:34 +00:00
virtual void resumeGame() = 0;
virtual void deleteGame(const MWState::Character* character, const MWState::Slot* slot) = 0;
virtual void saveGame(const std::string& description, const MWState::Slot* slot = nullptr) = 0;
///< 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-18 14:38:08 +00:00
2018-07-26 16:54:08 +00:00
virtual void loadGame(const std::filesystem::path& filepath) = 0;
///< Load a saved game directly from the given file path. This will search the CharacterManager
/// for a Character containing this save file, and set this Character current if one was found.
/// Otherwise, a new Character will be created.
2018-07-26 16:54:08 +00:00
virtual void loadGame(const MWState::Character* character, const std::filesystem::path& filepath) = 0;
///< Load a saved game file belonging to the given character.
2020-11-13 07:39:47 +00:00
/// Simple saver, writes over the file if already existing
/** Used for quick save and autosave **/
virtual void quickSave(std::string = "Quicksave") = 0;
/// Simple loader, loads the last saved file
/** Used for quickload **/
virtual void quickLoad() = 0;
virtual MWState::Character* getCurrentCharacter() = 0;
///< @note May return null.
2013-11-21 11:24:24 +00:00
virtual CharacterIterator characterBegin() = 0;
///< Any call to SaveGame and getCurrentCharacter can invalidate the returned
/// iterator.
virtual CharacterIterator characterEnd() = 0;
2013-11-16 09:31:46 +00:00
};
}
#endif