EPlayerSpawned special logic added to server and client.

This commit is contained in:
stiffly
2016-01-22 17:49:21 +01:00
parent 74c95089ea
commit 389e057611
5 changed files with 49 additions and 6 deletions
+2
View File
@@ -20,6 +20,7 @@
#include "Input/EInputCommand.h"
#include "Core/EPlayerDamage.h"
#include "Network/EInterpolate.h"
#include "Game/Events/EPlayerSpawned.h"
class Client : public Network
{
@@ -77,6 +78,7 @@ private:
void parsePlayerConnected(Packet& packet);
void parsePing();
void parseKick();
void parsePlayersSpawned(Packet& packet);
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet);
void identifyPacketLoss();
+7 -6
View File
@@ -5,16 +5,17 @@
// Used to determine what type of message was sent.
enum class MessageType
{
Connect,
Disconnect,
Ping,
Message,
Snapshot,
Connect,
Disconnect,
Ping,
Message,
Snapshot,
OnInputCommand,
OnPlayerDamage,
PlayerConnected,
BecomePlayer,
Kick
Kick,
OnPlayerSpawned
};
#endif
+5
View File
@@ -16,6 +16,8 @@
#include "Core/EPlayerDamage.h"
#include "Network/EPlayerDisconnected.h"
#include "Game/Events/EPlayerSpawned.h"
class Server : public Network
{
public:
@@ -58,6 +60,7 @@ private:
int receive(char* data);
void readFromClients();
void send(Packet& packet, UserID user);
void send(Packet& packet, PlayerID player);
void send(Packet& packet);
void broadcast(Packet& packet);
void sendSnapshot();
@@ -78,6 +81,8 @@ private:
// Debug event
EventRelay<Server, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(const Events::InputCommand& e);
EventRelay<Server, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
};
#endif