Fix broken splitscreen network when no track selection screen

This commit is contained in:
Benau 2022-09-11 09:16:19 +08:00
parent 8eb8c6392e
commit d3ddcd884d
3 changed files with 18 additions and 13 deletions

View File

@ -1092,8 +1092,9 @@ void ClientLobby::startSelection(Event* event)
}
// In case of auto-connect or continue a grand prix, use random karts
// (or previous kart) from server and go to track selection
if ((NetworkConfig::get()->isAutoConnect() || skip_kart_screen) &&
m_server_enabled_track_voting)
if (NetworkConfig::get()->isAutoConnect())
skip_kart_screen = true;
if (skip_kart_screen)
{
input_manager->setMasterPlayerOnly(true);
for (auto& p : NetworkConfig::get()->getNetworkPlayers())
@ -1102,23 +1103,24 @@ void ClientLobby::startSelection(Event* event)
->createActivePlayer(std::get<1>(p), std::get<0>(p));
}
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
NetworkingLobby::getInstance()->setAssignedPlayers(true);
}
if (!GUIEngine::isNoGraphics())
{
if (skip_kart_screen && m_server_enabled_track_voting)
{
TracksScreen::getInstance()->setQuitServer();
TracksScreen::getInstance()->setNetworkTracks();
TracksScreen::getInstance()->push();
}
}
else if (!GUIEngine::isNoGraphics())
else if (!skip_kart_screen)
{
NetworkKartSelectionScreen::getInstance()->push();
}
if (!GUIEngine::isNoGraphics())
{
TracksScreen *ts = TracksScreen::getInstance();
ts->resetVote();
}
m_state.store(SELECTING_ASSETS);
Log::info("ClientLobby", "Selection starts now");
} // startSelection

View File

@ -179,6 +179,7 @@ void NetworkingLobby::init()
m_player_names.clear();
m_has_auto_start_in_server = false;
m_client_live_joinable = false;
m_assigned_players = false;
m_addon_install = NULL;
m_ping_update_timer = 0;
m_start_timeout = std::numeric_limits<float>::max();
@ -883,6 +884,7 @@ void NetworkingLobby::tearDown()
if (!NetworkConfig::get()->isClient())
return;
input_manager->getDeviceManager()->mapFireToSelect(false);
if (!m_assigned_players)
input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN);
} // tearDown

View File

@ -84,7 +84,7 @@ private:
bool m_has_auto_start_in_server,
m_server_configurable, m_client_live_joinable,
m_reload_server_info;
m_reload_server_info, m_assigned_players;
Addon* m_addon_install;
video::ITexture* m_config_texture;
@ -148,6 +148,7 @@ public:
void toggleServerConfigButton(bool val) { m_server_configurable = val; }
void reloadServerInfos() { m_reload_server_info = true; }
void setHeader(const core::stringw& header) { m_header_text = header; }
void setAssignedPlayers(bool val) { m_assigned_players = val; }
}; // class NetworkingLobby
#endif