From 87d42931aabe297696a6fb46f25d40d5fffaca50 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 16 Jul 2015 14:35:20 -0700 Subject: [PATCH] Fix for not having address/localaddress set from not localhost --- world/client.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/world/client.cpp b/world/client.cpp index 6d7233256..f109a5cdf 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1224,21 +1224,34 @@ void Client::Clearance(int8 response) const char *zs_addr = nullptr; if(cle && cle->IsLocalClient()) { const char *local_addr = zs->GetCLocalAddress(); + if(local_addr[0]) { zs_addr = local_addr; } else { - struct in_addr in; - in.s_addr = zs->GetIP(); - zs_addr = inet_ntoa(in); + if(strcmp(local_addr, "127.0.0.1") == 0) + { + zs_addr = WorldConfig::get()->LocalAddress.c_str(); + } else { + struct in_addr in; + in.s_addr = zs->GetIP(); + zs_addr = inet_ntoa(in); + } } + } else { const char *addr = zs->GetCAddress(); if(addr[0]) { zs_addr = addr; } else { - struct in_addr in; - in.s_addr = zs->GetIP(); - zs_addr = inet_ntoa(in); + if(strcmp(addr, "127.0.0.1") == 0) + { + zs_addr = WorldConfig::get()->WorldAddress.c_str(); + } + else { + struct in_addr in; + in.s_addr = zs->GetIP(); + zs_addr = inet_ntoa(in); + } } }