56 lines
870 B
C++
56 lines
870 B
C++
#ifndef _GAMELIST_H_
|
|
#define _GAMELIST_H_
|
|
|
|
#include "config.h"
|
|
#include "list.h"
|
|
#include "netpkt.h"
|
|
#include "timerservice.h"
|
|
|
|
class GameEntry {
|
|
public:
|
|
GameEntry() {};
|
|
~GameEntry() {};
|
|
|
|
struct in_addr addr;
|
|
int port1;
|
|
int port2;
|
|
int gameid;
|
|
|
|
protected:
|
|
GameEntry(const GameEntry& ge);
|
|
GameEntry& operator=(const GameEntry& ge);
|
|
};
|
|
|
|
|
|
class GameList {
|
|
public:
|
|
GameList(Config& conf);
|
|
~GameList();
|
|
|
|
void cleanup();
|
|
void addGame(int gameid, NetPkt* pkt);
|
|
|
|
long getLastUpdate();
|
|
Iterator<GameEntry>* createIterator();
|
|
|
|
protected:
|
|
GameList(const GameList& gl);
|
|
GameList& operator=(const GameList& gl);
|
|
|
|
private:
|
|
class CleanupEvent : public Event {
|
|
public:
|
|
CleanupEvent(GameList& gl) : gl(gl) {}
|
|
~CleanupEvent() {}
|
|
void execute() { gl.cleanup(); }
|
|
|
|
private:
|
|
GameList& gl;
|
|
};
|
|
|
|
List<GameEntry> glist;
|
|
long lastUpdate;
|
|
};
|
|
|
|
#endif // _GAMELIST_H_
|