2006-04-16 21:37:00 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 04/2006 by Olaf Rempel *
|
|
|
|
* razzor@kopf-tisch.de *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
***************************************************************************/
|
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
|
|
|
}
|