Changeset 880 for code/branches/network/src
- Timestamp:
- Mar 12, 2008, 1:37:39 PM (17 years ago)
- Location:
- code/branches/network/src/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/ConnectionManager.cc
r790 r880 281 281 } 282 282 283 void ConnectionManager::regClientsObjectID( int clientID, std::string objectID ) { 284 COUT(4) << "ship of client: " << clientID << ": " << objectID << " mapped" << std::endl; 285 clientsShip.insert( make_pair( clientID, objectID ) ); 286 } 287 288 std::string ConnectionManager::getClientsShipID( int clientID ) { 289 return clientsShip[clientID]; 290 } 291 292 int ConnectionManager::getObjectsClientID( std::string objectID ) { 293 std::map<int, std::string>::iterator iter = clientsShip.begin(); 294 while( iter != clientsShip.end() ) { 295 if( iter->second.compare( objectID ) == 1 ) return iter->first; 296 } 297 return -99; 298 } 299 300 void ConnectionManager::deleteClientIDReg( int clientID ) { 301 clientsShip.erase( clientID ); 302 } 303 304 void ConnectionManager::deleteObjectIDReg( std::string objectID ) { 305 std::map<int, std::string>::iterator iter = clientsShip.begin(); 306 while( iter != clientsShip.end() ) { 307 if( iter->second.compare( objectID ) == 1 ) break; 308 } 309 clientsShip.erase( iter->first ); 310 } 283 311 } -
code/branches/network/src/network/ConnectionManager.h
r790 r880 20 20 #include "PacketBuffer.h" 21 21 #include "PacketManager.h" 22 #include "map" 22 23 23 24 namespace std … … 73 74 bool quit; // quit-variable (communication with threads) 74 75 ClientInformation *head_; 76 77 //functions to map what object every clients uses 78 std::map<int, std::string> clientsShip; 79 void regClientsObjectID( int clientID, std::string objectID ); 80 std::string getClientsShipID( int clientID ); 81 int getObjectsClientID( std::string objectID ); 82 void deleteClientIDReg( int clientID ); 83 void deleteObjectIDReg( std::string objectID ); 75 84 }; 76 77 78 79 80 81 82 83 84 85 } 85 86
Note: See TracChangeset
for help on using the changeset viewer.