Changeset 1907 for code/trunk/src/network/Host.cc
- Timestamp:
- Oct 12, 2008, 7:40:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/Host.cc
r1751 r1907 30 30 31 31 #include "Host.h" 32 #include "core/ConsoleCommand.h" 32 33 #include "packet/Packet.h" 33 34 34 35 namespace network { 35 36 37 SetConsoleCommandShortcut(Host, Chat); 38 36 39 Host *Host::instance_=0; 37 40 41 /** 42 * @brief Constructor: assures that only one reference will be created and sets the pointer 43 */ 38 44 Host::Host() 39 45 { 46 clientID_=0; 40 47 assert(instance_==0); 41 48 instance_=this; … … 43 50 44 51 52 /** 53 * @brief Destructor: resets the instance pointer to 0 54 */ 45 55 Host::~Host() 46 56 { … … 48 58 } 49 59 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 */ 50 66 bool Host::addPacket(ENetPacket *packet, int clientID){ 51 67 if(instance_) … … 70 86 // } 71 87 72 int Host::getPlayerID(){ 88 /** 89 * This function returns the ID of the player 90 * @return playerID 91 */ 92 unsigned int Host::getPlayerID(){ 73 93 if(!instance_) 74 94 return 0; 75 return instance_-> playerID();95 return instance_->clientID_; 76 96 } 77 97 78 // unsigned int Host::getShipID(){ 79 // if(!instance_) 80 // assert(0); 81 // return instance_->shipID(); 82 // } 98 bool Host::Chat(std::string message){ 99 if(!instance_) 100 return false; 101 return instance_->chat(message); 102 } 103 104 bool Host::incomingChat(std::string message, unsigned int playerID){ 105 return instance_->processChat(message, playerID); 106 } 83 107 84 108 }//namespace network
Note: See TracChangeset
for help on using the changeset viewer.