about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-07-02 13:15:35 +0200
committeroy <Tom_Adams@web.de>2010-07-02 13:15:35 +0200
commit31b63e488a69fa8603d3a558c0cc562e4fa243c8 (patch)
tree200145263f313c57e1e5e599885876db42767994 /src/engine/client
parentbd02c2043e9f76ec47ee9ac35caf23ae294b1dfa (diff)
downloadzcatch-31b63e488a69fa8603d3a558c0cc562e4fa243c8.tar.gz
zcatch-31b63e488a69fa8603d3a558c0cc562e4fa243c8.zip
fixed connecting to localhost if the client couldn't find the address and small cleanup
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/client.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index eae5ef3a..92590472 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -478,7 +478,6 @@ void CClient::EnterGame()
 void CClient::Connect(const char *pAddress)
 {
 	char aBuf[512];
-	const char *pPortStr = 0;
 	int Port = 8303;
 
 	Disconnect();
@@ -494,18 +493,18 @@ void CClient::Connect(const char *pAddress)
 	{
 		if(aBuf[k] == ':')
 		{
-			pPortStr = &(aBuf[k+1]);
+			Port = str_toint(aBuf+k+1);
 			aBuf[k] = 0;
 			break;
 		}
 	}
 
-	if(pPortStr)
-		Port = str_toint(pPortStr);
-
 	// TODO: IPv6 support
 	if(net_host_lookup(aBuf, &m_ServerAddress, NETTYPE_IPV4) != 0)
+	{
 		dbg_msg("client", "could not find the address of %s, connecting to localhost", aBuf);
+		net_host_lookup("localhost", &m_ServerAddress, NETTYPE_IPV4);
+	}
 
 	m_RconAuthed = 0;
 	m_ServerAddress.port = Port;