Danbias/Code/Game/DanBiasServer/ServerObjects/ClientObject.cpp

40 lines
833 B
C++
Raw Normal View History

2013-12-12 09:33:59 +01:00
#include "ClientObject.h"
using namespace DanBias;
2013-12-13 23:47:16 +01:00
ClientObject::ClientObject(const Oyster::Network::NetworkClient& client)
2013-12-12 09:33:59 +01:00
{
2013-12-13 23:47:16 +01:00
this->client = client;
this->client.SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object);
this->box = 0;
2013-12-12 09:33:59 +01:00
}
ClientObject::~ClientObject()
{
2013-12-13 23:47:16 +01:00
this->client.Disconnect();
2013-12-12 09:33:59 +01:00
}
2013-12-16 09:09:54 +01:00
void ClientObject::SetPostbox(Oyster::PostBox<NetworkSession::NetEvent>* box)
2013-12-13 23:47:16 +01:00
{
this->box = box;
}
GameLogic::Player* ClientObject::Logic_Object()
{
return &this->logicPlayer;
}
Oyster::Network::NetworkClient* ClientObject::NetClient_Object()
{
return &this->client;
}
2013-12-13 23:47:16 +01:00
void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol)
{
if(!this->box) return;
2013-12-16 09:09:54 +01:00
NetworkSession::NetEvent _event;
2013-12-13 23:47:16 +01:00
_event.protocol = protocol;
_event.reciever = this;
this->box->Post(_event);
}
2013-12-12 09:33:59 +01:00