From 31b63e488a69fa8603d3a558c0cc562e4fa243c8 Mon Sep 17 00:00:00 2001 From: oy Date: Fri, 2 Jul 2010 13:15:35 +0200 Subject: [PATCH] fixed connecting to localhost if the client couldn't find the address and small cleanup --- src/engine/client/client.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index eae5ef3ae..925904721 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;