Fix auto connect
This commit is contained in:
parent
aa027bd09c
commit
ebcaa2c1ad
@ -25,7 +25,6 @@
|
|||||||
#include "network/network.hpp"
|
#include "network/network.hpp"
|
||||||
#include "network/network_config.hpp"
|
#include "network/network_config.hpp"
|
||||||
#include "network/network_string.hpp"
|
#include "network/network_string.hpp"
|
||||||
#include "network/servers_manager.hpp"
|
|
||||||
#include "network/stk_peer.hpp"
|
#include "network/stk_peer.hpp"
|
||||||
#include "network/transport_address.hpp"
|
#include "network/transport_address.hpp"
|
||||||
#include "utils/synchronised.hpp"
|
#include "utils/synchronised.hpp"
|
||||||
|
@ -100,7 +100,6 @@ void NetworkingLobby::beforeAddingWidget()
|
|||||||
*/
|
*/
|
||||||
void NetworkingLobby::init()
|
void NetworkingLobby::init()
|
||||||
{
|
{
|
||||||
m_server_info.clear();
|
|
||||||
Screen::init();
|
Screen::init();
|
||||||
setInitialFocus();
|
setInitialFocus();
|
||||||
m_start_button->setVisible(false);
|
m_start_button->setVisible(false);
|
||||||
|
@ -196,8 +196,7 @@ void ServerSelection::eventCallback(GUIEngine::Widget* widget,
|
|||||||
int selected_index = m_server_list_widget->getSelectionID();
|
int selected_index = m_server_list_widget->getSelectionID();
|
||||||
// This can happen e.g. when the list is empty and the user
|
// This can happen e.g. when the list is empty and the user
|
||||||
// clicks somewhere.
|
// clicks somewhere.
|
||||||
if (selected_index < 0 ||
|
if (selected_index < 0 || m_refreshing_server ||
|
||||||
m_refreshing_server ||
|
|
||||||
selected_index >= (int)ServersManager::get()->getServers().size())
|
selected_index >= (int)ServersManager::get()->getServers().size())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -215,6 +214,15 @@ void ServerSelection::eventCallback(GUIEngine::Widget* widget,
|
|||||||
void ServerSelection::onUpdate(float dt)
|
void ServerSelection::onUpdate(float dt)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// In case of auto-connect command line parameter, select the first server asap
|
||||||
|
if (NetworkConfig::get()->isAutoConnect() &&
|
||||||
|
m_refreshing_server == false &&
|
||||||
|
!ServersManager::get()->getServers().empty())
|
||||||
|
{
|
||||||
|
ServerInfoDialog *sid = new ServerInfoDialog(ServersManager::get()->getServers()[0]);
|
||||||
|
sid->requestJoin();
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_refreshing_server) return;
|
if (!m_refreshing_server) return;
|
||||||
|
|
||||||
if (ServersManager::get()->listUpdated())
|
if (ServersManager::get()->listUpdated())
|
||||||
@ -238,12 +246,4 @@ void ServerSelection::onUpdate(float dt)
|
|||||||
m_reload_widget->setActive(true);
|
m_reload_widget->setActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of auto-connect command line parameter, select the first server asap
|
|
||||||
if (NetworkConfig::get()->isAutoConnect() &&
|
|
||||||
m_refreshing_server == false &&
|
|
||||||
!ServersManager::get()->getServers().empty())
|
|
||||||
{
|
|
||||||
ServerInfoDialog *sid = new ServerInfoDialog(ServersManager::get()->getServers()[0]);
|
|
||||||
sid->requestJoin();
|
|
||||||
}
|
|
||||||
} // onUpdate
|
} // onUpdate
|
||||||
|
Loading…
Reference in New Issue
Block a user