Bring back the quit button for continuing grand prix
This commit is contained in:
parent
be137155af
commit
89aea95b00
@ -875,6 +875,7 @@ void ClientLobby::startSelection(Event* event)
|
||||
->createActivePlayer(std::get<1>(p), std::get<0>(p));
|
||||
}
|
||||
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
|
||||
TracksScreen::getInstance()->setQuitServer();
|
||||
TracksScreen::getInstance()->setNetworkTracks();
|
||||
TracksScreen::getInstance()->push();
|
||||
}
|
||||
|
@ -121,10 +121,19 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
bool TracksScreen::onEscapePressed()
|
||||
{
|
||||
if (m_quit_server)
|
||||
{
|
||||
// Remove this screen
|
||||
StateManager::get()->popMenu();
|
||||
STKHost::get()->shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto cl = LobbyProtocol::get<ClientLobby>();
|
||||
if (cl)
|
||||
cl->clearPlayers();
|
||||
}
|
||||
// remove the screen
|
||||
return true;
|
||||
} // onEscapePressed
|
||||
@ -134,6 +143,7 @@ void TracksScreen::tearDown()
|
||||
{
|
||||
m_network_tracks = false;
|
||||
m_selected_track = NULL;
|
||||
m_quit_server = false;
|
||||
} // tearDown
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -227,6 +237,17 @@ void TracksScreen::beforeAddingWidget()
|
||||
// -----------------------------------------------------------------------------
|
||||
void TracksScreen::init()
|
||||
{
|
||||
// change the back button image (because it makes the game quit)
|
||||
if (m_quit_server)
|
||||
{
|
||||
IconButtonWidget* back_button = getWidget<IconButtonWidget>("back");
|
||||
back_button->setImage("gui/icons/main_quit.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
IconButtonWidget* back_button = getWidget<IconButtonWidget>("back");
|
||||
back_button->setImage("gui/icons/back.png");
|
||||
}
|
||||
if (!m_network_tracks)
|
||||
m_vote_timeout = std::numeric_limits<uint64_t>::max();
|
||||
|
||||
|
@ -48,6 +48,9 @@ private:
|
||||
{
|
||||
m_network_tracks = false;
|
||||
m_reverse_checked = false;
|
||||
m_quit_server = false;
|
||||
m_bottom_box_height = -1;
|
||||
m_vote_timeout = std::numeric_limits<uint64_t>::max();
|
||||
}
|
||||
|
||||
Track* m_selected_track = NULL;
|
||||
@ -55,11 +58,11 @@ private:
|
||||
GUIEngine::SpinnerWidget* m_laps;
|
||||
GUIEngine::LabelWidget* m_votes;
|
||||
|
||||
bool m_network_tracks, m_reverse_checked;
|
||||
bool m_network_tracks, m_reverse_checked, m_quit_server;
|
||||
|
||||
int m_bottom_box_height = -1;
|
||||
int m_bottom_box_height;
|
||||
|
||||
uint64_t m_vote_timeout = std::numeric_limits<uint64_t>::max();
|
||||
uint64_t m_vote_timeout;
|
||||
|
||||
std::map<std::string, core::stringw> m_vote_messages;
|
||||
|
||||
@ -99,6 +102,8 @@ public:
|
||||
|
||||
void setNetworkTracks() { m_network_tracks = true; }
|
||||
|
||||
void setQuitServer() { m_quit_server = true; }
|
||||
|
||||
void resetVote()
|
||||
{
|
||||
m_vote_messages.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user