Changeset 1021 for code/trunk/src/network/ConnectionManager.cc
- Timestamp:
- Apr 10, 2008, 5:03:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/ConnectionManager.cc
r790 r1021 257 257 258 258 void ConnectionManager::syncClassid(int clientID) { 259 int i=0;259 unsigned int network_id=0; 260 260 std::string classname; 261 bool abort=false;262 261 orxonox::Identifier *id; 263 while(!abort){ 264 id = ID(i); 265 std::cout << "syncid: " << i << ", ID(id): " << id << std::endl; 266 if(id == NULL){ 267 if(i!=0) 268 abort=true; 269 else{ 270 ++i; 271 continue; 272 } 273 } 274 else{ 275 classname = id->getName(); 276 addPacket(packet_gen.clid( i, classname ),clientID); 277 } 278 ++i; 262 std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactoryBegin(); 263 while(it != orxonox::Factory::getFactoryEnd()){ 264 id = (*it).second; 265 if(id == NULL) 266 continue; 267 classname = id->getName(); 268 network_id = id->getNetworkID(); 269 COUT(4) << "network_id: " << network_id << ", classname: " << classname << std::endl; 270 271 addPacket(packet_gen.clid( (int)network_id, classname ), clientID); 272 273 ++it; 279 274 } 280 275 sendPackets(); 281 276 } 282 277 278 279 280 void ConnectionManager::addClientsObjectID( int clientID, int objectID ) { 281 COUT(4) << "ship of client: " << clientID << ": " << objectID << " mapped" << std::endl; 282 clientsShip.insert( std::make_pair( clientID, objectID ) ); 283 } 284 285 int ConnectionManager::getClientsShipID( int clientID ) { 286 return clientsShip[clientID]; 287 } 288 289 int ConnectionManager::getObjectsClientID( int objectID ) { 290 std::map<int, int>::iterator iter = clientsShip.begin(); 291 while( iter != clientsShip.end() ) { 292 if( iter->second == objectID ) return iter->first; 293 } 294 return -99; 295 } 296 297 void ConnectionManager::deleteClientIDReg( int clientID ) { 298 clientsShip.erase( clientID ); 299 } 300 301 void ConnectionManager::deleteObjectIDReg( int objectID ) { 302 std::map<int, int>::iterator iter = clientsShip.begin(); 303 while( iter != clientsShip.end() ) { 304 if( iter->second == objectID ) break; 305 } 306 clientsShip.erase( iter->first ); 307 } 308 283 309 }
Note: See TracChangeset
for help on using the changeset viewer.