Only get the external IP if no peers have internal IPs and the IP we're using is a LAN IP

git-svn-id: https://svn.eduke32.com/eduke32@137 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-05-02 03:12:44 +00:00
parent bf48c4c4dc
commit 51b54cf6ad

View file

@ -7607,7 +7607,10 @@ void checkcommandline(int argc,char **argv)
}
if(CommandNet)
{
load_rancid_net(CommandNet);
if(load_rancid_net(CommandNet) != -1)
{
char tmp[16];
qsort((char *)rancid_ip_strings, rancid_players, sizeof(rancid_ip_strings[0]), (int(*)(const void*,const void*))stringsort);
CommandNet = 0;
netparamcount = rancid_players;
@ -7618,7 +7621,6 @@ void checkcommandline(int argc,char **argv)
{
if(Bstrcmp(rancid_ip_strings[j],rancid_ip_strings[MAXPLAYERS]) != 0)
{
char tmp[16];
Bstrncpy(tempbuf,rancid_ip_strings[j], 8);
Bstrcpy(tmp,strtok(tempbuf,"."));
if(Bstrcmp(tmp,"10") == 0)
@ -7637,7 +7639,9 @@ void checkcommandline(int argc,char **argv)
}
}
}
if(j == rancid_players)
Bstrcpy(tempbuf,rancid_ip_strings[MAXPLAYERS]);
Bstrcpy(tmp,strtok(tempbuf,"."));
if(j == rancid_players && ((Bstrcmp(tmp,"192") == 0) || (Bstrcmp(tmp,"172") == 0) || (Bstrcmp(tmp,"10") == 0)))
{
Bsprintf(tempbuf, getexternaladdress());
if(tempbuf[0])
@ -7660,7 +7664,8 @@ void checkcommandline(int argc,char **argv)
}
if(j != netparamcount)
netparam[j] = rancid_local_port_string;
initprintf("ip: %s\n",rancid_ip_strings[MAXPLAYERS]);
}
// initprintf("ip: %s\n",rancid_ip_strings[MAXPLAYERS]);
}
i++;
continue;