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