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

41 lines
862 B
C++
Raw Normal View History

2013-12-12 09:33:59 +01:00
#include "ClientObject.h"
using namespace DanBias;
2013-12-17 10:25:34 +01:00
ClientObject::ClientObject(Oyster::Network::NetworkClient* client)
2013-12-12 09:33:59 +01:00
{
2013-12-13 23:47:16 +01:00
this->client = client;
2013-12-17 10:25:34 +01:00
this->client->SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object);
2013-12-13 23:47:16 +01:00
this->box = 0;
2013-12-12 09:33:59 +01:00
}
ClientObject::~ClientObject()
{
2013-12-17 10:25:34 +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()
{
2013-12-17 10:25:34 +01:00
return this->client;
}
2013-12-13 23:47:16 +01:00
void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol)
{
2013-12-17 14:15:20 +01:00
//this->client->Send(&protocol);
2013-12-13 23:47:16 +01:00
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