hlswmaster-ng/gamelist.h

57 lines
858 B
C
Raw Normal View History

2006-02-02 16:55:44 +01:00
#ifndef _GAMELIST_H_
#define _GAMELIST_H_
2006-02-19 18:45:56 +01:00
#include "config.h"
#include "list.h"
2006-02-20 12:31:34 +01:00
#include "netpkt.h"
2006-02-19 18:45:56 +01:00
#include "timerservice.h"
2006-02-02 16:55:44 +01:00
class GameEntry {
public:
GameEntry();
~GameEntry();
protected:
GameEntry(const GameEntry& ge);
GameEntry& operator=(const GameEntry& ge);
private:
2006-02-19 18:45:56 +01:00
// struct in_addr addr;
2006-02-02 16:55:44 +01:00
int port1;
int port2;
int gameid;
};
class GameList {
public:
2006-02-19 18:45:56 +01:00
GameList(Config& conf);
~GameList();
void cleanup();
2006-02-20 12:31:34 +01:00
void addGame(int gameid, NetPkt* pkt);
2006-02-02 16:55:44 +01:00
2006-02-19 18:45:56 +01:00
long getLastMod();
Iterator<GameEntry>* createIterator();
2006-02-02 16:55:44 +01:00
protected:
2006-02-19 18:45:56 +01:00
GameList(const GameList& gl);
GameList& operator=(const GameList& gl);
private:
class CleanupEvent : public Command {
public:
CleanupEvent(GameList* gl) : gl(gl) {}
~CleanupEvent() {}
void execute() { gl->cleanup(); }
private:
GameList* gl;
};
List<GameEntry> glist;
2006-02-02 16:55:44 +01:00
};
#endif // _GAMELIST_H_