// // Created by koncord on 04.01.16. // #ifndef OPENMW_NETWORKING_HPP #define OPENMW_NETWORKING_HPP #include #include #include #include "ActorList.hpp" #include "WorldEvent.hpp" #include #include #include #include #include namespace mwmp { class LocalPlayer; class Networking { public: Networking(); ~Networking(); void connect(const std::string& ip, unsigned short port, std::vector &content, Files::Collections &collections); void update(); PlayerPacket *getPlayerPacket(RakNet::MessageID id); ActorPacket *getActorPacket(RakNet::MessageID id); WorldPacket *getWorldPacket(RakNet::MessageID id); RakNet::SystemAddress serverAddress() { return serverAddr; } bool isConnected(); LocalPlayer *getLocalPlayer(); ActorList *getActorList(); WorldEvent *getWorldEvent(); private: bool connected; RakNet::RakPeerInterface *peer; RakNet::SystemAddress serverAddr; RakNet::BitStream bsOut; PlayerPacketController playerPacketController; ActorPacketController actorPacketController; WorldPacketController worldPacketController; ActorList actorList; WorldEvent worldEvent; void receiveMessage(RakNet::Packet *packet); void preInit(std::vector &content, Files::Collections &collections); }; } #endif //OPENMW_NETWORKING_HPP