Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2008, 7:40:47 PM (16 years ago)
Author:
scheusso
Message:

merged network branch back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/Host.cc

    r1751 r1907  
    3030
    3131#include "Host.h"
     32#include "core/ConsoleCommand.h"
    3233#include "packet/Packet.h"
    3334
    3435namespace network {
    3536
     37SetConsoleCommandShortcut(Host, Chat);
     38
    3639Host *Host::instance_=0;
    3740 
     41/**
     42 * @brief Constructor: assures that only one reference will be created and sets the pointer
     43 */
    3844Host::Host()
    3945{
     46  clientID_=0;
    4047  assert(instance_==0);
    4148  instance_=this;
     
    4350
    4451
     52/**
     53 * @brief Destructor: resets the instance pointer to 0
     54 */
    4555Host::~Host()
    4656{
     
    4858}
    4959
     60/**
     61 * This function is used to add an enetpacket to be sent to another peer
     62 * @param packet Packet to be added
     63 * @param clientID ID of the client the packet should be sent to
     64 * @return success?
     65 */
    5066bool Host::addPacket(ENetPacket *packet, int clientID){
    5167  if(instance_)
     
    7086// }
    7187
    72 int Host::getPlayerID(){
     88/**
     89 * This function returns the ID of the player
     90 * @return playerID
     91 */
     92unsigned int Host::getPlayerID(){
    7393  if(!instance_)
    7494    return 0;
    75   return instance_->playerID();
     95  return instance_->clientID_;
    7696}
    7797
    78 // unsigned int Host::getShipID(){
    79 //   if(!instance_)
    80 //     assert(0);
    81 //   return instance_->shipID();
    82 // }
     98bool Host::Chat(std::string message){
     99  if(!instance_)
     100    return false;
     101  return instance_->chat(message);
     102}
     103
     104bool Host::incomingChat(std::string message, unsigned int playerID){
     105  return instance_->processChat(message, playerID);
     106}
    83107
    84108}//namespace network
Note: See TracChangeset for help on using the changeset viewer.