Skip to content

Commit 41aa50e

Browse files
committed
WIP: Begin rewriting serverbrowser
1 parent 548be38 commit 41aa50e

27 files changed

+265
-333
lines changed

engine/masterserver.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ class CMaster : public IMaster, public IServersInfo
8080
bool m_bNoMasters;
8181

8282
CUtlLinkedList<netadr_t> m_serverAddresses;
83+
84+
IServerListResponse *m_serverListResponse;
8385
};
8486

8587
static CMaster s_MasterServer;
8688
IMaster *master = (IMaster *)&s_MasterServer;
8789

8890
IServersInfo *g_pServersInfo = (IServersInfo*)&s_MasterServer;
8991

92+
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMaster, IServersInfo, SERVERLIST_INTERFACE_VERSION, s_MasterServer );
93+
9094
#define HEARTBEAT_SECONDS 140.0
9195

9296
//-----------------------------------------------------------------------------
@@ -97,6 +101,9 @@ CMaster::CMaster( void )
97101
m_pMasterAddresses = NULL;
98102
m_bNoMasters = false;
99103
m_bInitialized = false;
104+
105+
m_serverListResponse = NULL;
106+
100107
Init();
101108
}
102109

@@ -165,6 +172,11 @@ void CMaster::ProcessConnectionlessPacket( netpacket_t *packet )
165172
char hostname[1024];
166173
msg.ReadString(hostname, sizeof(hostname));
167174

175+
newgameserver_t s;
176+
s.m_NetAdr = packet->from;
177+
s.SetName( hostname );
178+
179+
m_serverListResponse->ServerResponded( s );
168180
break;
169181
}
170182
}
@@ -180,6 +192,8 @@ void CMaster::RequestServersInfo()
180192
{
181193
const netadr_t adr = m_serverAddresses[i];
182194

195+
Msg("Request server info %s\n", adr.ToString());
196+
183197
msg.WriteLong( CONNECTIONLESS_HEADER );
184198
msg.WriteByte( C2S_INFOREQUEST );
185199

@@ -474,6 +488,8 @@ void CMaster::RequestInternetServerList(const char *gamedir, IServerListResponse
474488
{
475489
if( m_bNoMasters ) return;
476490

491+
m_serverListResponse = response;
492+
477493
ALIGN4 char buf[256] ALIGN4_POST;
478494
bf_write msg(buf, sizeof(buf));
479495

0 commit comments

Comments
 (0)