Fixedc compilation, renamed LobbyRoomProtocol to LobbyProtocol.

This commit is contained in:
hiker 2016-11-23 18:39:59 +11:00
parent 2c7e7d8722
commit 62da83317e
15 changed files with 46 additions and 47 deletions

View File

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

View File

@ -79,13 +79,13 @@ void* NetworkConsole::mainLoop(void* data)
else if (str == "start" && NetworkConfig::get()->isServer())
{
ServerLobby* protocol =
dynamic_cast<ServerLobby*>(LobbyRoomProtocol::get());
dynamic_cast<ServerLobby*>(LobbyProtocol::get());
protocol->signalRaceStartToClients();
}
else if (str == "selection" && NetworkConfig::get()->isServer())
{
ServerLobby* protocol =
dynamic_cast<ServerLobby*>(LobbyRoomProtocol::get());
dynamic_cast<ServerLobby*>(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<ServerLobby*>(LobbyRoomProtocol::get());
dynamic_cast<ServerLobby*>(LobbyProtocol::get());
ClientLobby* clrp = dynamic_cast<ClientLobby*>(protocol);
std::vector<NetworkPlayerProfile*> 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<ClientLobby*>(protocol);
std::vector<NetworkPlayerProfile*> players =

View File

@ -35,8 +35,7 @@
#include "utils/log.hpp"
// ============================================================================
ClientLobby::ClientLobby()
: LobbyRoomProtocol(NULL)
ClientLobby::ClientLobby() : LobbyProtocol(NULL)
{
m_server_address.clear();

View File

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

View File

@ -239,7 +239,7 @@ void ConnectToServer::asynchronousUpdate()
if(STKHost::get()->getPeers()[0]->isConnected())
{
ClientLobby *p =
LobbyRoomProtocol::create<ClientLobby>();
LobbyProtocol::create<ClientLobby>();
p->setAddress(m_server_address);
p->requestStart();
}

View File

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

View File

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

View File

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

View File

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

View File

@ -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<ServerLobby>();
Protocol *p = LobbyProtocol::create<ServerLobby>();
ProtocolManager::getInstance()->requestStart(p);
} // STKHost(server_name)

View File

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

View File

@ -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<ClientLobby*>(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<ClientLobby*>(lobby);

View File

@ -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<ServerLobby*>(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<ClientLobby*>(LobbyRoomProtocol::get());
dynamic_cast<ClientLobby*>(LobbyProtocol::get());
if (protocol)
protocol->leave();
STKHost::get()->shutdown();

View File

@ -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<ClientLobby*>(protocol);
if(clrp)

View File

@ -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<ClientLobby*>(protocol);
assert(clrp); // server never shows the track screen.