Changeset 6419 in orxonox.OLD for branches/network/src/lib
- Timestamp:
- Jan 6, 2006, 6:19:30 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_game_manager.cc
r6414 r6419 23 23 #include "network_stream.h" 24 24 #include "converter.h" 25 25 26 #include "p_node.h" 27 26 28 27 29 /* include your own header */ … … 392 394 //PRINTF(0)("SendEntityList: n = %d\n", networkStream->getSyncCount()-2 ); 393 395 396 int n = 0; 397 394 398 while ( it != e ) 395 399 { … … 404 408 if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getOwner()) ) ) 405 409 return; 410 411 412 PRINTF(0)("id = %x %s %s\n", (int)((*it)->getLeafClassID()), (*it)->getClassName(), (*it)->getName()); 413 414 415 /*if ( (*it)->isA(CL_WORLD_ENTITY) ) 416 { 417 n = dynamic_cast<WorldEntity*>((*it))->readState( outBuffer[userID].buffer, outBuffer[userID].maxLength-outBuffer[userID].length ); 418 if ( n = 0 ) 419 { 420 PRINTF(2)("n = 0\n"); 421 } 422 outBuffer[userID].length += n; 423 }*/ 406 424 407 425 it++; … … 437 455 * @param owner: owner of this synchronizealbe 438 456 */ 439 voidNetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner )457 BaseObject* NetworkGameManager::doCreateEntity( ClassID classID, int uniqueID, int owner ) 440 458 { 441 459 BaseObject * b = Factory::fabricate( classID ); … … 444 462 { 445 463 PRINTF(1)("Could not fabricate Object with classID %x\n", classID); 446 return ;464 return NULL; 447 465 } 448 466 … … 456 474 s->setIsOutOfSync( true ); 457 475 PRINTF(0)("Fabricated %s with id %d\n", s->getClassName(), s->getUniqueID()); 476 return b; 458 477 } 459 478 else … … 462 481 delete b; 463 482 } 483 return NULL; 464 484 } 465 485 … … 696 716 i += Converter::byteArrayToInt( &data[i], &owner ); 697 717 718 PRINTF(0)("before fabricate\n"); 698 719 if ( classID != CL_NETWORK_GAME_MANAGER && classID != CL_HANDSHAKE ) 699 doCreateEntity( (ClassID)classID, uniqueID, owner ); 700 701 } 720 { 721 BaseObject* b = doCreateEntity( (ClassID)classID, uniqueID, owner ); 722 723 /*if ( b != NULL ) 724 { 725 if ( b->isA(CL_WORLD_ENTITY) ) 726 { 727 int n = dynamic_cast<WorldEntity*>(b)->writeState( data, length, sender ); 728 729 i += n; 730 } 731 }*/ 732 } 733 734 } 735 702 736 PNode::getNullParent()->debugNode( 0 ); 737 703 738 return true; 704 739 } -
branches/network/src/lib/network/network_game_manager.h
r6412 r6419 94 94 void executeRequestSync( int uniqueID, int user ); 95 95 96 voiddoCreateEntity(ClassID classID, int uniqueID, int owner);96 BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner); 97 97 void doRemoveEntity(int uniqueID); 98 98 void doRequestSync(int uniqueID, int userID);
Note: See TracChangeset
for help on using the changeset viewer.