Changeset 6784 in orxonox.OLD for branches/network/src/world_entities/space_ships
- Timestamp:
- Jan 26, 2006, 8:03:40 PM (19 years ago)
- Location:
- branches/network/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/world_entities/space_ships/space_ship.cc
r6764 r6784 557 557 558 558 byte b; 559 560 do 561 { 562 SYNCHELP_READ_BYTE( b ); 563 564 if ( b == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ ) 565 { 566 PRINTF(0)("GOT STATE %d\n", this->getUniqueID()); 567 setRequestedSync( false ); 568 setIsOutOfSync( false ); 569 SYNCHELP_READ_FKT( WorldEntity::writeState ); 559 560 if ( SYNCHELP_READ_REMAINING()>0 && SYNCHELP_READ_NEXTBYTE() == DATA_state /*&& (this->getHostID()!=this->getOwner() || sender==0)*/ ) 561 { 562 PRINTF(0)("GOT STATE %d\n", this->getUniqueID()); 563 setRequestedSync( false ); 564 setIsOutOfSync( false ); 565 SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SS_WE_STATE ); 570 566 //SYNCHELP_READ_FLOAT( cycle ); 571 567 572 return SYNCHELP_READ_N; 573 } 574 568 return SYNCHELP_READ_N; 569 } 570 571 if ( this->getOwner() != this->getHostID() ) 572 SYNCHELP_READ_FKT( PNode::writeSync, NWT_SS_PN_SYNC ); 573 574 while ( SYNCHELP_READ_REMAINING()>0 ) 575 { 576 SYNCHELP_READ_BYTE( b, NWT_SS_B ); 575 577 576 578 //TODO: do not recieve data if you are the owner … … 578 580 { 579 581 int flags = 0; 580 SYNCHELP_READ_INT( flags );582 SYNCHELP_READ_INT( flags, NWT_SS_FLAGS ); 581 583 582 584 bUp = (flags & MASK_bUp) != 0; … … 595 597 if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ ) 596 598 { 597 SYNCHELP_READ_FLOAT( mouseDir.w );598 SYNCHELP_READ_FLOAT( mouseDir.v.x );599 SYNCHELP_READ_FLOAT( mouseDir.v.y );600 SYNCHELP_READ_FLOAT( mouseDir.v.z );599 SYNCHELP_READ_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW ); 600 SYNCHELP_READ_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX ); 601 SYNCHELP_READ_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY ); 602 SYNCHELP_READ_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ ); 601 603 } 602 } while( b != 0 );604 }; 603 605 604 606 /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() ) … … 610 612 }*/ 611 613 612 if ( this->getOwner() != this->getHostID() )613 SYNCHELP_READ_FKT( PNode::writeSync );614 615 614 return SYNCHELP_READ_N; 616 615 } … … 636 635 PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec); 637 636 638 SYNCHELP_WRITE_BYTE( (byte)DATA_state );639 640 SYNCHELP_WRITE_FKT( WorldEntity::readState );637 SYNCHELP_WRITE_BYTE( (byte)DATA_state, NWT_SS_B ); 638 639 SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SS_WE_STATE ); 641 640 //SYNCHELP_WRITE_FLOAT( cycle ); 642 641 … … 645 644 646 645 *reciever = 0; 646 647 if ( this->getOwner() == this->getHostID() ) 648 SYNCHELP_WRITE_FKT( PNode::readSync, NWT_SS_PN_SYNC ); 647 649 648 650 if ( this->getHostID()==this->getOwner() ) … … 674 676 { 675 677 oldMask = mask; 676 SYNCHELP_WRITE_BYTE( DATA_flags );677 SYNCHELP_WRITE_INT( mask );678 SYNCHELP_WRITE_BYTE( DATA_flags, NWT_SS_B ); 679 SYNCHELP_WRITE_INT( mask, NWT_SS_FLAGS ); 678 680 } 679 681 #define __OFFSET_ROT 0.05 … … 685 687 oldMouseDir = mouseDir; 686 688 687 SYNCHELP_WRITE_BYTE( DATA_mouse );688 SYNCHELP_WRITE_FLOAT( mouseDir.w );689 SYNCHELP_WRITE_FLOAT( mouseDir.v.x );690 SYNCHELP_WRITE_FLOAT( mouseDir.v.y );691 SYNCHELP_WRITE_FLOAT( mouseDir.v.z );689 SYNCHELP_WRITE_BYTE( DATA_mouse, NWT_SS_B ); 690 SYNCHELP_WRITE_FLOAT( mouseDir.w, NWT_SS_MOUSEDIRW ); 691 SYNCHELP_WRITE_FLOAT( mouseDir.v.x, NWT_SS_MOUSEDIRX ); 692 SYNCHELP_WRITE_FLOAT( mouseDir.v.y, NWT_SS_MOUSEDIRY ); 693 SYNCHELP_WRITE_FLOAT( mouseDir.v.z, NWT_SS_MOUSEDIRZ ); 692 694 } 693 695 694 696 } 695 697 696 SYNCHELP_WRITE_BYTE( 0 );697 698 699 if ( this->getOwner() == this->getHostID() )700 SYNCHELP_WRITE_FKT( PNode::readSync );701 702 698 return SYNCHELP_WRITE_N; 703 699 } 700 701 int SpaceShip::writeState(const byte* data, int length, int sender) 702 { 703 SYNCHELP_READ_BEGIN(); 704 705 return SYNCHELP_READ_N; 706 } 707 708 int SpaceShip::readState(byte* data, int maxLength ) 709 { 710 SYNCHELP_WRITE_BEGIN(); 711 712 return SYNCHELP_WRITE_N; 713 } 714 715 int SpaceShip::writeSync(const byte* data, int length, int sender) 716 { 717 SYNCHELP_READ_BEGIN(); 718 719 return SYNCHELP_READ_N; 720 } 721 722 int SpaceShip::readSync(byte* data, int maxLength ) 723 { 724 SYNCHELP_WRITE_BEGIN(); 725 726 return SYNCHELP_WRITE_N; 727 } -
branches/network/src/world_entities/space_ships/space_ship.h
r6756 r6784 44 44 virtual int writeBytes(const byte* data, int length, int sender); 45 45 virtual int readBytes(byte* data, int maxLength, int * reciever); 46 47 int writeState(const byte* data, int length, int sender); 48 int readState(byte* data, int maxLength ); 49 int writeSync(const byte* data, int length, int sender); 50 int readSync(byte* data, int maxLength ); 46 51 47 52
Note: See TracChangeset
for help on using the changeset viewer.