summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/netcomputer.cpp5
-rw-r--r--src/net/netcomputer.hpp5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/net/netcomputer.cpp b/src/net/netcomputer.cpp
index ff2bbb7..2ce30c0 100644
--- a/src/net/netcomputer.cpp
+++ b/src/net/netcomputer.cpp
@@ -103,3 +103,8 @@ operator <<(std::ostream &os, const NetComputer &comp)
return os;
}
+
+int NetComputer::getIP()
+{
+ return mPeer->address.host;
+}
diff --git a/src/net/netcomputer.hpp b/src/net/netcomputer.hpp
index b85456a..2c4d706 100644
--- a/src/net/netcomputer.hpp
+++ b/src/net/netcomputer.hpp
@@ -81,6 +81,11 @@ class NetComputer
send(const MessageOut &msg, bool reliable = true,
unsigned int channel = 0);
+ /**
+ * Returns IP address of computer in 32bit int form
+ */
+ int getIP();
+
private:
ENetPeer *mPeer; /**< Client peer */