hlswmaster-ng/mod_ut.cpp

40 lines
911 B
C++
Raw Normal View History

2006-03-07 20:32:09 +01:00
#include <string.h>
#include "mod_ut.h"
2006-04-16 21:02:41 +02:00
#include "modhelper.h"
2006-03-07 20:32:09 +01:00
2006-04-07 18:35:14 +02:00
static struct game_ports port_arr[] = {
2006-04-16 21:02:41 +02:00
{ 7777, 7788, 0 },
2006-04-07 18:35:14 +02:00
{ 10777, 10777, 0 },
{ 0,0,0 }
};
2006-03-07 20:32:09 +01:00
2006-04-07 18:35:14 +02:00
static const char scanmsg_ut2k3[] = { 0x79, 0x00, 0x00, 0x00, 0x00 };
static const char scanmsg_ut2k4[] = { 0x80, 0x00, 0x00, 0x00, 0x00 };
2006-03-07 20:32:09 +01:00
void ModUT::scan(MultiSock* msock)
{
2006-04-07 18:35:14 +02:00
ModHelper::send(msock, port_arr, scanmsg_ut2k3, sizeof(scanmsg_ut2k3));
ModHelper::send(msock, port_arr, scanmsg_ut2k4, sizeof(scanmsg_ut2k4));
2006-03-07 20:32:09 +01:00
}
int ModUT::parse(NetPkt* pkt, GameList* glist)
{
2006-04-16 21:02:41 +02:00
/*
2006-04-07 18:35:14 +02:00
int gameid;
gameid = ModHelper::checkPorts(pkt, port_arr);
if (!gameid)
2006-03-07 20:32:09 +01:00
return PARSE_REJECT;
2006-04-07 18:35:14 +02:00
*/
if (pkt->compare(0, scanmsg_ut2k3, sizeof(scanmsg_ut2k3))) {
glist->addGame(ID_UT2K3, pkt);
return PARSE_ACCEPT;
}
2006-04-16 21:02:41 +02:00
2006-04-07 18:35:14 +02:00
if (pkt->compare(0, scanmsg_ut2k4, sizeof(scanmsg_ut2k4))) {
glist->addGame(ID_UT2K4, pkt);
return PARSE_ACCEPT;
}
2006-03-07 20:32:09 +01:00
2006-04-07 18:35:14 +02:00
return PARSE_REJECT;
2006-03-07 20:32:09 +01:00
}