Changeset 3093
- Timestamp:
- May 27, 2009, 9:39:38 PM (16 years ago)
- Location:
- code/trunk/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/ConnectionManager.cc
r3084 r3093 143 143 } 144 144 145 bool ConnectionManager::addPacket(ENetPacket *packet, int clientID) { 146 ClientInformation *temp = ClientInformation::findClient(clientID); 147 if(!temp){ 148 COUT(3) << "C.Man: addPacket findClient failed" << std::endl; 149 return false; 150 } 151 return addPacket(packet, temp->getPeer()); 145 bool ConnectionManager::addPacket(ENetPacket *packet, unsigned int clientID) { 146 if ( clientID == CLIENTID_UNKNOWN ) 147 { 148 return addPacketAll(packet); 149 } 150 else 151 { 152 ClientInformation *temp = ClientInformation::findClient(clientID); 153 if(!temp){ 154 COUT(3) << "C.Man: addPacket findClient failed" << std::endl; 155 return false; 156 } 157 return addPacket(packet, temp->getPeer()); 158 } 152 159 } 153 160 … … 156 163 return false; 157 164 boost::recursive_mutex::scoped_lock lock(enet_mutex_g); 158 for(ClientInformation *i=ClientInformation::getBegin()->next(); i!=0; i=i->next()){ 159 COUT(3) << "adding broadcast packet for client: " << i->getID() << std::endl; 160 if(enet_peer_send(i->getPeer(), 0, packet)!=0) 161 return false; 162 } 165 // for(ClientInformation *i=ClientInformation::getBegin()->next(); i!=0; i=i->next()){ 166 // COUT(3) << "adding broadcast packet for client: " << i->getID() << std::endl; 167 // if(enet_peer_send(i->getPeer(), 0, packet)!=0) 168 // return false; 169 // } 170 enet_host_broadcast( instance_->server, 0, packet); 163 171 return true; 164 172 } -
code/trunk/src/network/ConnectionManager.h
r3084 r3093 76 76 bool quitListener(); 77 77 static bool addPacket(ENetPacket *packet, ENetPeer *peer); 78 static bool addPacket(ENetPacket *packet, int ID);78 static bool addPacket(ENetPacket *packet, unsigned int ID); 79 79 static bool addPacketAll(ENetPacket *packet); 80 80 bool sendPackets();
Note: See TracChangeset
for help on using the changeset viewer.