Cleaned up code in Client.h and Client.cpp.

Moved ping code into Ping() function.
This commit is contained in:
Jocke
2015-12-08 17:18:03 +01:00
parent d1880754f5
commit 24dada149f
2 changed files with 20 additions and 117 deletions
+1 -9
View File
@@ -4,8 +4,6 @@
#include <string>
#include <ctime>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <glm/common.hpp>
#include <GLFW/glfw3.h> // For input event
@@ -26,14 +24,13 @@ public:
private:
// Threaded
void DisplayLoop();
void ReadFromServer();
void InputLoop();
int Receive(char* data, size_t length);
int CreateMessage(MessageType type, std::string message, char* data);
void Connect();
void Disconnect();
void Ping();
void MoveMessageHead(char*& data, size_t& length, size_t stepSize);
void ParseMessageType(char* data, size_t length);
void ParseEventMessage(char* data, size_t length);
@@ -41,9 +38,6 @@ private:
void ParsePing();
void ParseServerPing();
void ParseSnapshot(char* data, size_t length);
//void SendInput();
void SendDebugInput();
void DrawBoard();
// udp stuff
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
@@ -51,12 +45,10 @@ private:
boost::asio::ip::udp::socket m_Socket;
int m_PlayerID = -1;
char m_GameBoard[BOARDSIZE][BOARDSIZE];
glm::vec2 m_PlayerPositions[MAXCONNECTIONS];
std::string m_PlayerNames[MAXCONNECTIONS];
std::clock_t m_StartPingTime;
double m_DurationOfPingTime;
bool m_ShouldDrawGameBoard = true;
std::string m_PlayerName;
bool m_ThreadIsRunning = true;