hlswmaster-ng/gamelist.cpp

40 lines
684 B
C++
Raw Normal View History

2006-02-20 12:31:34 +01:00
#include "logging.h"
2006-02-19 18:45:56 +01:00
#include "gamelist.h"
#define DEFAULT_TIMEOUT 180
GameList::GameList(Config& conf)
2006-02-20 21:58:59 +01:00
: lastUpdate(0)
2006-02-19 18:45:56 +01:00
{
int interval = conf.getInteger("global", "game_timeout", DEFAULT_TIMEOUT);
2006-02-20 21:58:59 +01:00
TimerService::registerTimer(new Timer(new CleanupEvent(*this), interval));
2006-02-19 18:45:56 +01:00
}
GameList::~GameList()
{
}
void GameList::cleanup()
{
}
2006-02-20 21:58:59 +01:00
long GameList::getLastUpdate()
2006-02-19 18:45:56 +01:00
{
2006-02-20 21:58:59 +01:00
lastUpdate++;
return lastUpdate;
2006-02-19 18:45:56 +01:00
}
Iterator<GameEntry>* GameList::createIterator()
{
2006-02-20 21:58:59 +01:00
return glist.createIterator();
2006-02-19 18:45:56 +01:00
}
2006-02-20 12:31:34 +01:00
void GameList::addGame(int gameid, NetPkt* pkt)
{
char buf[64];
pkt->show(buf, sizeof(buf));
LogSystem::log(LOG_NOTICE, "Adding Game %d: %s", gameid, buf);
2006-02-20 21:58:59 +01:00
glist.add(new GameEntry());
2006-02-20 12:31:34 +01:00
}