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
@@ -32,9 +32,11 @@
//misc
#include "config_utility.hpp"
#include "vector2.hpp"
//STL
#include <map>
#include <string>
//hold the client info
struct Client {
@@ -42,6 +44,16 @@ struct Client {
IPaddress address;
};
//hold the player info
struct Player {
static int counter;
int clientIndex;
std::string handle;
std::string avatar;
Vector2 position;
Vector2 motion;
};
//The main application class
class ServerApplication {
public:
@@ -61,6 +73,9 @@ private:
void HandleJoinRequest(NetworkPacket);
void HandleDisconnect(NetworkPacket);
void HandleShutdown(NetworkPacket);
void HandlePlayerNew(NetworkPacket);
void HandlePlayerDelete(NetworkPacket);
void HandlePlayerUpdate(NetworkPacket);
//networking
UDPNetworkUtility network;
@@ -73,6 +88,7 @@ private:
ConfigUtility config;
std::map<int, Client> clientMap;
std::map<int, Player> playerMap;
};
#endif