Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++
1.6 KB
Raw Blame
#ifndef GAME_STATE_CHARACTERMANAGER_H
#define GAME_STATE_CHARACTERMANAGER_H

#include <filesystem>
#include <list>

#include "character.hpp"

namespace MWState
{
    class CharacterManager
    {
        std::filesystem::path mPath;

        // Uses std::list, so that mCurrent stays valid when characters are deleted
        std::list<Character> mCharacters;

        Character* mCurrent;
        std::string mGame;

    private:
        CharacterManager(const CharacterManager&);
        ///< Not implemented

        CharacterManager& operator=(const CharacterManager&);
        ///< Not implemented

        std::list<Character>::iterator findCharacter(const MWState::Character* character);

    public:
        CharacterManager(std::filesystem::path saves, const std::vector<std::string>& contentFiles);

        Character* getCurrentCharacter();
        ///< @note May return null

        void deleteSlot(const MWState::Slot* slot, const Character*& character);

        Character* createCharacter(const std::string& name);

        /// Isowind: the character whose saves are in this folder, taken on even with no saves yet (a character made
        /// on a multiplayer server, played offline for the first time)
        Character* adoptCharacter(const std::filesystem::path& path);
        ///< Create new character within saved game management
        /// \param name Name for the character (does not need to be unique)

        void setCurrentCharacter(const Character* character);

        std::list<Character>::const_iterator begin() const;

        std::list<Character>::const_iterator end() const;
    };
}

#endif