diff options
author | Patric Stout <truebrain@openttd.org> | 2021-04-20 16:26:07 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-04-20 17:34:04 +0200 |
commit | 31897eaa7de865d41b46f7158c70f94debe1ec66 (patch) | |
tree | 5575e5bf60b6555d291a0bb25aa43fc35f6980e1 /src/openttd.cpp | |
parent | 05612d60ae0af94b9313d5a8b78ebf58a3eeab66 (diff) | |
download | openttd-31897eaa7de865d41b46f7158c70f94debe1ec66.tar.xz |
Codechange: split ParseConnectionString into two functions
One also looks for a company, the other doesn't. There were more
uses of the latter than the first, leaving very weird code all
over the place.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index ff6867c4b..b204ca5a2 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -478,7 +478,7 @@ struct AfterNewGRFScan : NewGRFScanCallback { uint16 rport = NETWORK_DEFAULT_PORT; CompanyID join_as = COMPANY_NEW_COMPANY; - ParseConnectionString(&company, &port, network_conn); + ParseGameConnectionString(&company, &port, network_conn); if (company != nullptr) { join_as = (CompanyID)atoi(company); @@ -584,11 +584,8 @@ int openttd_main(int argc, char *argv[]) dedicated = true; SetDebugString("net=6"); if (mgo.opt != nullptr) { - /* Use the existing method for parsing (openttd -n). - * However, we do ignore the #company part. */ - const char *temp = nullptr; const char *port = nullptr; - ParseConnectionString(&temp, &port, mgo.opt); + ParseConnectionString(&port, mgo.opt); if (!StrEmpty(mgo.opt)) scanner->dedicated_host = mgo.opt; if (port != nullptr) scanner->dedicated_port = atoi(port); } @@ -774,13 +771,12 @@ int openttd_main(int argc, char *argv[]) NetworkStartUp(); // initialize network-core if (debuglog_conn != nullptr && _network_available) { - const char *not_used = nullptr; const char *port = nullptr; uint16 rport; rport = NETWORK_DEFAULT_DEBUGLOG_PORT; - ParseConnectionString(¬_used, &port, debuglog_conn); + ParseConnectionString(&port, debuglog_conn); if (port != nullptr) rport = atoi(port); NetworkStartDebugLog(NetworkAddress(debuglog_conn, rport)); |