mirror of
https://github.com/tribes2/engine.git
synced 2026-07-10 05:54:39 +00:00
t2 engine svn checkout
This commit is contained in:
commit
ff569bd2ae
988 changed files with 394180 additions and 0 deletions
129
game/net/serverQuery.h
Normal file
129
game/net/serverQuery.h
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _SERVERQUERY_H_
|
||||
#define _SERVERQUERY_H_
|
||||
|
||||
#ifndef _PLATFORM_H_
|
||||
#include "platform/platform.h"
|
||||
#endif
|
||||
#ifndef _EVENT_H_
|
||||
#include "platform/event.h"
|
||||
#endif
|
||||
#ifndef _BITSET_H_
|
||||
#include "core/bitset.h"
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Master server information
|
||||
|
||||
struct MasterInfo
|
||||
{
|
||||
NetAddress address;
|
||||
U32 region;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game Server Information
|
||||
|
||||
struct ServerInfo
|
||||
{
|
||||
enum StatusFlags
|
||||
{
|
||||
// Info flags (0-7):
|
||||
Status_Dedicated = BIT(0),
|
||||
Status_Passworded = BIT(1),
|
||||
Status_Linux = BIT(2),
|
||||
|
||||
// Status flags:
|
||||
Status_New = 0,
|
||||
Status_Querying = BIT(28),
|
||||
Status_Updating = BIT(29),
|
||||
Status_Responded = BIT(30),
|
||||
Status_TimedOut = BIT(31),
|
||||
};
|
||||
|
||||
U8 numPlayers;
|
||||
U8 maxPlayers;
|
||||
U8 numBots;
|
||||
char* name;
|
||||
char* gameType;
|
||||
char* missionName;
|
||||
char* missionType;
|
||||
char* statusString;
|
||||
char* infoString;
|
||||
NetAddress address;
|
||||
U32 version;
|
||||
U32 ping;
|
||||
U32 cpuSpeed;
|
||||
bool isFavorite;
|
||||
BitSet32 status;
|
||||
|
||||
ServerInfo()
|
||||
{
|
||||
numPlayers = 0;
|
||||
maxPlayers = 0;
|
||||
numBots = 0;
|
||||
name = NULL;
|
||||
gameType = NULL;
|
||||
missionType = NULL;
|
||||
missionName = NULL;
|
||||
statusString = NULL;
|
||||
infoString = NULL;
|
||||
version = 0;
|
||||
ping = 0;
|
||||
cpuSpeed = 0;
|
||||
isFavorite = false;
|
||||
status = Status_New;
|
||||
}
|
||||
~ServerInfo();
|
||||
|
||||
bool isNew() { return( status == Status_New ); }
|
||||
bool isQuerying() { return( status.test( Status_Querying ) ); }
|
||||
bool isUpdating() { return( status.test( Status_Updating ) ); }
|
||||
bool hasResponded() { return( status.test( Status_Responded ) ); }
|
||||
bool isTimedOut() { return( status.test( Status_TimedOut ) ); }
|
||||
|
||||
bool isDedicated() { return( status.test( Status_Dedicated ) ); }
|
||||
bool isPassworded() { return( status.test( Status_Passworded ) ); }
|
||||
bool isLinux() { return( status.test( Status_Linux ) ); }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern Vector<ServerInfo> gServerList;
|
||||
extern bool gServerBrowserDirty;
|
||||
extern void clearServerList();
|
||||
extern void queryLanServers( U32 port, U8 flags, bool offline = true );
|
||||
extern void queryMasterGameTypes();
|
||||
extern void queryMasterServer(
|
||||
U32 lanPort,
|
||||
U8 flags,
|
||||
const char* rulesSet,
|
||||
const char* missionType,
|
||||
U8 minPlayers,
|
||||
U8 maxPlayers,
|
||||
U8 maxBots,
|
||||
U32 regionMask,
|
||||
U32 maxPing,
|
||||
U16 minCPU,
|
||||
U8 filterFlags,
|
||||
U8 buddyCount,
|
||||
U32* buddyList );
|
||||
extern void queryFavoriteServers( U8 flags );
|
||||
extern void querySingleServer(const NetAddress* addr, U8 flags);
|
||||
extern void startHeartbeat();
|
||||
extern void sendHeartbeat( U8 flags );
|
||||
|
||||
#ifdef DEBUG
|
||||
extern void addFakeServers( S32 howMany );
|
||||
#endif // DEBUG
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue