From c6fa384d94d9a8f9a032ab3c3807e6787b8a66a7 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 27 Mar 2018 15:44:19 +0800 Subject: [PATCH] Fix uninitialized values and broken local kart selection if reenter --- src/network/remote_kart_info.hpp | 23 ++++++++++++++++------- src/states_screens/kart_selection.cpp | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/network/remote_kart_info.hpp b/src/network/remote_kart_info.hpp index 41cbd9c37..88ec51740 100644 --- a/src/network/remote_kart_info.hpp +++ b/src/network/remote_kart_info.hpp @@ -57,16 +57,25 @@ public: const irr::core::stringw& user_name, int host_id, bool network) : m_kart_name(kart_name), m_user_name(user_name), - m_local_player_id(player_id), m_host_id(host_id), - m_soccer_team(SOCCER_TEAM_NONE), m_network_player(network), - m_difficulty(PLAYER_DIFFICULTY_NORMAL) + m_local_player_id(player_id), m_global_player_id(-1), + m_host_id(host_id), m_soccer_team(SOCCER_TEAM_NONE), + m_network_player(network), + m_difficulty(PLAYER_DIFFICULTY_NORMAL), + m_default_kart_color(0.0f) {} RemoteKartInfo(const std::string& kart_name) : m_kart_name(kart_name), - m_user_name(""), m_local_player_id(-1), m_host_id(-1), - m_difficulty(PLAYER_DIFFICULTY_NORMAL) + m_user_name(""), m_local_player_id(-1), + m_global_player_id(-1), m_host_id(-1), + m_soccer_team(SOCCER_TEAM_NONE), m_network_player(false), + m_difficulty(PLAYER_DIFFICULTY_NORMAL), + m_default_kart_color(0.0f) {} - RemoteKartInfo() : m_kart_name(""), m_user_name(""), m_local_player_id(-1), - m_host_id(-1), m_difficulty(PLAYER_DIFFICULTY_NORMAL) + RemoteKartInfo() : m_kart_name(""), m_user_name(""), + m_local_player_id(-1), m_global_player_id(-1), + m_host_id(-1), m_soccer_team(SOCCER_TEAM_NONE), + m_network_player(false), + m_difficulty(PLAYER_DIFFICULTY_NORMAL), + m_default_kart_color(0.0f) {} void setKartName(const std::string& n) { m_kart_name = n; } void setPlayerName(const irr::core::stringw& u) { m_user_name = u; } diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index b8cbf78ef..e7a165c9d 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -382,6 +382,7 @@ void KartSelectionScreen::init() if (!NetworkConfig::get()->isNetworking()) { + StateManager::get()->resetActivePlayers(); if (!m_multiplayer) { joinPlayer(input_manager->getDeviceManager()->getLatestUsedDevice(),