28 lines
616 B
C++
28 lines
616 B
C++
#include <string.h>
|
|
#include "netpkt.h"
|
|
#include "modhelper.h"
|
|
#include "mod_quake2.h"
|
|
|
|
#define QUAKE2_PORT 27910
|
|
|
|
// scan for latest protocol version
|
|
static const char scanmsg[] = "\xff\xff\xff\xffinfo 34";
|
|
static const char replyhead[] = "\xff\xff\xff\xffinfo";
|
|
|
|
void ModQuake2::scan(MultiSock* msock)
|
|
{
|
|
ModHelper::send(msock, QUAKE2_PORT, scanmsg, strlen(scanmsg));
|
|
}
|
|
|
|
int ModQuake2::parse(NetPkt* pkt, GameList* glist)
|
|
{
|
|
if (pkt->getPort() != QUAKE2_PORT)
|
|
return PARSE_REJECT;
|
|
|
|
if (!pkt->compare(0, replyhead, strlen(replyhead)))
|
|
return PARSE_REJECT;
|
|
|
|
glist->addGame(ID_Q2, pkt);
|
|
return PARSE_ACCEPT;
|
|
}
|