41 lines
934 B
C++
41 lines
934 B
C++
#include <string.h>
|
|
#include "netpkt.h"
|
|
#include "modhelper.h"
|
|
#include "mod_ut.h"
|
|
|
|
static struct game_ports port_arr[] = {
|
|
{ 7777, 7788, 0 },
|
|
{ 10777, 10777, 0 },
|
|
{ 0,0,0 }
|
|
};
|
|
|
|
static const char scanmsg_ut2k3[] = { 0x79, 0x00, 0x00, 0x00, 0x00 };
|
|
static const char scanmsg_ut2k4[] = { 0x80, 0x00, 0x00, 0x00, 0x00 };
|
|
|
|
void ModUT::scan(MultiSock* msock)
|
|
{
|
|
ModHelper::send(msock, port_arr, scanmsg_ut2k3, sizeof(scanmsg_ut2k3));
|
|
ModHelper::send(msock, port_arr, scanmsg_ut2k4, sizeof(scanmsg_ut2k4));
|
|
}
|
|
|
|
int ModUT::parse(NetPkt* pkt, GameList* glist)
|
|
{
|
|
/*
|
|
int gameid;
|
|
gameid = ModHelper::checkPorts(pkt, port_arr);
|
|
if (!gameid)
|
|
return PARSE_REJECT;
|
|
*/
|
|
if (pkt->compare(0, scanmsg_ut2k3, sizeof(scanmsg_ut2k3))) {
|
|
glist->addGame(ID_UT2K3, pkt);
|
|
return PARSE_ACCEPT;
|
|
}
|
|
|
|
if (pkt->compare(0, scanmsg_ut2k4, sizeof(scanmsg_ut2k4))) {
|
|
glist->addGame(ID_UT2K4, pkt);
|
|
return PARSE_ACCEPT;
|
|
}
|
|
|
|
return PARSE_REJECT;
|
|
}
|