From faeef00bb63623089d706c0c5b411b344d92bd9e Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 3 Feb 2022 22:57:49 +0100 Subject: Added hostname to the server configuration This is in order to avoid default lookup for local address, which usually caused the game to bind to a LAN address hence effectively disallowing any other traffic in. For now there is no option in GUI to configure the hostname. Menus definitions are in the game files, so I should avoid any changes that can cause the binary to be incompatible with currently available resource packs. --- Stars45/NetGameServer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Stars45/NetGameServer.cpp') diff --git a/Stars45/NetGameServer.cpp b/Stars45/NetGameServer.cpp index f2293a4..42e770f 100644 --- a/Stars45/NetGameServer.cpp +++ b/Stars45/NetGameServer.cpp @@ -58,6 +58,7 @@ #include "Hangar.h" #include "FlightDeck.h" #include "Mission.h" +#include "Text.h" #include "NetLayer.h" #include "NetHost.h" @@ -77,12 +78,15 @@ NetGameServer::NetGameServer() { Print("Constructing NetGameServer\n"); + Text hostname = "0.0.0.0"; WORD server_port = 11101; - if (NetServerConfig::GetInstance()) - server_port = NetServerConfig::GetInstance()->GetGamePort(); + if (NetServerConfig::GetInstance()) { + hostname = NetServerConfig::GetInstance()->Hostname(); + server_port = NetServerConfig::GetInstance()->GetGamePort(); + } - NetAddr server(NetHost().Address().IPAddr(), server_port); + NetAddr server(hostname.data(), server_port); link = new(__FILE__,__LINE__) NetLink(server); -- cgit v1.1