From 693b9df92884f53f83544fb9cfbb0763fb73365e Mon Sep 17 00:00:00 2001 From: dean11 Date: Thu, 12 Dec 2013 12:54:08 +0100 Subject: [PATCH] Some wierd stuff is going on here --- Code/Game/DanBiasServer/GameServer.cpp | 2 ++ Code/Misc/Thread/OysterThread_Impl.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Code/Game/DanBiasServer/GameServer.cpp b/Code/Game/DanBiasServer/GameServer.cpp index 1cddc318..df352a75 100644 --- a/Code/Game/DanBiasServer/GameServer.cpp +++ b/Code/Game/DanBiasServer/GameServer.cpp @@ -13,12 +13,14 @@ namespace DanBias { using namespace Oyster::Network; + void GameServer::ClientConnectCallback(NetworkClient client) { printf("Client connected!\n"); GameLogic::Protocol_TEST t; t.text = "Hello"; client.Send(t); + c = client; } GameServer::GameServer() : initiated(0) diff --git a/Code/Misc/Thread/OysterThread_Impl.cpp b/Code/Misc/Thread/OysterThread_Impl.cpp index 9605dd78..9e503c54 100644 --- a/Code/Misc/Thread/OysterThread_Impl.cpp +++ b/Code/Misc/Thread/OysterThread_Impl.cpp @@ -42,7 +42,10 @@ using namespace Utility::DynamicMemory; ThreadData() {} ~ThreadData() {} - ThreadData(const ThreadData&) {}; + ThreadData(const ThreadData&) + {}; + const ThreadData& operator =(const ThreadData& o) + {}; }; struct OysterThread::PrivateData { @@ -60,9 +63,14 @@ using namespace Utility::DynamicMemory; { threadData = o.threadData; } + const PrivateData& operator=(const PrivateData& o) + { + threadData = o.threadData; + } ~PrivateData() { //@todo TODO: Make detatch avalible. + //if(!this->threadData->workerThread->joinable()) this->threadData->workerThread->detach(); this->threadData->owner = 0; @@ -75,8 +83,6 @@ using namespace Utility::DynamicMemory; #pragma endregion -int tempId = 0; -std::vector IDS; static void ThreadingFunction(SmartPointer &origin) { @@ -159,6 +165,8 @@ OysterThread::OysterThread(const OysterThread& original) } const OysterThread& OysterThread::operator=(const OysterThread& original) { + delete this->privateData; + this->privateData = new PrivateData(*original.privateData); return *this; } OysterThread::~OysterThread()