From 4617523f8bd60b0f554bfd98a7dc8da4c07dea6f Mon Sep 17 00:00:00 2001 From: dean11 Date: Thu, 12 Dec 2013 20:32:54 +0100 Subject: [PATCH] Gamelogic - Commit because branch switch --- Code/DanBias.sln | 2 -- Code/Game/DanBiasServer/GameServer.cpp | 9 +++++---- .../DanBiasServer/ServerObjects/NetworkSession.cpp | 7 ++++++- Code/Game/GameProtocols/PlayerProtocols.h | 14 +++++++------- Code/Game/GameProtocols/ProtocolIdentificationID.h | 2 +- Code/Network/NetworkDependencies/Listener.cpp | 2 ++ 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 894caec6..fec93854 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -196,7 +196,6 @@ Global {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32 - {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64 {2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32 @@ -208,7 +207,6 @@ Global {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.ActiveCfg = Debug|Win32 - {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|Win32.Build.0 = Debug|Win32 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.ActiveCfg = Debug|x64 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Debug|x64.Build.0 = Debug|x64 {B1195BB9-B3A5-47F0-906C-8DEA384D1520}.Release|Mixed Platforms.ActiveCfg = Release|Win32 diff --git a/Code/Game/DanBiasServer/GameServer.cpp b/Code/Game/DanBiasServer/GameServer.cpp index 1c1dff3b..227359f2 100644 --- a/Code/Game/DanBiasServer/GameServer.cpp +++ b/Code/Game/DanBiasServer/GameServer.cpp @@ -3,11 +3,13 @@ ///////////////////////////////////////////////////////////////////// #include #include +#include #include "GameServer.h" #include "Utilities.h" #include "ServerInitReader.h" #include +#include namespace DanBias { @@ -17,10 +19,7 @@ namespace DanBias void GameServer::ClientConnectCallback(NetworkClient client) { printf("Client connected!\n"); - GameLogic::Protocol_TEST t; - t.text = 'A'; - client.Send(t); - Sleep(50000); + this->mainLobby->AttachClient(Utility::DynamicMemory::SmartPointer(new NetworkClient(client))); } GameServer::GameServer() @@ -65,6 +64,8 @@ namespace DanBias if(!this->server->Start()) return DanBiasServerReturn_Error; + + this->running = true; while (this->running) { diff --git a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp index 569b8a0a..94dc1412 100644 --- a/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp @@ -1,20 +1,24 @@ #include "NetworkSession.h" - +#include namespace DanBias { NetworkSession::NetworkSession() { + } NetworkSession::~NetworkSession() { + } void NetworkSession::AttachClient(Utility::DynamicMemory::SmartPointer client) { + } void NetworkSession::DetachClient(Utility::DynamicMemory::SmartPointer client) { + } void NetworkSession::DetachClient(short ID) { @@ -23,6 +27,7 @@ namespace DanBias void NetworkSession::Kick(Utility::DynamicMemory::SmartPointer client) { + } void NetworkSession::Kick() { diff --git a/Code/Game/GameProtocols/PlayerProtocols.h b/Code/Game/GameProtocols/PlayerProtocols.h index 201e8f1d..d620af81 100644 --- a/Code/Game/GameProtocols/PlayerProtocols.h +++ b/Code/Game/GameProtocols/PlayerProtocols.h @@ -51,7 +51,7 @@ namespace GameLogic Oyster::Network::CustomNetProtocol protocol; }; - struct Protocol_PlayerPosition :public Network::CustomProtocolObject + struct Protocol_PlayerPosition :public Oyster::Network::CustomProtocolObject { float position[3]; // look at dir @@ -59,14 +59,14 @@ namespace GameLogic Protocol_PlayerPosition() { this->protocol[0].value = protocol_PlayerPosition; - this->protocol[0].type = Network::NetAttributeType_Int; + this->protocol[0].type = Oyster::Network::NetAttributeType_Int; - this->protocol[1].type = Network::NetAttributeType_Float; - this->protocol[2].type = Network::NetAttributeType_Float; - this->protocol[3].type = Network::NetAttributeType_Float; + this->protocol[1].type = Oyster::Network::NetAttributeType_Float; + this->protocol[2].type = Oyster::Network::NetAttributeType_Float; + this->protocol[3].type = Oyster::Network::NetAttributeType_Float; } - Network::CustomNetProtocol* GetProtocol() override + Oyster::Network::CustomNetProtocol* GetProtocol() override { this->protocol[1].value = position[0]; @@ -76,7 +76,7 @@ namespace GameLogic } private: - Network::CustomNetProtocol protocol; + Oyster::Network::CustomNetProtocol protocol; }; } diff --git a/Code/Game/GameProtocols/ProtocolIdentificationID.h b/Code/Game/GameProtocols/ProtocolIdentificationID.h index cb0eb552..b872618a 100644 --- a/Code/Game/GameProtocols/ProtocolIdentificationID.h +++ b/Code/Game/GameProtocols/ProtocolIdentificationID.h @@ -7,6 +7,6 @@ #define protocol_PlayerPosition 1 #define protocol_ObjectPosition 2 -#define PROTOCOL_TEST 2 +#define PROTOCOL_TEST 1000 #endif // !GAMEPROTOCOL_PROTOCOL_DEFINITION_ID_H diff --git a/Code/Network/NetworkDependencies/Listener.cpp b/Code/Network/NetworkDependencies/Listener.cpp index b82694d3..20d4c927 100644 --- a/Code/Network/NetworkDependencies/Listener.cpp +++ b/Code/Network/NetworkDependencies/Listener.cpp @@ -19,7 +19,9 @@ Listener::~Listener() { if(connection) { + this->thread.Terminate(); delete connection; + connection = 0; } }