Changeset 6095 in orxonox.OLD for branches/network
- Timestamp:
- Dec 14, 2005, 1:39:37 AM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_manager.cc
r6007 r6095 107 107 { 108 108 this->tmpStream = new NetworkStream(port); 109 this->bGameServer = true; 109 110 SDL_Delay(20); 110 111 return 1; … … 135 136 this->tmpStream = new NetworkStream(port); 136 137 this->tmpStream->connectSynchronizeable(sync); 138 this->bGameServer = true; 137 139 } 138 140 -
branches/network/src/lib/network/network_manager.h
r6018 r6095 45 45 void setHostID(int id); 46 46 /** Returns the hostID @return The hostID of the object */ 47 inline int getHostID() { return this->hostID; }; 47 inline int getHostID() { return this->hostID; } 48 inline bool isGameServer() { return this->bGameServer; } 48 49 49 50 … … 56 57 57 58 private: 58 const std::list<BaseObject*>* netStreamList; // list with refs to all network streams 59 const std::list<BaseObject*>* syncList; // list of synchronizeables 60 static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class 61 NetworkStream* tmpStream; //!< FIXME: this is only for testing purposes 62 int hostID; //!< The Host-ID of the Manager 59 const std::list<BaseObject*>* netStreamList; // list with refs to all network streams 60 const std::list<BaseObject*>* syncList; // list of synchronizeables 61 static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class 62 NetworkStream* tmpStream; //!< FIXME: this is only for testing purposes 63 int hostID; //!< The Host-ID of the Manager 64 bool bGameServer; //!< true if it is a server 63 65 64 66 }; -
branches/network/src/orxonox.cc
r6063 r6095 280 280 if( this->serverName != NULL) // we are a client 281 281 NetworkManager::getInstance()->establishConnection(this->serverName, port); 282 else if( this->port > 0) 282 else if( this->port > 0) { // we are a server 283 283 NetworkManager::getInstance()->createServer(port); 284 } 284 285 285 286 return 0; -
branches/network/src/story_entities/network_world.cc
r6093 r6095 341 341 // find WorldEntities // 342 342 //////////////////////// 343 element = root->FirstChildElement("WorldEntities"); 344 if( element == NULL) 343 if( NetworkManager::getInstance()->isGameServer()) 344 { 345 element = root->FirstChildElement("WorldEntities"); 346 if( element == NULL) 345 347 { 346 348 PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n"); 347 349 } 348 else350 else 349 351 { 350 352 element = element->FirstChildElement(); … … 352 354 PRINTF(4)("Loading NetworkWorldEntities\n"); 353 355 while( element != NULL) 356 { 357 BaseObject* created = Factory::fabricate(element); 358 if( created != NULL ) 354 359 { 355 BaseObject* created = Factory::fabricate(element); 356 if( created != NULL ) 357 { 358 if(created->isA(CL_WORLD_ENTITY)) 359 this->spawn(dynamic_cast<WorldEntity*>(created)); 360 printf("Created a %s: %s\n", created->getClassName(), created->getName()); 361 } 360 if(created->isA(CL_WORLD_ENTITY)) 361 this->spawn(dynamic_cast<WorldEntity*>(created)); 362 printf("Created a %s: %s\n", created->getClassName(), created->getName()); 363 } 362 364 363 365 // if we load a 'Player' we use it as localPlayer … … 365 367 366 368 //todo do this more elegant 367 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) 368 sky = dynamic_cast<SkyBox*>(created); 369 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 370 { 371 terrain = dynamic_cast<Terrain*>(created); 372 CDEngine::getInstance()->setTerrain(terrain); 373 } 374 element = element->NextSiblingElement(); 375 glmis->step(); //! @todo temporary 369 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) 370 sky = dynamic_cast<SkyBox*>(created); 371 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 372 { 373 terrain = dynamic_cast<Terrain*>(created); 374 CDEngine::getInstance()->setTerrain(terrain); 376 375 } 376 element = element->NextSiblingElement(); 377 glmis->step(); //! @todo temporary 378 } 377 379 PRINTF(4)("Done loading NetworkWorldEntities\n"); 378 380 } 381 } 379 382 380 383 //////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.