Used config for a lot of things

This commit is contained in:
stiffly
2016-01-22 11:53:04 +01:00
parent fcc9d64e7a
commit 08fcdb382b
9 changed files with 50 additions and 52 deletions
+2 -2
View File
@@ -57,12 +57,12 @@ private:
std::unordered_map<EntityID, EntityID> m_ClientIDToServerID;
// Network logic
PlayerDefinition m_PlayerDefinitions[MAXCONNECTIONS];
PlayerDefinition m_PlayerDefinitions[8];
SnapshotDefinitions m_NextSnapshot;
double m_DurationOfPingTime;
std::clock_t m_StartPingTime;
std::clock_t m_TimeSinceSentInputs;
unsigned int m_SendInputIntervalMs = 33;
unsigned int m_SendInputIntervalMs;
std::vector<Events::InputCommand> m_InputCommandBuffer;
// Private member functions
+5 -2
View File
@@ -7,12 +7,12 @@
#include "Core/EventBroker.h"
#include "Network/Packet.h"
#include "Network/NetworkData.h"
#include "Core/ResourceManager.h"
#include "Core/ConfigFile.h"
#include <fstream>
#include <iostream>
#define MAXCONNECTIONS 8
#define INPUTSIZE 4097
#define TIMEOUTMS 15000
class Network
{
@@ -26,8 +26,11 @@ protected:
NetworkData m_NetworkData;
unsigned int m_SaveDataIntervalMs = 1000;
std::clock_t m_SaveDataTimer;
unsigned int m_MaxConnections;
unsigned int m_TimeoutMs;
void saveToFile();
void updateNetworkData();
void initialize();
};
#endif
+3 -3
View File
@@ -30,7 +30,7 @@ private:
boost::asio::ip::udp::socket m_Socket;
// Sending messages to client logic
PlayerDefinition m_PlayerDefinitions[MAXCONNECTIONS];
PlayerDefinition m_PlayerDefinitions[8]; //
std::vector<PlayerDefinition> m_ConnectedUsers;
char readBuffer[INPUTSIZE] = { 0 };
int bytesRead = 0;
@@ -39,8 +39,8 @@ private:
std::clock_t previousSnapshotMessage = std::clock();
std::clock_t timOutTimer = std::clock();
// How often we send messages (milliseconds)
int intervalMs = 1000;
int snapshotInterval = 50;
int pingIntervalMs;
int snapshotInterval;
int checkTimeOutInterval = 100;
//Timers