#include <src/network/Host.h>
Static Public Member Functions | |
static bool | addPacket (ENetPacket *packet, int clientID=0) |
static bool | Broadcast (const std::string &message) |
static bool | Chat (const std::string &message) |
static unsigned int | getPlayerID () |
static unsigned int | getShipID () |
static bool | incomingChat (const std::string &message, unsigned int playerID) |
static bool | isServer () |
static bool | running () |
static void | setClientID (unsigned int id) |
static void | setShipID (unsigned int id) |
Protected Member Functions | |
Host () | |
Constructor: assures that only one reference will be created and sets the pointer. | |
virtual | ~Host () |
Destructor: resets the instance pointer to 0. | |
Protected Attributes | |
unsigned int | clientID_ |
unsigned int | shipID_ |
Static Protected Attributes | |
static Host * | instance_ = 0 |
Private Member Functions | |
virtual bool | broadcast (const std::string &message)=0 |
virtual bool | chat (const std::string &message)=0 |
virtual bool | isServer_ ()=0 |
virtual bool | processChat (const std::string &message, unsigned int playerID)=0 |
virtual bool | queuePacket (ENetPacket *packet, int clientID)=0 |
orxonox::Host::Host | ( | ) | [protected] |
orxonox::Host::~Host | ( | ) | [protected, virtual] |
bool orxonox::Host::addPacket | ( | ENetPacket * | packet, | |
int | clientID = 0 | |||
) | [static] |
This function is used to add an enetpacket to be sent to another peer
References instance_, and queuePacket().
Referenced by orxonox::packet::Packet::send().
bool orxonox::Host::Broadcast | ( | const std::string & | message | ) | [static] |
References broadcast(), orxonox::CLIENTID_UNKNOWN, and instance_.
Referenced by orxonox::UnderAttack::destroyedPawn(), orxonox::Deathmatch::end(), orxonox::Asteroids::end(), orxonox::Deathmatch::pawnKilled(), orxonox::Deathmatch::playerChangedName(), orxonox::Deathmatch::playerEntered(), orxonox::Deathmatch::playerLeft(), orxonox::Deathmatch::playerScored(), orxonox::Deathmatch::start(), orxonox::Asteroids::start(), and orxonox::UnderAttack::tick().
virtual bool orxonox::Host::broadcast | ( | const std::string & | message | ) | [private, pure virtual] |
bool orxonox::Host::Chat | ( | const std::string & | message | ) | [static] |
virtual bool orxonox::Host::chat | ( | const std::string & | message | ) | [private, pure virtual] |
unsigned int orxonox::Host::getPlayerID | ( | ) | [static] |
This function returns the ID of the player
References clientID_, and instance_.
Referenced by orxonox::Server::chat(), orxonox::Client::chat(), and orxonox::HumanPlayer::networkcallback_clientIDchanged().
static unsigned int orxonox::Host::getShipID | ( | ) | [inline, static] |
bool orxonox::Host::incomingChat | ( | const std::string & | message, | |
unsigned int | playerID | |||
) | [static] |
static bool orxonox::Host::isServer | ( | ) | [inline, static] |
virtual bool orxonox::Host::isServer_ | ( | ) | [private, pure virtual] |
Implemented in orxonox::Client, and orxonox::Server.
virtual bool orxonox::Host::processChat | ( | const std::string & | message, | |
unsigned int | playerID | |||
) | [private, pure virtual] |
virtual bool orxonox::Host::queuePacket | ( | ENetPacket * | packet, | |
int | clientID | |||
) | [private, pure virtual] |
static bool orxonox::Host::running | ( | ) | [inline, static] |
Referenced by orxonox::Synchronisable::Synchronisable(), and orxonox::Synchronisable::~Synchronisable().
static void orxonox::Host::setClientID | ( | unsigned int | id | ) | [inline, static] |
Referenced by orxonox::packet::Welcome::process().
static void orxonox::Host::setShipID | ( | unsigned int | id | ) | [inline, static] |
unsigned int orxonox::Host::clientID_ [protected] |
Referenced by getPlayerID(), and Host().
Host * orxonox::Host::instance_ = 0 [static, protected] |
Referenced by addPacket(), Broadcast(), Chat(), getPlayerID(), Host(), incomingChat(), and ~Host().
unsigned int orxonox::Host::shipID_ [protected] |