Fix missing server infos if back from live join kart selection
This commit is contained in:
parent
275dbe3631
commit
ae3fb4b004
@ -24,6 +24,7 @@
|
||||
#include "network/protocols/client_lobby.hpp"
|
||||
#include "network/stk_host.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/online/networking_lobby.hpp"
|
||||
#include "states_screens/online/tracks_screen.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
@ -163,6 +164,8 @@ bool NetworkKartSelectionScreen::onEscapePressed()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Rewrite the previous server infos saved (game mode, chat lists...)
|
||||
NetworkingLobby::getInstance()->reloadServerInfos();
|
||||
return true; // remove the screen
|
||||
} // onEscapePressed
|
||||
|
||||
|
@ -80,6 +80,7 @@ NetworkingLobby::NetworkingLobby() : Screen("online/networking_lobby.stkgui")
|
||||
m_chat_box = NULL;
|
||||
m_send_button = NULL;
|
||||
m_icon_bank = NULL;
|
||||
m_reload_server_info = false;
|
||||
|
||||
// Allows one to update chat and counter even if dialog window is opened
|
||||
setUpdateInBackground(true);
|
||||
@ -252,7 +253,12 @@ void NetworkingLobby::addMoreServerInfo(core::stringw info)
|
||||
gui::GlyphLayout new_line = { 0 };
|
||||
new_line.flags = gui::GLF_NEWLINE;
|
||||
m_server_info.push_back(new_line);
|
||||
updateServerInfos();
|
||||
} // addMoreServerInfo
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkingLobby::updateServerInfos()
|
||||
{
|
||||
if (GUIEngine::getCurrentScreen() != this)
|
||||
return;
|
||||
|
||||
@ -261,7 +267,7 @@ void NetworkingLobby::addMoreServerInfo(core::stringw info)
|
||||
st->setUseGlyphLayoutsOnly(true);
|
||||
st->setGlyphLayouts(m_server_info);
|
||||
#endif
|
||||
} // addMoreServerInfo
|
||||
} // updateServerInfos
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkingLobby::onUpdate(float delta)
|
||||
@ -269,6 +275,12 @@ void NetworkingLobby::onUpdate(float delta)
|
||||
if (NetworkConfig::get()->isServer() || !STKHost::existHost())
|
||||
return;
|
||||
|
||||
if (m_reload_server_info)
|
||||
{
|
||||
m_reload_server_info = false;
|
||||
updateServerInfos();
|
||||
}
|
||||
|
||||
if (m_has_auto_start_in_server)
|
||||
{
|
||||
m_start_button->setLabel(m_ready_text);
|
||||
|
@ -81,7 +81,8 @@ private:
|
||||
unsigned m_min_start_game_players;
|
||||
|
||||
bool m_allow_change_team, m_has_auto_start_in_server,
|
||||
m_server_configurable, m_client_live_joinable;
|
||||
m_server_configurable, m_client_live_joinable,
|
||||
m_reload_server_info;
|
||||
|
||||
video::ITexture* m_config_texture;
|
||||
video::ITexture* m_spectate_texture;
|
||||
@ -135,6 +136,7 @@ public:
|
||||
m_joined_server = server;
|
||||
m_server_info.clear();
|
||||
}
|
||||
void updateServerInfos();
|
||||
void updatePlayers();
|
||||
void openSplitscreenDialog(InputDevice* device);
|
||||
void addSplitscreenPlayer(irr::core::stringw name);
|
||||
@ -143,6 +145,7 @@ public:
|
||||
float start_timeout, unsigned server_max_player);
|
||||
void setStartingTimerTo(float t);
|
||||
void toggleServerConfigButton(bool val) { m_server_configurable = val; }
|
||||
void reloadServerInfos() { m_reload_server_info = true; }
|
||||
}; // class NetworkingLobby
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user