|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: netsrvlist.c,v 1.14 2005/03/28 18:20:26 stpohle Exp $
|
|
|
|
/* $Id: netsrvlist.c,v 1.15 2005/04/06 22:25:27 stpohle Exp $
|
|
|
|
* netsrvlist.c - shows a list of possible servers.*/
|
|
|
|
* netsrvlist.c - shows a list of possible servers.*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "basic.h"
|
|
|
|
#include "basic.h"
|
|
|
@ -32,6 +32,7 @@ void srvlist_rebuildlist () {
|
|
|
|
int ogclst, i, j;
|
|
|
|
int ogclst, i, j;
|
|
|
|
char txt1[255];
|
|
|
|
char txt1[255];
|
|
|
|
char txt2[255];
|
|
|
|
char txt2[255];
|
|
|
|
|
|
|
|
char txt3[255];
|
|
|
|
|
|
|
|
|
|
|
|
/* delete the whole list */
|
|
|
|
/* delete the whole list */
|
|
|
|
for (i = 0; i < MAX_SRVLIST; i++) {
|
|
|
|
for (i = 0; i < MAX_SRVLIST; i++) {
|
|
|
@ -55,6 +56,8 @@ void srvlist_rebuildlist () {
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].version, broadcast_list[i].version, LEN_VERSION);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].version, broadcast_list[i].version, LEN_VERSION);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].gamename, broadcast_list[i].gamename, LEN_GAMENAME);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].gamename, broadcast_list[i].gamename, LEN_GAMENAME);
|
|
|
|
srvlst_dat[srvlst_cnt].ping = broadcast_list[i].ping;
|
|
|
|
srvlst_dat[srvlst_cnt].ping = broadcast_list[i].ping;
|
|
|
|
|
|
|
|
srvlst_dat[srvlst_cnt].curplayers = broadcast_list[i].curplayers;
|
|
|
|
|
|
|
|
srvlst_dat[srvlst_cnt].maxplayers = broadcast_list[i].maxplayers;
|
|
|
|
srvlst_dat[srvlst_cnt].ai_family = bman.net_ai_family;
|
|
|
|
srvlst_dat[srvlst_cnt].ai_family = bman.net_ai_family;
|
|
|
|
if (broadcast_list[i].lan)
|
|
|
|
if (broadcast_list[i].lan)
|
|
|
|
sprintf (srvlst_dat[srvlst_cnt].comment, "LAN");
|
|
|
|
sprintf (srvlst_dat[srvlst_cnt].comment, "LAN");
|
|
|
@ -75,11 +78,14 @@ void srvlist_rebuildlist () {
|
|
|
|
srvlst_dat[srvlst_cnt].ping = -2;
|
|
|
|
srvlst_dat[srvlst_cnt].ping = -2;
|
|
|
|
|
|
|
|
|
|
|
|
srvlst_dat[srvlst_cnt].ai_family = ogc_array[ogclst].ai_family;
|
|
|
|
srvlst_dat[srvlst_cnt].ai_family = ogc_array[ogclst].ai_family;
|
|
|
|
|
|
|
|
srvlst_dat[srvlst_cnt].maxplayers = ogc_array[ogclst].curplayers;
|
|
|
|
|
|
|
|
srvlst_dat[srvlst_cnt].curplayers = ogc_array[ogclst].maxplayers;
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].host,ogc_array[ogclst].host, LEN_SERVERNAME);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].host,ogc_array[ogclst].host, LEN_SERVERNAME);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].port,ogc_array[ogclst].port, LEN_PORT);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].port,ogc_array[ogclst].port, LEN_PORT);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].gamename,ogc_array[ogclst].gamename, LEN_GAMENAME);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].gamename,ogc_array[ogclst].gamename, LEN_GAMENAME);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].version,ogc_array[ogclst].version, LEN_VERSION);
|
|
|
|
strncpy (srvlst_dat[srvlst_cnt].version,ogc_array[ogclst].version, LEN_VERSION);
|
|
|
|
sprintf (srvlst_dat[srvlst_cnt].comment, "INet");
|
|
|
|
sprintf (srvlst_dat[srvlst_cnt].comment, "INet");
|
|
|
|
|
|
|
|
|
|
|
|
srvlst_cnt++;
|
|
|
|
srvlst_cnt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -88,6 +94,8 @@ void srvlist_rebuildlist () {
|
|
|
|
|
|
|
|
|
|
|
|
/* make the list viewable */
|
|
|
|
/* make the list viewable */
|
|
|
|
for (i = 0; i < srvlst_cnt; i++) {
|
|
|
|
for (i = 0; i < srvlst_cnt; i++) {
|
|
|
|
|
|
|
|
sprintf (txt3, "%d/%d",srvlst_dat[i].curplayers, srvlst_dat[i].maxplayers);
|
|
|
|
|
|
|
|
|
|
|
|
if (srvlst_dat[i].ping == -2)
|
|
|
|
if (srvlst_dat[i].ping == -2)
|
|
|
|
txt2[0] = 0;
|
|
|
|
txt2[0] = 0;
|
|
|
|
else if (srvlst_dat[i].ping == -1)
|
|
|
|
else if (srvlst_dat[i].ping == -1)
|
|
|
@ -96,7 +104,7 @@ void srvlist_rebuildlist () {
|
|
|
|
sprintf (txt2, "%dms", srvlst_dat[i].ping);
|
|
|
|
sprintf (txt2, "%dms", srvlst_dat[i].ping);
|
|
|
|
|
|
|
|
|
|
|
|
if (srvlst_dat[i].gamename[0] != 0) /* gamename is present */
|
|
|
|
if (srvlst_dat[i].gamename[0] != 0) /* gamename is present */
|
|
|
|
sprintf (txt1, "%-20s %5s %-11s %-4s", srvlst_dat[i].gamename, txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
|
|
|
|
sprintf (txt1, "%-15s %-5s %5s %-11s %-4s", srvlst_dat[i].gamename, txt3, txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
sprintf (txt1, "%s:%s", srvlst_dat[i].host, srvlst_dat[i].port);
|
|
|
|
sprintf (txt1, "%s:%s", srvlst_dat[i].host, srvlst_dat[i].port);
|
|
|
|
sprintf (txt1, "%-20s %5s %-11s %-4s", txt1,txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
|
|
|
|
sprintf (txt1, "%-20s %5s %-11s %-4s", txt1,txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
|
|
|
|