summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium42@users.noreply.github.com>2021-04-29 16:43:13 +0200
committerPatric Stout <github@truebrain.nl>2021-04-29 20:12:11 +0200
commita61696d6c565ff92c6604b12eefe36198d094056 (patch)
tree00b97ce4ada979ebf61e6c6c273a187bb0da67ee /src/openttd.cpp
parentbe37a2cab831cb645ef0f51dbcc944bd750f6926 (diff)
downloadopenttd-a61696d6c565ff92c6604b12eefe36198d094056.tar.xz
Change: [Network] Encapsulate logic about the connection string to the network code (#23)
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index b12824385..fbeeba793 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -473,21 +473,10 @@ struct AfterNewGRFScan : NewGRFScanCallback {
if (_switch_mode != SM_NONE) MakeNewgameSettingsLive();
if (_network_available && network_conn != nullptr) {
- CompanyID join_as = COMPANY_NEW_COMPANY;
- NetworkAddress address = ParseGameConnectionString(&join_as, network_conn, NETWORK_DEFAULT_PORT);
-
- if (join_as != COMPANY_NEW_COMPANY && join_as != COMPANY_SPECTATOR) {
- join_as--;
- if (join_as >= MAX_COMPANIES) {
- delete this;
- return;
- }
- }
-
LoadIntroGame();
_switch_mode = SM_NONE;
- NetworkClientConnectGame(address, join_as, join_server_password, join_company_password);
+ NetworkClientConnectGame(network_conn, COMPANY_NEW_COMPANY, join_server_password, join_company_password);
}
/* After the scan we're not used anymore. */
@@ -763,8 +752,7 @@ int openttd_main(int argc, char *argv[])
NetworkStartUp(); // initialize network-core
if (debuglog_conn != nullptr && _network_available) {
- NetworkAddress address = ParseConnectionString(debuglog_conn, NETWORK_DEFAULT_DEBUGLOG_PORT);
- NetworkStartDebugLog(address);
+ NetworkStartDebugLog(debuglog_conn);
}
if (!HandleBootstrap()) {
@@ -1476,8 +1464,7 @@ void GameLoop()
if (_network_reconnect > 0 && --_network_reconnect == 0) {
/* This means that we want to reconnect to the last host
* We do this here, because it means that the network is really closed */
- NetworkAddress address = ParseConnectionString(_settings_client.network.last_joined, NETWORK_DEFAULT_PORT);
- NetworkClientConnectGame(address, COMPANY_SPECTATOR);
+ NetworkClientConnectGame(_settings_client.network.last_joined, COMPANY_SPECTATOR);
}
/* Singleplayer */
StateGameLoop();