Moved creation of the race protocols into lobby, so SynchronizationProtocol

is not involved in the race start anymore.
This commit is contained in:
hiker 2016-11-24 08:56:30 +11:00
parent 617e1c538d
commit b1afac23a7
4 changed files with 9 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;
}

View File

@ -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<ServerLobby*>(p);
ServerLobby* slrp = dynamic_cast<ServerLobby*>(p);
slrp->startSelection();
}
else // client