From d93d900d401d19fa9825bc7c3b56c926c06daa77 Mon Sep 17 00:00:00 2001 From: dean11 Date: Thu, 20 Feb 2014 09:14:42 +0100 Subject: [PATCH] GameServer - Misc --- Code/Game/GameLogic/CollisionManager.cpp | 4 +++- Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp | 4 +--- Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp | 2 ++ Code/Network/NetworkAPI/NetworkClient.cpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 4c21fc8a..cde9b401 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -22,10 +22,12 @@ using namespace GameLogic; //Physics::ICustomBody::SubscriptMessage void Player::PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) { - Player *player = ((Player*)(rigidBodyPlayer->GetCustomTag())); Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed? + if(!realObj) return; + if(!player) return; + switch (realObj->GetObjectType()) { case ObjectSpecialType::ObjectSpecialType_Generic: diff --git a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp index 53e24739..e2a2961d 100644 --- a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp +++ b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp @@ -61,18 +61,16 @@ using namespace DanBias; switch (e.args.type) { case NetworkClient::ClientEventArgs::EventType_Disconnect: - //printf("\t(%i : %s) - EventType_Disconnect\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); + printf("\t(%i : %s) - EventType_Disconnect\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); this->gClients[temp]->Invalidate(); break; case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToRecieve: break; case NetworkClient::ClientEventArgs::EventType_ProtocolFailedToSend: - //printf("\t(%i : %s) - EventType_ProtocolFailedToSend\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); if(this->gClients[temp]->IncrementFailedProtocol() >= 5/*client->threshold*/) this->gClients[temp]->Invalidate(); break; case NetworkClient::ClientEventArgs::EventType_ProtocolRecieved: - //printf("\t(%i : %s) - EventType_ProtocolRecieved\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str()); this->ParseProtocol(e.args.data.protocol, cl); break; } diff --git a/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp b/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp index f2561a52..62332541 100644 --- a/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp +++ b/Code/Game/LanServer/GameServerDebugEnvironment/Source.cpp @@ -10,6 +10,8 @@ using namespace DanBias; + + int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow) { if(SetDllDirectory(L"..\\DLL") == FALSE) diff --git a/Code/Network/NetworkAPI/NetworkClient.cpp b/Code/Network/NetworkAPI/NetworkClient.cpp index a4bc4581..3463ed8a 100644 --- a/Code/Network/NetworkAPI/NetworkClient.cpp +++ b/Code/Network/NetworkAPI/NetworkClient.cpp @@ -64,7 +64,7 @@ struct NetworkClient::PrivateData : public IThreadObject : ID(currID++) , parent(0) , owner(0) - , outputEvent(1) + , outputEvent(0) { InitWinSock(); this->thread.Create(this, false);