Changeset 514 for code/branches/FICN/src/network/ConnectionManager.cc
- Timestamp:
- Dec 13, 2007, 6:02:07 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/network/ConnectionManager.cc
r505 r514 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * 4 * 5 * License notice: 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Author: 22 * Oliver Scheuss, (C) 2007 23 * Co-authors: 24 * ... 25 * 26 */ 27 1 28 // 2 29 // C++ Interface: ConnectionManager … … 24 51 25 52 boost::thread_group network_threads; 26 53 27 54 ConnectionManager::ConnectionManager(ClientInformation *head){ 28 55 quit=false; … … 52 79 return NULL; 53 80 } 54 81 55 82 ENetPacket *ConnectionManager::getPacket(int &clientID){ 56 83 ENetAddress address; … … 82 109 return true; 83 110 } 84 111 85 112 bool ConnectionManager::addPacket(ENetPacket *packet, int clientID){ 86 113 if(enet_peer_send(head_->findClient(clientID)->getPeer(), clientID, packet)!=0) … … 88 115 return true; 89 116 } 90 117 91 118 bool ConnectionManager::addPacketAll(ENetPacket *packet){ 92 119 for(ClientInformation *i=head_->next(); i!=0; i=i->next()){ … … 105 132 return false; 106 133 } 107 134 108 135 bool ConnectionManager::sendPackets(){ 109 136 ENetEvent event; … … 155 182 enet_host_destroy(server); 156 183 } 157 184 158 185 void ConnectionManager::disconnectClients(){ 159 186 ENetEvent event; … … 190 217 // return clientDisconnect(*peer); 191 218 // } 192 193 194 219 220 221 195 222 bool ConnectionManager::clientDisconnect(ENetPeer *peer){ 196 223 return head_->removeClient(peer); … … 205 232 return true; 206 233 } 207 234 208 235 int ConnectionManager::getClientID(ENetPeer peer){ 209 236 return getClientID(peer.address); 210 237 } 211 238 212 239 int ConnectionManager::getClientID(ENetAddress address){ 213 240 return head_->findClient(&address)->getID(); 214 241 } 215 242 216 243 ENetPeer *ConnectionManager::getClientPeer(int clientID){ 217 244 return head_->findClient(clientID)->getPeer(); 218 245 } 219 246 220 247 void ConnectionManager::syncClassid(int clientID){ 221 248 int i=0; … … 235 262 sendPackets(); 236 263 } 237 264 238 265 }
Note: See TracChangeset
for help on using the changeset viewer.