From 62da83317e8eccdc0b3c77191c219e503f01cf58 Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 23 Nov 2016 18:39:59 +1100 Subject: [PATCH] Fixedc compilation, renamed LobbyRoomProtocol to LobbyProtocol. --- src/modes/world_status.cpp | 2 +- src/network/network_console.cpp | 8 ++++---- src/network/protocols/client_lobby.cpp | 3 +-- src/network/protocols/client_lobby.hpp | 4 ++-- src/network/protocols/connect_to_server.cpp | 2 +- src/network/protocols/lobby_protocol.cpp | 18 ++++++++--------- src/network/protocols/lobby_protocol.hpp | 20 +++++++++---------- src/network/protocols/server_lobby.cpp | 2 +- src/network/protocols/server_lobby.hpp | 10 +++++----- src/network/stk_host.cpp | 6 +++--- src/race/race_manager.cpp | 4 ++-- src/states_screens/network_kart_selection.cpp | 4 ++-- src/states_screens/networking_lobby.cpp | 6 +++--- src/states_screens/race_result_gui.cpp | 2 +- src/states_screens/tracks_screen.cpp | 2 +- 15 files changed, 46 insertions(+), 47 deletions(-) diff --git a/src/modes/world_status.cpp b/src/modes/world_status.cpp index 5d0c354ae..4009ec4c0 100644 --- a/src/modes/world_status.cpp +++ b/src/modes/world_status.cpp @@ -250,7 +250,7 @@ void WorldStatus::updateTime(const float dt) // server), immediately go to race start if (NetworkConfig::get()->isNetworking()) { - LobbyRoomProtocol *p = LobbyRoomProtocol::get(); + LobbyProtocol *p = LobbyProtocol::get(); p->finishedLoadingWorld(); m_phase = WAIT_FOR_SERVER_PHASE; } diff --git a/src/network/network_console.cpp b/src/network/network_console.cpp index 36e5f092d..9f673ed81 100644 --- a/src/network/network_console.cpp +++ b/src/network/network_console.cpp @@ -79,13 +79,13 @@ void* NetworkConsole::mainLoop(void* data) else if (str == "start" && NetworkConfig::get()->isServer()) { ServerLobby* protocol = - dynamic_cast(LobbyRoomProtocol::get()); + dynamic_cast(LobbyProtocol::get()); protocol->signalRaceStartToClients(); } else if (str == "selection" && NetworkConfig::get()->isServer()) { ServerLobby* protocol = - dynamic_cast(LobbyRoomProtocol::get()); + dynamic_cast(LobbyProtocol::get()); protocol->startSelection(); } else if (str == "select" && NetworkConfig::get()->isClient()) @@ -93,7 +93,7 @@ void* NetworkConsole::mainLoop(void* data) std::string str2; getline(std::cin, str2); ServerLobby* protocol = - dynamic_cast(LobbyRoomProtocol::get()); + dynamic_cast(LobbyProtocol::get()); ClientLobby* clrp = dynamic_cast(protocol); std::vector players = STKHost::get()->getMyPlayerProfiles(); @@ -109,7 +109,7 @@ void* NetworkConsole::mainLoop(void* data) std::cout << "Vote for ? (track/laps/reversed/major/minor/race#) :"; std::string str2; getline(std::cin, str2); - LobbyRoomProtocol* protocol = LobbyRoomProtocol::get(); + LobbyProtocol* protocol = LobbyProtocol::get(); ClientLobby* clrp = dynamic_cast(protocol); std::vector players = diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp index 8297418d8..2525fcdc5 100644 --- a/src/network/protocols/client_lobby.cpp +++ b/src/network/protocols/client_lobby.cpp @@ -35,8 +35,7 @@ #include "utils/log.hpp" // ============================================================================ -ClientLobby::ClientLobby() - : LobbyRoomProtocol(NULL) +ClientLobby::ClientLobby() : LobbyProtocol(NULL) { m_server_address.clear(); diff --git a/src/network/protocols/client_lobby.hpp b/src/network/protocols/client_lobby.hpp index 615e1993e..cd4aab94c 100644 --- a/src/network/protocols/client_lobby.hpp +++ b/src/network/protocols/client_lobby.hpp @@ -7,7 +7,7 @@ class STKPeer; -class ClientLobby : public LobbyRoomProtocol +class ClientLobby : public LobbyProtocol { private: void newPlayer(Event* event); @@ -75,4 +75,4 @@ public: }; -#endif // CLIENT_LOBBY_ROOM_PROTOCOL_HPP +#endif // CLIENT_LOBBY_HPP diff --git a/src/network/protocols/connect_to_server.cpp b/src/network/protocols/connect_to_server.cpp index 5398351b9..5095d7ed1 100644 --- a/src/network/protocols/connect_to_server.cpp +++ b/src/network/protocols/connect_to_server.cpp @@ -239,7 +239,7 @@ void ConnectToServer::asynchronousUpdate() if(STKHost::get()->getPeers()[0]->isConnected()) { ClientLobby *p = - LobbyRoomProtocol::create(); + LobbyProtocol::create(); p->setAddress(m_server_address); p->requestStart(); } diff --git a/src/network/protocols/lobby_protocol.cpp b/src/network/protocols/lobby_protocol.cpp index 89588058b..b0b4d55e7 100644 --- a/src/network/protocols/lobby_protocol.cpp +++ b/src/network/protocols/lobby_protocol.cpp @@ -29,18 +29,18 @@ #include "race/race_manager.hpp" #include "states_screens/state_manager.hpp" -LobbyRoomProtocol *LobbyRoomProtocol::m_lobby = NULL; +LobbyProtocol *LobbyProtocol::m_lobby = NULL; -LobbyRoomProtocol::LobbyRoomProtocol(CallbackObject* callback_object) +LobbyProtocol::LobbyProtocol(CallbackObject* callback_object) : Protocol(PROTOCOL_LOBBY_ROOM, callback_object) { m_game_setup = NULL; -} // LobbyRoomProtocol +} // LobbyProtocol // ---------------------------------------------------------------------------- -LobbyRoomProtocol::~LobbyRoomProtocol() +LobbyProtocol::~LobbyProtocol() { -} // ~LobbyRoomProtocol +} // ~LobbyProtocol //----------------------------------------------------------------------------- /** Starts the sychronization protocol and the RaceEventManager. It then @@ -50,13 +50,13 @@ LobbyRoomProtocol::~LobbyRoomProtocol() * the world can be loaded (LE_LOAD_WORLD) and on the server in state * LOAD_WORLD (i.e. just after informing all clients). */ -void LobbyRoomProtocol::loadWorld() +void LobbyProtocol::loadWorld() { - Log::info("LobbyRoomProtocol", "Ready !"); + Log::info("LobbyProtocol", "Ready !"); Protocol *p = new SynchronizationProtocol(); p->requestStart(); - Log::info("LobbyRoomProtocol", "SynchronizationProtocol started."); + Log::info("LobbyProtocol", "SynchronizationProtocol started."); // Race startup sequence // --------------------- @@ -119,7 +119,7 @@ void LobbyRoomProtocol::loadWorld() input_manager->getDeviceManager()->setSinglePlayer(ap); - Log::info("LobbyRoomProtocol", "Player configuration ready."); + Log::info("LobbyProtocol", "Player configuration ready."); // Load the actual world. m_game_setup->getRaceConfig()->loadWorld(); diff --git a/src/network/protocols/lobby_protocol.hpp b/src/network/protocols/lobby_protocol.hpp index cd43b5afb..77bc9426a 100644 --- a/src/network/protocols/lobby_protocol.hpp +++ b/src/network/protocols/lobby_protocol.hpp @@ -16,8 +16,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef LOBBY_ROOM_PROTOCOL_HPP -#define LOBBY_ROOM_PROTOCOL_HPP +#ifndef LOBBY_PROTOCOL_HPP +#define LOBBY_PROTOCOL_HPP #include "network/protocol.hpp" @@ -25,12 +25,12 @@ #include "network/network_string.hpp" /*! - * \class LobbyRoomProtocol + * \class LobbyProtocol * \brief Base class for both client and server lobby. The lobbies are started * when a server opens a game, or when a client joins a game. * It is used to exchange data about the race settings, like kart selection. */ -class LobbyRoomProtocol : public Protocol +class LobbyProtocol : public Protocol { public: /** Lists all lobby events (LE). */ @@ -62,7 +62,7 @@ public: }; protected: - static LobbyRoomProtocol *m_lobby; + static LobbyProtocol *m_lobby; /** The game setup. */ GameSetup* m_game_setup; @@ -80,7 +80,7 @@ public: // ------------------------------------------------------------------------ /** Returns the singleton client or server lobby protocol. */ - static LobbyRoomProtocol *get() + static LobbyProtocol *get() { assert(m_lobby); return m_lobby; @@ -88,8 +88,8 @@ public: // ------------------------------------------------------------------------ - LobbyRoomProtocol(CallbackObject* callback_object); - virtual ~LobbyRoomProtocol(); + LobbyProtocol(CallbackObject* callback_object); + virtual ~LobbyProtocol(); virtual void setup() = 0; virtual void update(float dt) = 0; virtual void finishedLoadingWorld() = 0; @@ -100,6 +100,6 @@ public: assert(false); // Only defined in client }; -}; // class LobbyRoomProtocol +}; // class LobbyProtocol -#endif // LOBBY_ROOM_PROTOCOL_HPP +#endif // LOBBY_PROTOCOL_HPP diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index 00460914e..e23dcde8b 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -75,7 +75,7 @@ * It starts with detecting the public ip address and port of this * host (GetPublicAddress). */ -ServerLobby::ServerLobby() : LobbyRoomProtocol(NULL) +ServerLobby::ServerLobby() : LobbyProtocol(NULL) { setHandleDisconnections(true); } // ServerLobby diff --git a/src/network/protocols/server_lobby.hpp b/src/network/protocols/server_lobby.hpp index 3e22615de..10367b43b 100644 --- a/src/network/protocols/server_lobby.hpp +++ b/src/network/protocols/server_lobby.hpp @@ -1,12 +1,12 @@ -#ifndef SERVER_LOBBY_ROOM_PROTOCOL_HPP -#define SERVER_LOBBY_ROOM_PROTOCOL_HPP +#ifndef SERVER_LOBBY_HPP +#define SERVER_LOBBY_HPP #include "network/protocols/lobby_protocol.hpp" #include "utils/cpp2011.hpp" #include "utils/synchronised.hpp" -class ServerLobby : public LobbyRoomProtocol - , public CallbackObject +class ServerLobby : public LobbyProtocol + , public CallbackObject { private: /* The state for a small finite state machine. */ @@ -88,4 +88,4 @@ public: }; // class ServerLobby -#endif // SERVER_LOBBY_ROOM_PROTOCOL_HPP +#endif // SERVER_LOBBY_HPP diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index a0b3e1c6a..3fa3f92f8 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -151,7 +151,7 @@ void STKHost::create() * destination (unless if it is a LAN connection, then UDP * broadcasts will be used). * - * Each client will run a ClientLobbyRoomProtocol (CLR) to handle the further + * Each client will run a ClientLobbyProtocol (CLR) to handle the further * interaction with the server. The client will first request a connection * with the server (this is for the 'logical' connection to the server; so * far it was mostly about the 'physical' connection, i.e. being able to send @@ -162,7 +162,7 @@ void STKHost::create() * each received message to the protocol with the same id. So any message * sent by protocol X on the server will be received by protocol X on the * client and vice versa. The only exception are the client- and server-lobby: - * They share the same id (set in LobbyRoomProtocol), so a message sent by + * They share the same id (set in LobbyProtocol), so a message sent by * the SLR will be received by the CLR, and a message from the CLR will be * received by the SLR. * @@ -289,7 +289,7 @@ STKHost::STKHost(const irr::core::stringw &server_name) } startListening(); - Protocol *p = LobbyRoomProtocol::create(); + Protocol *p = LobbyProtocol::create(); ProtocolManager::getInstance()->requestStart(p); } // STKHost(server_name) diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index d976144b3..7808712a1 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -45,7 +45,7 @@ #include "modes/soccer_world.hpp" #include "network/protocol_manager.hpp" #include "network/network_config.hpp" -#include "network/protocols/lobby_room_protocol.hpp" +#include "network/protocols/lobby_protocol.hpp" #include "network/race_event_manager.hpp" #include "replay/replay_play.hpp" #include "scriptengine/property_animator.hpp" @@ -560,7 +560,7 @@ void RaceManager::startNextRace() // the world has been setup if(NetworkConfig::get()->isNetworking()) { - LobbyRoomProtocol *lobby = LobbyRoomProtocol::get(); + LobbyProtocol *lobby = LobbyProtocol::get(); assert(lobby); lobby->finishedLoadingWorld(); } diff --git a/src/states_screens/network_kart_selection.cpp b/src/states_screens/network_kart_selection.cpp index 1bc54e166..36735d127 100644 --- a/src/states_screens/network_kart_selection.cpp +++ b/src/states_screens/network_kart_selection.cpp @@ -134,7 +134,7 @@ void NetworkKartSelectionScreen::playerConfirm(const int playerID) if(playerID == PLAYER_ID_GAME_MASTER) // self { - LobbyRoomProtocol* protocol = LobbyRoomProtocol::get(); + LobbyProtocol* protocol = LobbyProtocol::get(); ClientLobby *clrp = dynamic_cast(protocol); assert(clrp); // FIXME SPLITSCREEN: we need to supply the global player id of the @@ -211,7 +211,7 @@ bool NetworkKartSelectionScreen::onEscapePressed() // then remove the lobby screen (you left the server) StateManager::get()->popMenu(); ServerSelection::getInstance()->refresh(); - Protocol *lobby = LobbyRoomProtocol::get(); + Protocol *lobby = LobbyProtocol::get(); // notify the server that we left ClientLobby* clrp = dynamic_cast(lobby); diff --git a/src/states_screens/networking_lobby.cpp b/src/states_screens/networking_lobby.cpp index 7c466627f..314595583 100644 --- a/src/states_screens/networking_lobby.cpp +++ b/src/states_screens/networking_lobby.cpp @@ -162,7 +162,7 @@ void NetworkingLobby::eventCallback(Widget* widget, const std::string& name, { if(NetworkConfig::get()->isServer()) { - Protocol *p = LobbyRoomProtocol::get(); + Protocol *p = LobbyProtocol::get(); ServerLobby* slrp = dynamic_cast(p); slrp->startSelection(); @@ -171,7 +171,7 @@ void NetworkingLobby::eventCallback(Widget* widget, const std::string& name, { // Send a message to the server to start NetworkString start(PROTOCOL_LOBBY_ROOM); - start.addUInt8(LobbyRoomProtocol::LE_REQUEST_BEGIN); + start.addUInt8(LobbyProtocol::LE_REQUEST_BEGIN); STKHost::get()->sendToServer(&start, true); } } @@ -199,7 +199,7 @@ bool NetworkingLobby::onEscapePressed() { // notify the server that we left ClientLobby* protocol = - dynamic_cast(LobbyRoomProtocol::get()); + dynamic_cast(LobbyProtocol::get()); if (protocol) protocol->leave(); STKHost::get()->shutdown(); diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index d1c12e02d..80a01bb57 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -341,7 +341,7 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget, if (name == "middle") // Continue button (return to server lobby) { // Signal to the server that this client is back in the lobby now. - Protocol* protocol = LobbyRoomProtocol::get(); + Protocol* protocol = LobbyProtocol::get(); ClientLobby* clrp = dynamic_cast(protocol); if(clrp) diff --git a/src/states_screens/tracks_screen.cpp b/src/states_screens/tracks_screen.cpp index 411614af0..00d84e528 100644 --- a/src/states_screens/tracks_screen.cpp +++ b/src/states_screens/tracks_screen.cpp @@ -89,7 +89,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, { if(STKHost::existHost()) { - Protocol* protocol = LobbyRoomProtocol::get(); + Protocol* protocol = LobbyProtocol::get(); ClientLobby* clrp = dynamic_cast(protocol); assert(clrp); // server never shows the track screen.