#pragma region Copyright /* Toxid Game Copyright (C) 2002-2008 Nuclex Development Labs */ #pragma endregion #ifndef TOXID_GAME_GAMESERVER_H #define TOXID_GAME_GAMESERVER_H #include "Toxid.h" #include "Game/Player.h" #include #include namespace Toxid { // ------------------------------------------------------------------------------------------- // class Map; class Planet; // ------------------------------------------------------------------------------------------- // /// Responsible for keeping and updating the running game's state class GameServer { /// Enumerates a list of planets public: class PlanetEnumerator; /// Initializes a new game server public: GameServer() {} /// Releases all resourced owned by the game server public: ~GameServer() {} // // GameServer implementation // /// Adds a new planet to available planets the player can visit /// Unique name of the planet to be added /// Planet to add to the game public: void addPlanet(const string &sName, const shared_ptr &spPlanet); /// Removes all planets from the game public: void clearPlanets(); /// /// Returns an enumerator over all available planets (= episodes / add-ons) /// /// The new planet enumerator public: shared_ptr enumPlanets(); /// Starts a new game on the specified planet /// Planet the player wants to visit public: void startGame(const string &sPlanet); /// Loads the game from the specified stream /// Stream from which to load the game's state public: void loadGame(const shared_ptr &spSource); /// Saves the game into the specified stream /// Stream into which to write the game's state public: void saveGame(const shared_ptr &spDestination); /// Restarts the running game on the current map public: void restartMap(); /// Returns the player instance /// The player instance public: Player &getPlayer() { return m_Player; } /// Returns the currently active map (may be NULL) /// The currently active map or NULL if no map is active public: const shared_ptr &getActiveMap() { return m_spActiveMap; } /// Map of visitable planets by their names private: typedef std::map > PlanetMap; /// All planets the player can visit (planet = episode or add-on) private: PlanetMap m_Planets; /// The player himself (stores the inventory, etc.) private: Player m_Player; /// Map currently being played private: shared_ptr m_spActiveMap; }; // ------------------------------------------------------------------------------------------- // } // namespace Toxid #endif // TOXID_GAME_GAMESERVER_H