Changeset 7602 in orxonox.OLD for branches/network
- Timestamp:
- May 12, 2006, 9:08:48 AM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/handshake.cc
r7591 r7602 34 34 this->localState.networkManagerId = networkGameManagerId; 35 35 36 orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId" ) );37 version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version" ) );38 netManId_handler = registerVarId( new SynchronizeableInt( &localState.networkManagerId, &remoteState.networkManagerId, "networkManagerId" ) );39 hostId_handler = registerVarId( new SynchronizeableInt( &localState.hostId, &remoteState.hostId, "hostId" ) );40 completed_handler = registerVarId( new SynchronizeableInt( &localState.completed, &remoteState.completed, "completed" ) );41 error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error" ) );42 errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString" ) );36 orxId_handler = registerVarId( new SynchronizeableInt( &localState.orxId, &remoteState.orxId, "orxonoxId", PERMISSION_ALL ) ); 37 version_handler = registerVarId( new SynchronizeableInt( &localState.version, &remoteState.version, "version", PERMISSION_ALL ) ); 38 netManId_handler = registerVarId( new SynchronizeableInt( &localState.networkManagerId, &remoteState.networkManagerId, "networkManagerId", PERMISSION_ALL ) ); 39 hostId_handler = registerVarId( new SynchronizeableInt( &localState.hostId, &remoteState.hostId, "hostId", PERMISSION_ALL ) ); 40 completed_handler = registerVarId( new SynchronizeableInt( &localState.completed, &remoteState.completed, "completed", PERMISSION_ALL ) ); 41 error_handler = registerVarId( new SynchronizeableInt( &localState.error, &remoteState.error, "error", PERMISSION_ALL ) ); 42 errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) ); 43 43 44 44 localState.completed = false; -
branches/network/src/lib/network/network_stream.cc
r7591 r7602 163 163 if (disconnectSynchro != this->synchronizeables.end()) 164 164 this->synchronizeables.erase(disconnectSynchro); 165 166 this->bActive = false; 165 166 //TODO set timestamp 167 oldSynchronizeables[sync.getUniqueID()] = 0; 167 168 } 168 169 … … 462 463 463 464 PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId()); 464 465 assert(false); 465 466 466 467 delete it->second.handshake; … … 471 472 PRINT(1)("handshake failed!\n"); 472 473 it->second.socket->disconnectServer(); 474 assert(false); 473 475 } 474 476 } … … 529 531 offset += n; 530 532 531 offset += sync.getStateDiff( peer->second.userId, buf + offset, UDP_PACKET_SIZE-offset, currentState, peer->second.lastAckedState, 0 ); 533 //make space for size 534 offset += INTSIZE; 535 536 n = sync.getStateDiff( peer->second.userId, buf + offset, UDP_PACKET_SIZE-offset, currentState, peer->second.lastAckedState, 0 ); 537 offset += n; 538 539 assert( Converter::intToByteArray( n, buf + offset - n, INTSIZE ) == INTSIZE ); 532 540 } 533 541 … … 535 543 536 544 assert( peer->second.socket->writePacket( buf, offset ) ); 537 PRINTF(0)("send packet: %d\n", offset); 545 PRINTF(0)("send packet: %d userId = %d %x %d\n", offset, peer->second.userId, peer->second.handshake->getLeafClassID(), peer->second.handshake->getUniqueID()); 546 assert( peer->second.handshake->getLeafClassID() == CL_HANDSHAKE ); 538 547 } 539 548 } … … 553 562 int ackedState = 0; 554 563 int fromState = 0; 564 int syncDataLength = 0; 555 565 556 566 for ( PeerList::iterator peer = peers.begin(); peer != peers.end(); peer++ ) … … 592 602 offset += INTSIZE; 593 603 604 assert( Converter::byteArrayToInt( buf + offset, &syncDataLength ) == INTSIZE ); 605 offset += INTSIZE; 606 594 607 Synchronizeable * sync = NULL; 595 608 … … 606 619 if ( sync == NULL ) 607 620 { 621 if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() ) 622 { 623 offset += syncDataLength; 624 continue; 625 } 626 608 627 //TODO dont accept new object from all peers (probably only servers) 609 628 int leafClassId; -
branches/network/src/lib/network/network_stream.h
r7575 r7602 98 98 99 99 NetworkGameManager* networkGameManager; 100 101 std::map<int,int> oldSynchronizeables; 100 102 }; 101 103 #endif /* _NETWORK_STREAM */ -
branches/network/src/lib/network/synchronizeable.cc
r7591 r7602 52 52 /* make sure loadClassId is first synced var because this is read by networkStream */ 53 53 assert( syncVarList.size() == 0 ); 54 this->registerVar( new SynchronizeableInt( (int*)&this->getLeafClassID(), (int*)&this->getLeafClassID(), "leafClassId" ) );54 mLeafClassId = this->registerVarId( new SynchronizeableInt( (int*)&this->getLeafClassID(), (int*)&this->getLeafClassID(), "leafClassId" ) ); 55 55 56 56 this->registerVar( new SynchronizeableInt( &this->owner, &this->owner, "owner" ) ); … … 189 189 for ( int j = 0; j < (*it)->getSize(); it++ ) 190 190 { 191 assert(false); 191 192 stateTo->data[i] = 0; 192 193 i++; … … 321 322 void Synchronizeable::varChangeHandler( std::list<int> & id ) 322 323 { 324 for ( std::list<int>::iterator it = id.begin(); it != id.end(); it++ ) 325 assert( *it != mLeafClassId ); 323 326 } 324 327 … … 345 348 346 349 350
Note: See TracChangeset
for help on using the changeset viewer.