- Timestamp:
- Jul 21, 2010, 4:27:51 PM (14 years ago)
- Location:
- code/branches/presentation3/src/libraries/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/libraries/network/packet/Gamestate.cc
r7153 r7159 405 405 { 406 406 SynchronisableHeader htemp(temp); 407 assert( htemp.getDataSize()!=0 ); 407 408 if ( htemp.getObjectID() == objectID ) 408 409 { … … 410 411 goto DODIFF; 411 412 } 413 // { 414 // SynchronisableHeader htemp2(temp+htemp.getDataSize()+SynchronisableHeader::getSize()); 415 // if( temp+htemp.getDataSize()+SynchronisableHeader::getSize() < baseData+baseLength ) 416 // { 417 // assert(htemp2.getClassID()<500); 418 // assert(htemp2.getDataSize()!=0 && htemp2.getDataSize()<1000); 419 // assert(htemp2.isDiffed()==false); 420 // } 421 // } 412 422 temp += htemp.getDataSize()+SynchronisableHeader::getSize(); 423 413 424 } 414 425 // If not found start looking at the beginning 426 assert( temp==baseData+baseLength ); 415 427 temp = baseData; 428 // { 429 // SynchronisableHeader htemp2(temp); 430 // if( temp < baseData+baseLength ) 431 // { 432 // assert(htemp2.getClassID()<500); 433 // assert(htemp2.getDataSize()!=0 && htemp2.getDataSize()<1000); 434 // assert(htemp2.isDiffed()==false); 435 // } 436 // } 416 437 while ( temp < baseData+baseOffset ) 417 438 { … … 422 443 goto DODIFF; 423 444 } 445 // { 446 // SynchronisableHeader htemp2(temp+htemp.getDataSize()+SynchronisableHeader::getSize()); 447 // if( temp+htemp.getDataSize()+SynchronisableHeader::getSize() < baseData+baseLength ) 448 // { 449 // assert(htemp2.getClassID()<500); 450 // assert(htemp2.getDataSize()!=0 && htemp2.getDataSize()<1000); 451 // assert(htemp2.isDiffed()==false); 452 // } 453 // } 424 454 temp += htemp.getDataSize()+SynchronisableHeader::getSize(); 425 455 } … … 430 460 DODIFF: 431 461 { 462 // COUT(4) << "dodiff" << endl; 432 463 // if(baseOffset==0) 433 464 // { … … 438 469 if( memcmp( origData+origOffset+objectOffset, temp+objectOffset, h.getDataSize()) == 0 ) 439 470 { 471 // COUT(4) << "skip object" << Synchronisable::getSynchronisable(h.getObjectID())->getIdentifier()->getName() << endl; 440 472 origOffset += objectOffset+ h.getDataSize(); // skip the whole object 441 473 baseOffset = temp + h.getDataSize()+SynchronisableHeader::getSize() - baseData; … … 444 476 else 445 477 { 478 // if( Synchronisable::getSynchronisable(h.getObjectID())->getIdentifier()->getName() == "Bot" ) 479 // COUT(0) << "blub" << endl; 480 // COUT(4) << "object diff: " << Synchronisable::getSynchronisable(h.getObjectID())->getIdentifier()->getName() << endl; 446 481 // COUT(4) << "diff " << h.getObjectID() << ":"; 447 482 // Now start to diff the Object … … 462 497 if ( memcmp(origData+origOffset+objectOffset, temp+objectOffset, varSize) != 0 ) 463 498 { 464 // COUT(4) << " c" << varSize;499 // COUT(4) << "copy variable" << endl; 465 500 *(VariableID*)(dest+newObjectOffset) = variableID; // copy over the variableID 466 501 newObjectOffset += sizeof(VariableID); … … 471 506 else 472 507 { 473 // COUT(4) << " s" << varSize;508 // COUT(4) << "skip variable" << endl; 474 509 objectOffset += varSize; 475 510 } 476 511 } 512 // else 513 // COUT(4) << "varsize 0" << endl; 477 514 478 515 ++variableID; 479 516 ++sizes; 480 517 } 518 481 519 if( Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables() != variableID ) 482 520 sizes += Synchronisable::getSynchronisable(h.getObjectID())->getNrOfVariables() - variableID; … … 486 524 assert(objectOffset == h.getDataSize()+SynchronisableHeader::getSize()); 487 525 origOffset += objectOffset; 488 baseOffset += temp + h.getDataSize()+SynchronisableHeader::getSize() - baseData; 526 // baseOffset += temp + h.getDataSize()+SynchronisableHeader::getSize() - baseData; 527 //baseOffset += objectOffset; 528 // SynchronisableHeader htemp(temp); 529 // baseOffset += SynchronisableHeader::getSize() + htemp.getDataSize(); 530 // { 531 // SynchronisableHeader htemp2( baseData+(temp-baseData+objectOffset) ); 532 // if( baseData+(temp-baseData+objectOffset) < baseData+baseLength ) 533 // { 534 // assert(htemp2.getClassID()<500); 535 // assert(htemp2.getDataSize()!=0 && htemp2.getDataSize()<1000); 536 // assert(htemp2.isDiffed()==false); 537 // } 538 // } 539 baseOffset = temp-baseData + objectOffset; 489 540 dest += newObjectOffset; 490 541 } … … 495 546 DOCOPY: 496 547 { 548 // COUT(4) << "docopy" << endl; 497 549 // Just copy over the whole Object 498 550 memcpy( dest, origData+origOffset, h.getDataSize()+SynchronisableHeader::getSize() ); -
code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.h
r7153 r7159 89 89 { return 14; } 90 90 inline uint16_t getDataSize() const 91 { return (*(uint16_t*)data_) & 0x7FFF; } //only use the first 31bits91 { return (*(uint16_t*)data_) & 0x7FFF; } //only use the first 15 bits 92 92 inline void setDataSize(uint16_t size) 93 { *(uint16_t*)(data_) = (size & 0x7FFF FFFF) | (*(uint16_t*)(data_) & 0x8000 ); }93 { *(uint16_t*)(data_) = (size & 0x7FFF) | (*(uint16_t*)(data_) & 0x8000 ); } 94 94 inline bool isDiffed() const 95 95 { return ( (*(uint16_t*)data_) & 0x8000 ) == 0x8000; }
Note: See TracChangeset
for help on using the changeset viewer.