Changeset 6672 in orxonox.OLD for branches/network/src
- Timestamp:
- Jan 24, 2006, 3:02:19 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_game_manager.cc
r6670 r6672 53 53 this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager"); 54 54 55 newUniqueID = MAX_CONNECTIONS + 2;56 57 55 hasRequestedWorld = false; 58 56 this->setSynchronized(true); … … 215 213 if ( this->isServer() ) 216 214 { 217 if ( newUniqueID< 0 )215 if ( NetworkManager::getInstance()->getNewUniqueID() < 0 ) 218 216 { 219 217 PRINTF(1)("Cannot create entity! There are no more uniqueIDs left!\n"); … … 221 219 } 222 220 223 return this->executeCreateEntity( classID, newUniqueID++, owner );221 return this->executeCreateEntity( classID, NetworkManager::getInstance()->getNewUniqueID(), owner ); 224 222 } 225 223 else … … 240 238 if ( this->isServer() ) 241 239 { 242 if ( newUniqueID< 0 )240 if ( NetworkManager::getInstance()->getNewUniqueID() < 0 ) 243 241 { 244 242 PRINTF(1)("Cannot create entity! There are no more uniqueIDs left!\n"); … … 258 256 { 259 257 Synchronizeable * s = dynamic_cast<Synchronizeable*>(b); 260 s->setUniqueID( newUniqueID++);258 s->setUniqueID( NetworkManager::getInstance()->getNewUniqueID() ); 261 259 s->setOwner( 0 ); 262 260 // all entities created via this function are added automaticaly to the synchronizeable list -
branches/network/src/lib/network/network_game_manager.h
r6668 r6672 143 143 144 144 145 146 145 private: 147 146 std::vector<clientBuffer> outBuffer; 148 147 //clientBuffer allOutBuffer; 149 148 static NetworkGameManager* singletonRef; 150 151 int newUniqueID;152 149 bool hasRequestedWorld; 153 150 }; -
branches/network/src/lib/network/network_manager.cc
r6665 r6672 54 54 55 55 this->hostID = -1; 56 this->newUniqueID = MAX_CONNECTIONS + 2; 56 57 this->bGameServer = false; 57 58 -
branches/network/src/lib/network/network_manager.h
r6658 r6672 53 53 inline NetworkStream* getDefaultSyncStream() { return this->defaultSyncStream; } 54 54 55 /** @returns the next uniqueID free for an object */ 56 inline int getNewUniqueID() { return this->newUniqueID++; } 57 55 58 void debug(); 56 59 … … 67 70 int hostID; //!< The Host-ID of the Manager 68 71 bool bGameServer; //!< true if it is a server 72 int newUniqueID; 69 73 70 74 }; -
branches/network/src/lib/network/network_stream.cc
r6661 r6672 448 448 449 449 450 451 452 453 454 455 456 457 458 459 460 461 450 int NetworkStream::getSyncCount() 451 { 452 int n = 0; 453 for (SynchronizeableList::iterator it = synchronizeables.begin(); it!=synchronizeables.end(); it++) 454 if( (*it)->beSynchronized() == true) 455 ++n; 456 457 //return synchronizeables.size(); 458 return n; 459 } 460 461 462 463 464 465 -
branches/network/src/lib/network/network_stream.h
r6660 r6672 56 56 inline SynchronizeableList::const_iterator getSyncBegin(){ return synchronizeables.begin(); } 57 57 inline SynchronizeableList::const_iterator getSyncEnd(){ return synchronizeables.end(); } 58 in line int getSyncCount(){ return synchronizeables.size(); }58 int getSyncCount(); 59 59 60 60 inline bool isUserIdActive( int userID ) { if (userID>=networkSockets.size()) return false; else return networkSockets[userID]!=NULL; } -
branches/network/src/lib/network/synchronizeable.cc
r6659 r6672 43 43 44 44 this->bSynchronize = false; 45 45 46 NetworkStream* nd = NetworkManager::getInstance()->getDefaultSyncStream(); 46 47 assert(nd != NULL); 47 48 nd->connectSynchronizeable(*this); 49 this->setUniqueID(NetworkManager::getInstance()->getNewUniqueID()); 48 50 } 49 51 -
branches/network/src/world_entities/space_ships/space_ship.cc
r6634 r6672 97 97 if (root != NULL) 98 98 this->loadParams(root); 99 } 100 101 102 /** 103 * initializes a Spaceship 104 */ 105 void SpaceShip::init() 106 { 107 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 108 this->setClassID(CL_SPACE_SHIP, "SpaceShip"); 109 110 PRINTF(4)("SPACESHIP INIT\n"); 99 111 100 112 //weapons: … … 114 126 115 127 this->getWeaponManager()->changeWeaponConfig(1); 116 }117 118 119 /**120 * initializes a Spaceship121 */122 void SpaceShip::init()123 {124 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));125 this->setClassID(CL_SPACE_SHIP, "SpaceShip");126 127 PRINTF(4)("SPACESHIP INIT\n");128 128 129 129 EventHandler::getInstance()->grabEvents(true); … … 202 202 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); 203 203 } 204 204 205 205 206 /**
Note: See TracChangeset
for help on using the changeset viewer.