2006-02-02 16:55:44 +01:00
|
|
|
#include "logging.h"
|
|
|
|
#include "modulelist.h"
|
|
|
|
|
|
|
|
ModuleList::ModuleList()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ModuleList::~ModuleList()
|
|
|
|
{
|
|
|
|
while (!mlist.isEmpty())
|
|
|
|
delete mlist.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModuleList::reg(Module* mod)
|
|
|
|
{
|
2006-02-05 12:00:47 +01:00
|
|
|
LogSystem::log(LOG_NOTICE, "Loading Module '%s'", mod->getName());
|
2006-02-02 16:55:44 +01:00
|
|
|
mlist.addTail(mod);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModuleList::scan(MultiSock* msock)
|
|
|
|
{
|
|
|
|
Iterator<Module> *it = mlist.createIterator();
|
|
|
|
while (it->hasNext())
|
|
|
|
it->next()->scan(msock);
|
|
|
|
|
|
|
|
delete it;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ModuleList::parse(NetPkt* pkt, GameList* slist)
|
|
|
|
{
|
|
|
|
int retval = PKT_REJECT;
|
|
|
|
|
|
|
|
Iterator<Module> *it = mlist.createIterator();
|
|
|
|
while (it->hasNext()) {
|
|
|
|
retval = it->next()->parse(pkt, slist);
|
|
|
|
if (retval != PKT_REJECT)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete it;
|
|
|
|
return retval;
|
|
|
|
}
|