diff options
author | rubidium <rubidium@openttd.org> | 2009-04-03 10:29:56 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-03 10:29:56 +0000 |
commit | 47602d7b60e40821c364dbd07161caaf30803d52 (patch) | |
tree | 3554d71e91f71f222be628b9cc55036280083b66 /src/network/network.cpp | |
parent | dccfba6e20cdc4bb6d068f075e9b6d7fefee0fb0 (diff) | |
download | openttd-47602d7b60e40821c364dbd07161caaf30803d52.tar.xz |
(svn r15925) -Codechange: remove _network_server_bind_ip as it's pretty AF dependant.
Diffstat (limited to 'src/network/network.cpp')
-rw-r--r-- | src/network/network.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp index 88206ae0c..8bf97e873 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -62,7 +62,6 @@ uint32 _frame_counter_max; // To where we may go with our clients uint32 _frame_counter; uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients. uint32 _broadcast_list[MAX_INTERFACES + 1]; -uint32 _network_server_bind_ip; uint32 _sync_seed_1, _sync_seed_2; uint32 _sync_frame; bool _network_first_time; @@ -776,7 +775,7 @@ bool NetworkServerStart() /* Try to start UDP-server */ _network_udp_server = true; - _network_udp_server = _udp_server_socket->Listen(NetworkAddress(_network_server_bind_ip, _settings_client.network.server_port), false); + _network_udp_server = _udp_server_socket->Listen(NetworkAddress(_settings_client.network.server_bind_ip, _settings_client.network.server_port), false); _network_company_states = CallocT<NetworkCompanyState>(MAX_COMPANIES); _network_server = true; @@ -1097,10 +1096,10 @@ void NetworkStartUp() _network_need_advertise = true; _network_advertise_retries = 0; - /* Load the ip from the openttd.cfg */ - _network_server_bind_ip = inet_addr(_settings_client.network.server_bind_ip); - /* And put the data back in it in case it was an invalid ip */ - snprintf(_settings_client.network.server_bind_ip, sizeof(_settings_client.network.server_bind_ip), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip)); + /* Set an ip when the hostname is empty */ + if (StrEmpty(_settings_client.network.server_bind_ip)) { + snprintf(_settings_client.network.server_bind_ip, sizeof(_settings_client.network.server_bind_ip), "%s", NetworkAddress().GetHostname()); + } /* Generate an unique id when there is none yet */ if (StrEmpty(_settings_client.network.network_id)) NetworkGenerateUniqueId(); |