summaryrefslogtreecommitdiff
path: root/src/network/core/address.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-02 18:35:59 +0000
committerrubidium <rubidium@openttd.org>2009-04-02 18:35:59 +0000
commit804370d964486ab0ac51a7402e6b30fced5d31af (patch)
tree4f4462080d78106349d22df1edc1ff6cd3edef1b /src/network/core/address.cpp
parentb2e79417833a04bfe5d486e30e5b8fc4a5aec8bb (diff)
downloadopenttd-804370d964486ab0ac51a7402e6b30fced5d31af.tar.xz
(svn r15914) -Codechange: let the content handling make use of NetworkAddress.
Diffstat (limited to 'src/network/core/address.cpp')
-rw-r--r--src/network/core/address.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp
index 637f0fe7b..cbb9defb0 100644
--- a/src/network/core/address.cpp
+++ b/src/network/core/address.cpp
@@ -7,7 +7,9 @@
#ifdef ENABLE_NETWORK
#include "address.h"
+#include "config.h"
#include "host.h"
+#include "../../string_func.h"
const char *NetworkAddress::GetHostname() const
{
@@ -27,4 +29,13 @@ uint32 NetworkAddress::GetIP()
return this->ip;
}
+const char *NetworkAddress::GetAddressAsString() const
+{
+ /* 6 = for the : and 5 for the decimal port number */
+ static char buf[NETWORK_HOSTNAME_LENGTH + 6];
+
+ seprintf(buf, lastof(buf), "%s:%d", this->GetHostname(), this->GetPort());
+ return buf;
+}
+
#endif /* ENABLE_NETWORK */