aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-11 18:39:03 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-11 18:39:03 +0000
commita957b652bae5d1a5320eb01c349437bc7197b91a (patch)
treee0a83c4a59321c9fe728cde2e0572fc8b496e143 /code/qcommon
parent23d2a365bdf5b9e2fdf88809db685512e5fddf7c (diff)
downloadioquake3-aero-a957b652bae5d1a5320eb01c349437bc7197b91a.tar.gz
ioquake3-aero-a957b652bae5d1a5320eb01c349437bc7197b91a.zip
- Revamp in-game server browser: you can now scan for games on multiple master servers, while retaining compatibility with old QVMs.
- Make Master server reporting/server queries ipv6 capable. git-svn-id: svn://svn.icculus.org/quake3/trunk@1311 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r--code/qcommon/net_chan.c31
-rw-r--r--code/qcommon/qcommon.h2
2 files changed, 18 insertions, 15 deletions
diff --git a/code/qcommon/net_chan.c b/code/qcommon/net_chan.c
index e4b1739..8869c01 100644
--- a/code/qcommon/net_chan.c
+++ b/code/qcommon/net_chan.c
@@ -673,17 +673,19 @@ void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len
NET_StringToAdr
Traps "localhost" for loopback, passes everything else to system
+return 0 on address not found, 1 on address found with port, 2 on address found without port.
=============
*/
-qboolean NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family ) {
- qboolean r;
+int NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family )
+{
char base[MAX_STRING_CHARS], *search;
char *port = NULL;
if (!strcmp (s, "localhost")) {
Com_Memset (a, 0, sizeof(*a));
a->type = NA_LOOPBACK;
- return qtrue;
+// as NA_LOOPBACK doesn't require ports report port was given.
+ return 1;
}
Q_strncpyz( base, s, sizeof( base ) );
@@ -719,19 +721,20 @@ qboolean NET_StringToAdr( const char *s, netadr_t *a, netadrtype_t family ) {
search = base;
}
- r = Sys_StringToAdr( search, a, family );
-
- if ( !r ) {
+ if(!Sys_StringToAdr(search, a, family))
+ {
a->type = NA_BAD;
- return qfalse;
+ return 0;
}
- if ( port ) {
- a->port = BigShort( (short)atoi( port ) );
- } else {
- a->port = BigShort( PORT_SERVER );
+ if(port)
+ {
+ a->port = BigShort((short) atoi(port));
+ return 1;
+ }
+ else
+ {
+ a->port = BigShort(PORT_SERVER);
+ return 2;
}
-
- return qtrue;
}
-
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index 0fe6a47..8746f3b 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -171,7 +171,7 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
qboolean NET_IsLocalAddress (netadr_t adr);
const char *NET_AdrToString (netadr_t a);
const char *NET_AdrToStringwPort (netadr_t a);
-qboolean NET_StringToAdr ( const char *s, netadr_t *a, netadrtype_t family);
+int NET_StringToAdr ( const char *s, netadr_t *a, netadrtype_t family);
qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, msg_t *net_message);
void NET_JoinMulticast6(void);
void NET_LeaveMulticast6(void);