mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Keep address parameter in BeginServer
This commit is contained in:
@@ -343,11 +343,7 @@ namespace Config
|
||||
auto model = &gConfigNetwork;
|
||||
model->player_name = reader->GetCString("player_name", "Player");
|
||||
model->default_port = reader->GetSint32("default_port", NETWORK_DEFAULT_PORT);
|
||||
|
||||
model->listen_address = reader->GetCString("listen_address", "");
|
||||
if (strlen(model->listen_address) == 0)
|
||||
model->listen_address = nullptr;
|
||||
|
||||
model->default_password = reader->GetCString("default_password", nullptr);
|
||||
model->stay_connected = reader->GetBoolean("stay_connected", true);
|
||||
model->advertise = reader->GetBoolean("advertise", true);
|
||||
|
||||
@@ -264,7 +264,7 @@ bool Network::BeginClient(const char* host, uint16 port)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Network::BeginServer(uint16 port)
|
||||
bool Network::BeginServer(uint16 port, const char* address)
|
||||
{
|
||||
Close();
|
||||
if (!Init())
|
||||
@@ -280,7 +280,7 @@ bool Network::BeginServer(uint16 port)
|
||||
listening_socket = CreateTcpSocket();
|
||||
try
|
||||
{
|
||||
listening_socket->Listen(gConfigNetwork.listen_address, port);
|
||||
listening_socket->Listen(address, port);
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
{
|
||||
@@ -2136,7 +2136,11 @@ sint32 network_begin_client(const char *host, sint32 port)
|
||||
|
||||
sint32 network_begin_server(sint32 port)
|
||||
{
|
||||
return gNetwork.BeginServer(port);
|
||||
char *address = nullptr;
|
||||
if (strlen(gConfigNetwork.listen_address) > 0)
|
||||
address = gConfigNetwork.listen_address;
|
||||
|
||||
return gNetwork.BeginServer(port, address);
|
||||
}
|
||||
|
||||
void network_update()
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
bool Init();
|
||||
void Close();
|
||||
bool BeginClient(const char* host, uint16 port);
|
||||
bool BeginServer(uint16 port);
|
||||
bool BeginServer(uint16 port, const char* address);
|
||||
sint32 GetMode();
|
||||
sint32 GetStatus();
|
||||
sint32 GetAuthStatus();
|
||||
|
||||
Reference in New Issue
Block a user