Added a class that client and server inherits from.

Class and server now share the same pointer i game.
You are now able to start a client and a server on the same computer.
This commit is contained in:
Jocke
2015-12-16 14:56:53 +01:00
parent a2d55feed1
commit 58a9d38e26
7 changed files with 64 additions and 23 deletions
+2 -2
View File
@@ -17,9 +17,9 @@
#include "Core/EKeyDown.h"
#include "Core/EKeyUp.h"
#include "Input/EInputCommand.h"
#include "Network/Network.h"
class Client
class Client : public Network
{
public:
Client();
+19
View File
@@ -0,0 +1,19 @@
#ifndef Network_h__
#define Network_h__
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Network/Package.h"
class Network
{
public:
Network();
~Network();
virtual void Start(World* m_world, EventBroker *eventBroker);
virtual void Update();
protected:
};
#endif
+2 -1
View File
@@ -14,8 +14,9 @@
#include "Core/World.h"
#include "Core/EventBroker.h"
#include "Game/ECreatePlayer.h"
#include "Network/Network.h"
class Server
class Server : public Network
{
public:
Server();
+3 -3
View File
@@ -21,6 +21,7 @@
// Network
#include <boost/thread.hpp>
#include "Network/Network.h"
#include "Network/Server.h"
#include "Network/Client.h"
@@ -50,9 +51,8 @@ private:
// Network methods
void NetworkFunction();
Client m_Client;
Server m_Server;
bool m_IsClient = false;
Network* m_ClientOrServer;
bool m_IsClientOrServer = false;
EventRelay<Game, Events::InputCommand> m_EInputCommand;
bool debugOnInputCommand(const Events::InputCommand& e);