summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index f8bdcdc7a..f406a0eea 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -1117,3 +1117,10 @@ uint32 str2ip(const char* ip_str)
{
return ntohl(inet_addr(ip_str));
}
+
+// Reorders bytes from network to little endian (Windows).
+// Neccessary for sending port numbers to the RO client until Gravity notices that they forgot ntohs() calls.
+uint16 ntows(uint16 neshort)
+{
+ return ((neshort & 0xFF) << 8) | ((neshort & 0xFF00) >> 8);
+}