// // Created by koncord on 05.01.16. // #ifndef OPENMW_PLAYER_HPP #define OPENMW_PLAYER_HPP #include #include #include #include #include #include #include #include #include #include #include #include "Cell.hpp" #include "CellController.hpp" #include "Script/CTypes.h" class Player; typedef std::map TPlayers; typedef std::map TSlots; class Players { public: static void newPlayer(const RakNet::RakNetGUID &guid); static void deletePlayer(const RakNet::RakNetGUID &guid); static Player *getPlayer(const RakNet::RakNetGUID &guid); static Player *getPlayer(unsigned short id); static TPlayers *getPlayers(); static unsigned short getLastPlayerId(); static bool doesPlayerExist(const RakNet::RakNetGUID &guid); private: static TPlayers players; static TSlots slots; }; class Player : public mwmp::BasePlayer { friend class Cell; public: enum { NOTLOADED=0, LOADED, POSTLOADED, KICKED }; Player(const RakNet::RakNetGUID &guid); PlayerId getId(); void setId(unsigned short id); bool isHandshaked(); int getHandshakeAttempts(); void incrementHandshakeAttempts(); void setHandshake(); void setLoadState(int state); int getLoadState(); virtual ~Player(); CellController::TContainer *getCells(); void sendToLoaded(mwmp::PlayerPacket *myPacket); void forEachLoaded(std::function func); private: CellController::TContainer cells; int loadState; int handshakeCounter; unsigned int id; }; #endif //OPENMW_PLAYER_HPP