Added player support to the server

This code is essentially copied from the old branch, since the two
branches are now functionally identical. How much time have I wasted
rewriting this?
This commit is contained in:
Kayne Ruse
2013-12-06 17:47:03 +11:00
parent f6a4674a2f
commit a3a990cc01
4 changed files with 200 additions and 0 deletions
+16
View File
@@ -24,6 +24,8 @@
#include "SDL/SDL_net.h"
#include "vector2.hpp"
#define PACKET_STRING_SIZE 100
#pragma pack(push, 0)
@@ -56,6 +58,9 @@ union NetworkPacket {
SHUTDOWN = 9,
//Player movement, etc.
PLAYER_NEW = 10,
PLAYER_DELETE = 11,
PLAYER_UPDATE = 12,
};
//metadata on the packet itself
@@ -78,6 +83,17 @@ union NetworkPacket {
int index;
}clientInfo;
//information about a player
struct PlayerInformation {
Metadata meta;
int clientIndex;
int playerIndex;
char handle[PACKET_STRING_SIZE];
char avatar[PACKET_STRING_SIZE];
Vector2 position;
Vector2 motion;
}playerInfo;
//defaults
NetworkPacket() {
meta.type = Type::NONE;