Work around: all GUIs are being removed when the race starts, but

the TracksScreen should stay (to show the random vote result animation
later). For now the screen is re-added, long term should have a better
solution.
This commit is contained in:
hiker 2018-12-16 01:37:42 +11:00
parent 10bca0f334
commit 8ae6942442

17
src/race/race_manager.cpp Normal file → Executable file
View File

@ -57,7 +57,7 @@
#include "states_screens/grand_prix_win.hpp" #include "states_screens/grand_prix_win.hpp"
#include "states_screens/kart_selection.hpp" #include "states_screens/kart_selection.hpp"
#include "states_screens/main_menu_screen.hpp" #include "states_screens/main_menu_screen.hpp"
#include "states_screens/online/vote_overview.hpp" #include "states_screens/online/tracks_screen.hpp"
#include "states_screens/state_manager.hpp" #include "states_screens/state_manager.hpp"
#include "tracks/track_manager.hpp" #include "tracks/track_manager.hpp"
#include "utils/ptr_vector.hpp" #include "utils/ptr_vector.hpp"
@ -965,12 +965,21 @@ void RaceManager::startSingleRace(const std::string &track_ident,
assert(!m_watching_replay); assert(!m_watching_replay);
StateManager::get()->enterGameState(); StateManager::get()->enterGameState();
// In networking, make sure that the tracks screen is shown. This will
// allow for a 'randomly pick track' animation to be shown while
// world is loaded.
if (NetworkConfig::get()->isNetworking() && if (NetworkConfig::get()->isNetworking() &&
NetworkConfig::get()->isClient() ) NetworkConfig::get()->isClient() )
{ {
VoteOverview *overview = VoteOverview::getInstance(); // TODO: The enterGameState() call above deleted all GUIs, which
if (GUIEngine::getCurrentScreen() != overview) // means even if the tracks screen is shown, it need to be recreated.
overview->push(); // And we have to make sure that it is recreated as network version.
TracksScreen *ts = TracksScreen::getInstance();
if (GUIEngine::getCurrentScreen() != ts)
{
ts->setNetworkTracks();
ts->push();
}
} }