Qt MainWindow: clean up Netplay settings logic
This commit is contained in:
parent
a09f8744b9
commit
fdb5828d62
|
@ -663,9 +663,8 @@ bool MainWindow::NetPlayJoin()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
std::string host_ip, traversal_host, nickname;
|
std::string host_ip;
|
||||||
int host_port, traversal_port;
|
u16 host_port;
|
||||||
bool is_traversal;
|
|
||||||
if (Settings::Instance().GetNetPlayServer() != nullptr)
|
if (Settings::Instance().GetNetPlayServer() != nullptr)
|
||||||
{
|
{
|
||||||
host_ip = "127.0.0.1";
|
host_ip = "127.0.0.1";
|
||||||
|
@ -677,12 +676,12 @@ bool MainWindow::NetPlayJoin()
|
||||||
host_port = Config::Get(Config::NETPLAY_HOST_PORT);
|
host_port = Config::Get(Config::NETPLAY_HOST_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string traversal_choice = Config::Get(Config::NETPLAY_TRAVERSAL_CHOICE);
|
const std::string traversal_choice = Config::Get(Config::NETPLAY_TRAVERSAL_CHOICE);
|
||||||
is_traversal = traversal_choice == "traversal";
|
const bool is_traversal = traversal_choice == "traversal";
|
||||||
|
|
||||||
traversal_host = Config::Get(Config::NETPLAY_TRAVERSAL_SERVER);
|
const std::string traversal_host = Config::Get(Config::NETPLAY_TRAVERSAL_SERVER);
|
||||||
traversal_port = Config::Get(Config::NETPLAY_TRAVERSAL_PORT);
|
const u16 traversal_port = Config::Get(Config::NETPLAY_TRAVERSAL_PORT);
|
||||||
nickname = Config::Get(Config::NETPLAY_NICKNAME);
|
const std::string nickname = Config::Get(Config::NETPLAY_NICKNAME);
|
||||||
|
|
||||||
// Create Client
|
// Create Client
|
||||||
Settings::Instance().ResetNetPlayClient(
|
Settings::Instance().ResetNetPlayClient(
|
||||||
|
@ -721,19 +720,14 @@ bool MainWindow::NetPlayHost(const QString& game_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
std::string traversal_host, nickname;
|
u16 host_port = Config::Get(Config::NETPLAY_HOST_PORT);
|
||||||
int host_port, traversal_port;
|
const std::string traversal_choice = Config::Get(Config::NETPLAY_TRAVERSAL_CHOICE);
|
||||||
bool is_traversal, use_upnp;
|
const bool is_traversal = traversal_choice == "traversal";
|
||||||
|
const bool use_upnp = Config::Get(Config::NETPLAY_USE_UPNP);
|
||||||
|
|
||||||
host_port = Config::Get(Config::NETPLAY_HOST_PORT);
|
const std::string traversal_host = Config::Get(Config::NETPLAY_TRAVERSAL_SERVER);
|
||||||
std::string traversal_choice;
|
const u16 traversal_port = Config::Get(Config::NETPLAY_TRAVERSAL_PORT);
|
||||||
traversal_choice = Config::Get(Config::NETPLAY_TRAVERSAL_CHOICE);
|
const std::string nickname = Config::Get(Config::NETPLAY_NICKNAME);
|
||||||
is_traversal = traversal_choice == "traversal";
|
|
||||||
use_upnp = Config::Get(Config::NETPLAY_USE_UPNP);
|
|
||||||
|
|
||||||
traversal_host = Config::Get(Config::NETPLAY_TRAVERSAL_SERVER);
|
|
||||||
traversal_port = Config::Get(Config::NETPLAY_TRAVERSAL_PORT);
|
|
||||||
nickname = Config::Get(Config::NETPLAY_NICKNAME);
|
|
||||||
|
|
||||||
if (is_traversal)
|
if (is_traversal)
|
||||||
host_port = Config::Get(Config::NETPLAY_LISTEN_PORT);
|
host_port = Config::Get(Config::NETPLAY_LISTEN_PORT);
|
||||||
|
|
Loading…
Reference in New Issue