Changeset 6341 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Dec 30, 2005, 1:57:12 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/network_world.cc
r6222 r6341 69 69 #include "playable.h" 70 70 #include "network_manager.h" 71 #include "network_game_manager.h" 71 72 #include "playable.h" 72 73 … … 167 168 { 168 169 this->setClassID(CL_WORLD, "NetworkWorld"); 170 PRINTF(0)("START\n"); 169 171 170 172 this->setName(name); … … 337 339 // find WorldEntities // 338 340 //////////////////////// 339 if( NetworkManager::getInstance()->isGameServer())340 {}341 342 341 element = root->FirstChildElement("WorldEntities"); 343 342 if( element == NULL) … … 352 351 while( element != NULL) 353 352 { 354 if( NetworkManager::getInstance()->isGameServer() || !strcmp( element->Value(), "SkyBox") || !strcmp( element->Value(), "Terrain") 355 || !strcmp( element->Value(), "SpaceShip")) 353 if( NetworkManager::getInstance()->isGameServer()) 354 { 355 356 BaseObject* created = NetworkGameManager::getInstance()->createEntity(element); 357 if( created != NULL ) 358 { 359 if(created->isA(CL_WORLD_ENTITY)) 360 this->spawn(dynamic_cast<WorldEntity*>(created)); 361 printf("Created a %s: %s\n", created->getClassName(), created->getName()); 362 } 363 else 364 PRINTF(1)("NetworkWorld: could not create this entity\n"); 365 366 // if we load a 'Player' we use it as localPlayer 367 368 369 //todo do this more elegant 370 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) 371 sky = dynamic_cast<SkyBox*>(created); 372 if( element->Value() != NULL && !strcmp( element->Value(), "Terrain")) 373 { 374 terrain = dynamic_cast<Terrain*>(created); 375 CDEngine::getInstance()->setTerrain(terrain); 376 } 377 378 } 379 else if( /* !strcmp( element->Value(), "SkyBox") || */ /* !strcmp( element->Value(), "Terrain") || */ !strcmp( element->Value(), "SpaceShip")) 356 380 { 357 381 BaseObject* created = Factory::fabricate(element); … … 362 386 printf("Created a %s: %s\n", created->getClassName(), created->getName()); 363 387 } 388 else 389 PRINTF(1)("NetworkWorld: could not create this entity\n"); 364 390 365 391 // if we load a 'Player' we use it as localPlayer … … 374 400 CDEngine::getInstance()->setTerrain(terrain); 375 401 } 376 377 402 } 378 403 element = element->NextSiblingElement(); … … 443 468 // this->spawn(testEntity); 444 469 445 for(int i = 0; i < 100; i++)446 {447 WorldEntity* tmp = new NPCTest1();448 char npcChar[10];449 sprintf (npcChar, "NPC_%d", i);450 tmp->setName(npcChar);451 tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30);452 this->spawn(tmp);453 }470 // for(int i = 0; i < 100; i++) 471 // { 472 // WorldEntity* tmp = NetworkGameManager::; 473 // char npcChar[10]; 474 // sprintf (npcChar, "NPC_%d", i); 475 // tmp->setName(npcChar); 476 // tmp->setAbsCoor(((float)rand()/RAND_MAX) * 5000, 50/*+ (float)rand()/RAND_MAX*20*/, ((float)rand()/RAND_MAX -.5) *30); 477 // this->spawn(tmp); 478 // } 454 479 455 480 this->music = NULL; … … 865 890 // this->entities->add (entity); 866 891 entity->postSpawn (); 892 867 893 } 868 894
Note: See TracChangeset
for help on using the changeset viewer.