You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.0 KiB
C++
73 lines
2.0 KiB
C++
#ifndef OPENMW_NETWORKING_HPP
|
|
#define OPENMW_NETWORKING_HPP
|
|
|
|
#include <RakPeerInterface.h>
|
|
#include <BitStream.h>
|
|
#include <string>
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
|
|
#include <components/openmw-mp/Controllers/ActorPacketController.hpp>
|
|
#include <components/openmw-mp/Controllers/ObjectPacketController.hpp>
|
|
#include <components/openmw-mp/Controllers/WorldstatePacketController.hpp>
|
|
|
|
#include <components/files/collections.hpp>
|
|
|
|
#include "ActorList.hpp"
|
|
#include "ObjectList.hpp"
|
|
#include "Worldstate.hpp"
|
|
|
|
namespace mwmp
|
|
{
|
|
class LocalPlayer;
|
|
|
|
class Networking
|
|
{
|
|
public:
|
|
Networking();
|
|
~Networking();
|
|
void connect(const std::string& ip, unsigned short port, std::vector<std::string> &content, Files::Collections &collections);
|
|
void update();
|
|
|
|
PlayerPacket *getPlayerPacket(RakNet::MessageID id);
|
|
ActorPacket *getActorPacket(RakNet::MessageID id);
|
|
ObjectPacket *getObjectPacket(RakNet::MessageID id);
|
|
WorldstatePacket *getWorldstatePacket(RakNet::MessageID id);
|
|
|
|
RakNet::SystemAddress serverAddress()
|
|
{
|
|
return serverAddr;
|
|
}
|
|
|
|
bool isConnected();
|
|
|
|
LocalPlayer *getLocalPlayer();
|
|
ActorList *getActorList();
|
|
ObjectList *getObjectList();
|
|
Worldstate *getWorldstate();
|
|
|
|
private:
|
|
bool connected;
|
|
RakNet::RakPeerInterface *peer;
|
|
RakNet::SystemAddress serverAddr;
|
|
RakNet::BitStream bsOut;
|
|
|
|
PlayerPacketController playerPacketController;
|
|
ActorPacketController actorPacketController;
|
|
ObjectPacketController objectPacketController;
|
|
WorldstatePacketController worldstatePacketController;
|
|
|
|
ActorList actorList;
|
|
ObjectList objectList;
|
|
Worldstate worldstate;
|
|
|
|
void receiveMessage(RakNet::Packet *packet);
|
|
|
|
void preInit(std::vector<std::string> &content, Files::Collections &collections);
|
|
};
|
|
}
|
|
|
|
|
|
#endif //OPENMW_NETWORKING_HPP
|