From b1afac23a7f7c0ba777f16e7ec0770546665ac0c Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 24 Nov 2016 08:56:30 +1100 Subject: [PATCH] Moved creation of the race protocols into lobby, so SynchronizationProtocol is not involved in the race start anymore. --- src/network/protocols/client_lobby.cpp | 2 +- src/network/protocols/lobby_protocol.cpp | 8 +++++++- src/network/protocols/synchronization_protocol.cpp | 6 ------ src/states_screens/networking_lobby.cpp | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp index 2525fcdc5..d245861db 100644 --- a/src/network/protocols/client_lobby.cpp +++ b/src/network/protocols/client_lobby.cpp @@ -70,7 +70,7 @@ void ClientLobby::setup() * \param kart_name Name of the selected kart. */ void ClientLobby::requestKartSelection(uint8_t player_id, - const std::string &kart_name) + const std::string &kart_name) { NetworkString *request = getNetworkString(3+kart_name.size()); request->addUInt8(LE_KART_SELECTION).addUInt8(player_id) diff --git a/src/network/protocols/lobby_protocol.cpp b/src/network/protocols/lobby_protocol.cpp index b0b4d55e7..04ec409f1 100644 --- a/src/network/protocols/lobby_protocol.cpp +++ b/src/network/protocols/lobby_protocol.cpp @@ -23,6 +23,9 @@ #include "input/device_manager.hpp" #include "modes/world.hpp" #include "network/network_player_profile.hpp" +#include "network/protocols/controller_events_protocol.hpp" +#include "network/protocols/game_events_protocol.hpp" +#include "network/protocols/kart_update_protocol.hpp" #include "network/protocols/synchronization_protocol.hpp" #include "network/race_event_manager.hpp" #include "network/stk_host.hpp" @@ -124,6 +127,9 @@ void LobbyProtocol::loadWorld() // Load the actual world. m_game_setup->getRaceConfig()->loadWorld(); World::getWorld()->setNetworkWorld(true); + (new KartUpdateProtocol())->requestStart(); + (new ControllerEventsProtocol())->requestStart(); + (new GameEventsProtocol())->requestStart(); -} // setupGame +} // loadWorld diff --git a/src/network/protocols/synchronization_protocol.cpp b/src/network/protocols/synchronization_protocol.cpp index d855f3005..86b48173d 100644 --- a/src/network/protocols/synchronization_protocol.cpp +++ b/src/network/protocols/synchronization_protocol.cpp @@ -2,9 +2,6 @@ #include "network/event.hpp" #include "network/network_config.hpp" -#include "network/protocols/kart_update_protocol.hpp" -#include "network/protocols/controller_events_protocol.hpp" -#include "network/protocols/game_events_protocol.hpp" #include "network/stk_host.hpp" #include "network/stk_peer.hpp" #include "utils/time.hpp" @@ -149,9 +146,6 @@ void SynchronizationProtocol::asynchronousUpdate() m_has_quit = true; Log::info("SynchronizationProtocol", "Countdown finished. Starting now."); - (new KartUpdateProtocol())->requestStart(); - (new ControllerEventsProtocol())->requestStart(); - (new GameEventsProtocol())->requestStart(); requestTerminate(); return; } diff --git a/src/states_screens/networking_lobby.cpp b/src/states_screens/networking_lobby.cpp index 314595583..736c47dea 100644 --- a/src/states_screens/networking_lobby.cpp +++ b/src/states_screens/networking_lobby.cpp @@ -163,8 +163,7 @@ void NetworkingLobby::eventCallback(Widget* widget, const std::string& name, if(NetworkConfig::get()->isServer()) { Protocol *p = LobbyProtocol::get(); - ServerLobby* slrp = - dynamic_cast(p); + ServerLobby* slrp = dynamic_cast(p); slrp->startSelection(); } else // client