Merge remote-tracking branch 'origin/Networking' into Networking

This commit is contained in:
Jocke
2015-12-18 11:03:21 +01:00
5 changed files with 14 additions and 41 deletions
-1
View File
@@ -10,7 +10,6 @@
#include "Network/MessageType.h"
#include "Network/PlayerDefinition.h"
#include "Network/SnapshotDefinitions.h"
#include "Network/WinLeakCheck.h"
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Input/EInputCommand.h"
+1 -1
View File
@@ -36,7 +36,7 @@ private:
// Game logic
World* m_World;
EventBroker* m_EventBroker;
// size = ammount of players to create, stores playerID's
// vec.size() = ammount of players to create, stores playerID's
std::vector<unsigned int> m_PlayersToCreate;
// Packet loss logic
@@ -9,12 +9,4 @@ struct SnapshotDefinitions
std::string InputRight;
};
struct IsWASDKeyDown
{
bool W = false;
bool A = false;
bool S = false;
bool D = false;
};
#endif
-17
View File
@@ -1,17 +0,0 @@
#if defined (_WIN64) | defined(_WIN32)
#ifndef WinLeakeCheck_h__
#define WinLeakeCheck_h__
//For memory leak checking
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
#endif
#endif
+13 -14
View File
@@ -13,8 +13,7 @@ Client::Client() : m_Socket(m_IOService)
Client::~Client()
{
// will it work on linux? #if defined (_WIN64) | defined(_WIN32) otherwise.
_CrtDumpMemoryLeaks();
}
void Client::Start(World* world, EventBroker* eventBroker)
@@ -182,9 +181,9 @@ void Client::parsePing()
void Client::parseServerPing()
{
Packet message(MessageType::ServerPing, m_SendPacketID);
message.WriteString("Ping recieved");
send(message);
Packet packet(MessageType::ServerPing, m_SendPacketID);
packet.WriteString("Ping recieved");
send(packet);
}
void Client::parseEventMessage(Packet& packet)
@@ -257,25 +256,25 @@ void Client::send(Packet& packet)
void Client::connect()
{
Packet message(MessageType::Connect, m_SendPacketID);
message.WriteString(m_PlayerName);
Packet packet(MessageType::Connect, m_SendPacketID);
packet.WriteString(m_PlayerName);
m_StartPingTime = std::clock();
send(message);
send(packet);
}
void Client::disconnect()
{
Packet message(MessageType::Connect, m_SendPacketID);
message.WriteString("+Disconnect");
send(message);
Packet packet(MessageType::Connect, m_SendPacketID);
packet.WriteString("+Disconnect");
send(packet);
}
void Client::ping()
{
Packet message(MessageType::Connect, m_SendPacketID);
message.WriteString("Ping");
Packet packet(MessageType::Connect, m_SendPacketID);
packet.WriteString("Ping");
m_StartPingTime = std::clock();
send(message);
send(packet);
}
void Client::moveMessageHead(char*& data, size_t& length, size_t stepSize)