From b656ce448d839991d9e2e832cb216f5e67aad551 Mon Sep 17 00:00:00 2001 From: dean11 Date: Wed, 19 Feb 2014 16:22:14 +0100 Subject: [PATCH] GameServer - Debuging GameLogic --- .../Implementation/GameSession_Gameplay.cpp | 8 +++++++ Code/Network/NetworkAPI/NetworkClient.cpp | 21 ++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp index 8cbb542d..64625cd0 100644 --- a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp +++ b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp @@ -61,6 +61,8 @@ using namespace DanBias; switch (e.args.type) { case NetworkClient::ClientEventArgs::EventType_Disconnect: + this->gClients[temp]->GetClient()->Disconnect(); + this->gClients[temp] = 0; break; case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToRecieve: break; @@ -128,6 +130,12 @@ using namespace DanBias; int id = movedObject->GetID(); //Protocol_ObjectPosition p(movedObject->GetPosition(), id); Protocol_ObjectPositionRotation p(movedObject->GetPosition(), movedObject->GetRotation(), id); + + Oyster::Math::Float3 temp = movedObject->GetPosition(); + + if(temp.x < -300) + id = 0; + GameSession::gameSession->Send(p.GetProtocol()); //} } diff --git a/Code/Network/NetworkAPI/NetworkClient.cpp b/Code/Network/NetworkAPI/NetworkClient.cpp index fc561845..e904bb20 100644 --- a/Code/Network/NetworkAPI/NetworkClient.cpp +++ b/Code/Network/NetworkAPI/NetworkClient.cpp @@ -105,11 +105,22 @@ struct NetworkClient::PrivateData : public IThreadObject if(errorCode != 0 && errorCode != WSAEWOULDBLOCK) { - CEA parg; - parg.type = CEA::EventType_ProtocolFailedToSend; - parg.data.protocol = p; - NetEvent e = { this->parent, parg }; - this->recieveQueue.Push(e); + if( errorCode == WSAECONNABORTED || errorCode == WSAENOTCONN) + { + CEA parg; + parg.type = CEA::EventType_Disconnect; + parg.data.protocol = p; + NetEvent e = { this->parent, parg }; + this->recieveQueue.Push(e); + } + else + { + CEA parg; + parg.type = CEA::EventType_ProtocolFailedToSend; + parg.data.protocol = p; + NetEvent e = { this->parent, parg }; + this->recieveQueue.Push(e); + } } }