Connection and disconnection are working correctly

I've dummied out the player code, so only the client connection code is
working. Otherwise the protocol hasn't changed.

I've also made a few other tweaks as I went along, but nothing really
major.
This commit is contained in:
Kayne Ruse
2014-03-04 02:46:19 +11:00
parent 7bb5e8ce0d
commit 756d4e770d
5 changed files with 99 additions and 95 deletions
+11 -1
View File
@@ -24,6 +24,7 @@
#include "SDL/SDL_net.h"
#include <functional>
#include <map>
struct ClientEntry {
@@ -32,15 +33,24 @@ struct ClientEntry {
class ClientManager {
public:
//clarity typedefs
typedef std::map<int, ClientEntry> Container;
typedef Container::iterator Iterator;
typedef std::function<void(Iterator)> Lambda;
//returns the internal index
int HandleConnection(IPaddress);
int HandleDisconnection(int i);
//lambdas
void ForEach(Lambda);
//accessors
ClientEntry* GetClient(int i);
ClientEntry* GetClient(IPaddress);
int Size() { return clientMap.size(); }
private:
std::map<int, ClientEntry> clientMap;
Container clientMap;
int counter = 0;
};