bug fixes: browse connection

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5798 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-11-01 20:06:00 +00:00
parent 6295f8b599
commit c5bf72393d
2 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -61,18 +61,20 @@ void abortconnect()
void connectserv_(const char *servername, const char *serverport = NULL, const char *password = NULL, int role = CR_DEFAULT)
{
const char *defaultport = "28763";
if (!serverport) serverport = defaultport;
extern void enddemoplayback();
if(watchingdemo) enddemoplayback();
if(connpeer)
{
conoutf(_("aborting connection attempt"));
abortconnect();
}
connectrole = role;
copystring(clientpassword, password ? password : "");
ENetAddress address;
int p = 0;
if(serverport && serverport[0]) p = atoi(serverport);
address.port = p > 0 ? p : CUBE_DEFAULT_SERVER_PORT;
+3 -3
View File
@@ -1098,7 +1098,7 @@ int main(int argc, char **argv)
case 'e': initscript = &argv[i][2]; break;
default: conoutf("\f3unknown commandline option: -%c", argv[i][1]);
}
else if(!strncmp(argv[i], "assaultcube://", 13)) // browser direct connection
else if(!strncmp(argv[i], "assaultcube://", 14)) // browser direct connection
{
const char *c = &argv[i][14], *p = c;
int len = 0;
@@ -1108,8 +1108,8 @@ int main(int argc, char **argv)
strncpy(servername,p,len);
servername[len] = '\0';
direct_connect = true;
c++;
if (*c!='?') continue;
if (*c) c++;
if (!*c || *c!='?') continue;
c++;
if (!strncmp(c, "port=", 5))
{