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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user