#include <src/network/Client.h>
Public Member Functions | |
virtual bool | broadcast (const std::string &message) |
virtual bool | chat (const std::string &message) |
Client (const std::string &address, int port) | |
Client () | |
bool | closeConnection () |
bool | establishConnection () |
bool | processChat (const std::string &message, unsigned int playerID) |
bool | queuePacket (ENetPacket *packet, int clientID) |
void | update (const Clock &time) |
~Client () | |
Private Member Functions | |
Client (const Client ©) | |
virtual bool | isServer_ () |
Private Attributes | |
GamestateClient | gamestate |
bool | gameStateFailure_ |
bool | isSynched_ |
float | timeSinceLastUpdate_ |
orxonox::Client::Client | ( | ) |
Constructor for the Client class initializes the address and the port to default localhost:NETWORK_PORT
orxonox::Client::Client | ( | const std::string & | address, | |
int | port | |||
) |
Constructor for the Client class
address | the server address | |
port | port of the application on the server |
References orxonox::ClientConnection::setPort(), and orxonox::ClientConnection::setServerAddress().
orxonox::Client::~Client | ( | ) |
References closeConnection(), and orxonox::ClientConnection::isConnected().
orxonox::Client::Client | ( | const Client & | copy | ) | [private] |
virtual bool orxonox::Client::broadcast | ( | const std::string & | message | ) | [inline, virtual] |
Implements orxonox::Host.
bool orxonox::Client::chat | ( | const std::string & | message | ) | [virtual] |
This function implements the method of sending a chat message to the server
message | message to be sent |
Implements orxonox::Host.
References orxonox::packet::Type::Chat, orxonox::Host::getPlayerID(), and orxonox::packet::Packet::send().
bool orxonox::Client::closeConnection | ( | ) | [virtual] |
closes the Connection to the Server
Reimplemented from orxonox::ClientConnection.
References orxonox::ClientConnection::closeConnection().
Referenced by orxonox::GSClient::deactivate(), and ~Client().
bool orxonox::Client::establishConnection | ( | ) | [virtual] |
Establish the Connection to the Server
Reimplemented from orxonox::ClientConnection.
References orxonox::ClientConnection::establishConnection(), and orxonox::Synchronisable::setClient().
Referenced by orxonox::GSClient::activate().
virtual bool orxonox::Client::isServer_ | ( | ) | [inline, private, virtual] |
Implements orxonox::Host.
bool orxonox::Client::processChat | ( | const std::string & | message, | |
unsigned int | playerID | |||
) | [virtual] |
Implements orxonox::Host.
bool orxonox::Client::queuePacket | ( | ENetPacket * | packet, | |
int | clientID | |||
) | [virtual] |
void orxonox::Client::update | ( | const Clock & | time | ) |
Processes incoming packets, sends a gamestate to the server and does the cleanup
time |
References orxonox::GamestateClient::cleanup(), COUT, gamestate, orxonox::Clock::getDeltaTime(), orxonox::GamestateClient::getGamestate(), orxonox::ClientConnection::isConnected(), isSynched_, orxonox::NETWORK_PERIOD, orxonox::GamestateClient::processGamestates(), orxonox::Connection::processQueue(), orxonox::packet::Packet::send(), orxonox::FunctionCallManager::sendCalls(), orxonox::Connection::sendPackets(), and timeSinceLastUpdate_.
Referenced by orxonox::GSClient::activate(), and orxonox::GSClient::update().
GamestateClient orxonox::Client::gamestate [private] |
Referenced by update().
bool orxonox::Client::gameStateFailure_ [private] |
bool orxonox::Client::isSynched_ [private] |
Referenced by update().
float orxonox::Client::timeSinceLastUpdate_ [private] |
Referenced by update().