Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6784 in orxonox.OLD for branches/network/src/world_entities


Ignore:
Timestamp:
Jan 26, 2006, 8:03:40 PM (19 years ago)
Author:
rennerc
Message:

sync: added debug feature

Location:
branches/network/src/world_entities
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/environments/water.cc

    r6771 r6784  
    298298  SYNCHELP_READ_BEGIN();
    299299
    300   SYNCHELP_READ_FKT( Water::writeState );
     300  SYNCHELP_READ_FKT( Water::writeState, NWT_WAT_STATE );
    301301
    302302  return SYNCHELP_READ_N;
     
    324324  {
    325325    *reciever = rec;
    326     SYNCHELP_WRITE_FKT( Water::readState );
     326    SYNCHELP_WRITE_FKT( Water::readState, NWT_WAT_STATE );
    327327  }
    328328
     
    343343  SYNCHELP_WRITE_BEGIN();
    344344
    345   SYNCHELP_WRITE_FKT( WorldEntity::readState );
     345  SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_WAT_WE_STATE );
    346346
    347347  // sync the size
    348   SYNCHELP_WRITE_FLOAT( this->sizeX );
    349   SYNCHELP_WRITE_FLOAT( this->sizeY );
     348  SYNCHELP_WRITE_FLOAT( this->sizeX, NWT_WAT_SIZEX );
     349  SYNCHELP_WRITE_FLOAT( this->sizeY, NWT_WAT_SIZEY );
    350350
    351351  //sync resolution
    352   SYNCHELP_WRITE_INT( this->resX );
    353   SYNCHELP_WRITE_INT( this->resY );
     352  SYNCHELP_WRITE_INT( this->resX, NWT_WAT_RESX );
     353  SYNCHELP_WRITE_INT( this->resY, NWT_WAT_RESY );
    354354
    355355  //sync the height
    356   SYNCHELP_WRITE_FLOAT( this->height );
     356  SYNCHELP_WRITE_FLOAT( this->height, NWT_WAT_HEIGHT );
    357357
    358358  return SYNCHELP_WRITE_N;
     
    370370  SYNCHELP_READ_BEGIN();
    371371
    372   SYNCHELP_READ_FKT( WorldEntity::writeState );
     372  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_WAT_WE_STATE );
    373373
    374374  float f1, f2;
     
    376376
    377377  //read the size
    378   SYNCHELP_READ_FLOAT( f1 );
    379   SYNCHELP_READ_FLOAT( f2 );
     378  SYNCHELP_READ_FLOAT( f1, NWT_WAT_SIZEX );
     379  SYNCHELP_READ_FLOAT( f2, NWT_WAT_SIZEY );
    380380  this->sizeX = f1;
    381381  this->sizeY = f2;
     
    383383
    384384  //read the resolution
    385   SYNCHELP_READ_INT( i1 );
    386   SYNCHELP_READ_INT( i2 );
     385  SYNCHELP_READ_INT( i1, NWT_WAT_RESX );
     386  SYNCHELP_READ_INT( i2, NWT_WAT_RESY );
    387387  this->resX = i1;
    388388  this->resY = i2;
     
    390390
    391391  //read the height
    392   SYNCHELP_READ_FLOAT( f1 );
     392  SYNCHELP_READ_FLOAT( f1, NWT_WAT_HEIGHT );
    393393  this->height = f1;
    394394
  • branches/network/src/world_entities/npcs/ground_turret.cc

    r6736 r6784  
    181181  SYNCHELP_READ_BEGIN();
    182182
    183   SYNCHELP_READ_FKT( WorldEntity::writeState );
     183  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_GT_WE_STATE );
    184184
    185185  return SYNCHELP_READ_N;
     
    207207    *reciever = rec;
    208208
    209     SYNCHELP_WRITE_FKT( WorldEntity::readState );
     209    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_GT_WE_STATE );
    210210
    211211  }
  • branches/network/src/world_entities/power_ups/laser_power_up.cc

    r6512 r6784  
    126126  SYNCHELP_READ_BEGIN();
    127127
    128   SYNCHELP_READ_FKT( PowerUp::writeState );
     128  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_LPU_WE_STATE );
    129129
    130130  return SYNCHELP_READ_N;
     
    148148    SYNCHELP_WRITE_BEGIN();
    149149
    150     SYNCHELP_WRITE_FKT( PowerUp::readState );
     150    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_LPU_WE_STATE );
    151151
    152152    return SYNCHELP_WRITE_N;
  • branches/network/src/world_entities/power_ups/param_power_up.cc

    r6695 r6784  
    131131  SYNCHELP_READ_BEGIN();
    132132
    133   SYNCHELP_READ_FKT( PowerUp::writeState );
     133  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_PPU_WE_STATE );
    134134
    135135  int i;
    136   SYNCHELP_READ_INT( i );
     136  SYNCHELP_READ_INT( i, NWT_PPU_TYPE );
    137137  this->type = (EnumParamPowerUpType)i;
    138   SYNCHELP_READ_FLOAT( this->value );
     138  SYNCHELP_READ_FLOAT( this->value, NWT_PPU_VALUE );
    139139
    140140  if ( this->value != 0 )
    141141  {
    142     SYNCHELP_READ_FLOAT( this->min_value );
    143     SYNCHELP_READ_FLOAT( this->max_value );
     142    SYNCHELP_READ_FLOAT( this->min_value, NWT_PPU_MINVALUE );
     143    SYNCHELP_READ_FLOAT( this->max_value, NWT_PPU_MAXVALUE );
    144144    respawn();
    145145  }
     
    165165    SYNCHELP_WRITE_BEGIN();
    166166
    167     SYNCHELP_WRITE_FKT( PowerUp::readState );
     167    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_PPU_WE_STATE );
    168168
    169169    int i = (int)this->type;
    170     SYNCHELP_WRITE_INT( i );
    171     SYNCHELP_WRITE_FLOAT( this->value );
     170    SYNCHELP_WRITE_INT( i, NWT_PPU_TYPE );
     171    SYNCHELP_WRITE_FLOAT( this->value, NWT_PPU_VALUE );
    172172
    173173    if ( this->value != 0 )
    174174    {
    175       SYNCHELP_WRITE_FLOAT( this->min_value );
    176       SYNCHELP_WRITE_FLOAT( this->max_value );
     175      SYNCHELP_WRITE_FLOAT( this->min_value, NWT_PPU_MINVALUE );
     176      SYNCHELP_WRITE_FLOAT( this->max_value, NWT_PPU_MAXVALUE );
    177177    }
    178178
  • branches/network/src/world_entities/power_ups/power_up.cc

    r6710 r6784  
    124124{
    125125  SYNCHELP_WRITE_BEGIN();
    126   SYNCHELP_WRITE_FKT( WorldEntity::readState );
     126  SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_PU_WE_STATE );
    127127  return SYNCHELP_WRITE_N;
    128128}
     
    138138{
    139139  SYNCHELP_READ_BEGIN();
    140   SYNCHELP_READ_FKT( WorldEntity::writeState );
     140  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_PU_WE_STATE );
    141141  return SYNCHELP_READ_N;
    142142}
  • branches/network/src/world_entities/power_ups/turret_power_up.cc

    r6695 r6784  
    135135  SYNCHELP_READ_BEGIN();
    136136
    137   SYNCHELP_READ_FKT( PowerUp::writeState );
     137  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_TPU_WE_STATE );
    138138
    139139  return SYNCHELP_READ_N;
     
    156156    SYNCHELP_WRITE_BEGIN();
    157157
    158     SYNCHELP_WRITE_FKT( PowerUp::readState );
     158    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_TPU_WE_STATE );
    159159
    160160    return SYNCHELP_WRITE_N;
  • branches/network/src/world_entities/power_ups/weapon_power_up.cc

    r6710 r6784  
    100100  SYNCHELP_READ_BEGIN();
    101101
    102   SYNCHELP_READ_FKT( PowerUp::writeState );
     102  SYNCHELP_READ_FKT( PowerUp::writeState, NWT_WPU_WE_STATE );
    103103
    104104  //TODO: sync weapon class ( see loadParams )
     
    124124    SYNCHELP_WRITE_BEGIN();
    125125
    126     SYNCHELP_WRITE_FKT( PowerUp::readState );
     126    SYNCHELP_WRITE_FKT( PowerUp::readState, NWT_WPU_WE_STATE );
    127127
    128128    //TODO: sync weapon class ( see loadParams )
  • branches/network/src/world_entities/skybox.cc

    r6772 r6784  
    297297  SYNCHELP_READ_BEGIN();
    298298
    299   SYNCHELP_READ_FKT( WorldEntity::writeState );
    300 
    301   SYNCHELP_READ_FLOAT( size );
     299  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_SB_WE_STATE );
     300
     301  SYNCHELP_READ_FLOAT( size, NWT_SB_SIZE );
    302302  if ( textureName )
    303303  {
     
    305305    textureName = NULL;
    306306  }
    307   SYNCHELP_READ_STRINGM( textureName );
     307  SYNCHELP_READ_STRINGM( textureName, NWT_SB_TEXTURENAME );
    308308
    309309  this->setSize( size );
     
    331331    SYNCHELP_WRITE_BEGIN();
    332332
    333     SYNCHELP_WRITE_FKT( WorldEntity::readState );
    334 
    335     SYNCHELP_WRITE_FLOAT(this->size);
    336     SYNCHELP_WRITE_STRING(this->textureName);
     333    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_SB_WE_STATE );
     334
     335    SYNCHELP_WRITE_FLOAT(this->size, NWT_SB_SIZE);
     336    SYNCHELP_WRITE_STRING(this->textureName, NWT_SB_TEXTURENAME);
    337337
    338338    return SYNCHELP_WRITE_N;
  • branches/network/src/world_entities/space_ships/space_ship.cc

    r6764 r6784  
    557557
    558558  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 );
    570566     //SYNCHELP_READ_FLOAT( cycle );
    571567
    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 );
    575577
    576578    //TODO: do not recieve data if you are the owner
     
    578580    {
    579581      int flags = 0;
    580       SYNCHELP_READ_INT( flags );
     582      SYNCHELP_READ_INT( flags, NWT_SS_FLAGS );
    581583
    582584      bUp = (flags & MASK_bUp) != 0;
     
    595597    if ( b == DATA_mouse /*&& this->getHostID()!=this->getOwner()*/ )
    596598    {
    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 );
    601603    }
    602   } while( b != 0 );
     604  };
    603605
    604606  /*if ( b == DATA_mouse && this->getHostID()!=this->getOwner() )
     
    610612}*/
    611613
    612   if ( this->getOwner() != this->getHostID() )
    613     SYNCHELP_READ_FKT( PNode::writeSync );
    614 
    615614  return SYNCHELP_READ_N;
    616615}
     
    636635    PRINTF(0)("SEND STATE %d %d\n", this->getUniqueID(), rec);
    637636
    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 );
    641640    //SYNCHELP_WRITE_FLOAT( cycle );
    642641
     
    645644
    646645  *reciever = 0;
     646 
     647  if ( this->getOwner() == this->getHostID() )
     648    SYNCHELP_WRITE_FKT( PNode::readSync, NWT_SS_PN_SYNC );
    647649
    648650  if ( this->getHostID()==this->getOwner() )
     
    674676    {
    675677      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 );
    678680    }
    679681#define __OFFSET_ROT 0.05
     
    685687      oldMouseDir = mouseDir;
    686688
    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 );
    692694    }
    693695
    694696  }
    695697
    696   SYNCHELP_WRITE_BYTE( 0 );
    697 
    698 
    699   if ( this->getOwner() == this->getHostID() )
    700     SYNCHELP_WRITE_FKT( PNode::readSync );
    701 
    702698  return SYNCHELP_WRITE_N;
    703699}
     700
     701int SpaceShip::writeState(const byte* data, int length, int sender)
     702{
     703  SYNCHELP_READ_BEGIN();
     704 
     705  return SYNCHELP_READ_N;
     706}
     707
     708int SpaceShip::readState(byte* data, int maxLength )
     709{
     710  SYNCHELP_WRITE_BEGIN();
     711 
     712  return SYNCHELP_WRITE_N;
     713}
     714
     715int SpaceShip::writeSync(const byte* data, int length, int sender)
     716{
     717  SYNCHELP_READ_BEGIN();
     718 
     719  return SYNCHELP_READ_N;
     720}
     721
     722int 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  
    4444    virtual int       writeBytes(const byte* data, int length, int sender);
    4545    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 );
    4651
    4752
  • branches/network/src/world_entities/terrain.cc

    r6695 r6784  
    326326
    327327  SYNCHELP_READ_BEGIN();
    328   SYNCHELP_READ_FKT( WorldEntity::writeState );
     328  SYNCHELP_READ_FKT( WorldEntity::writeState, NWT_TER_WE_STATE );
    329329
    330330  return SYNCHELP_READ_N;
     
    344344    *reciever = rec;
    345345
    346     return WorldEntity::readState( data, maxLength );
     346    SYNCHELP_WRITE_BEGIN();
     347    SYNCHELP_WRITE_FKT( WorldEntity::readState, NWT_TER_WE_STATE );
     348    return SYNCHELP_WRITE_N;
    347349
    348350  }
  • branches/network/src/world_entities/world_entity.cc

    r6720 r6784  
    518518  SYNCHELP_READ_BEGIN();
    519519
    520   SYNCHELP_READ_FKT( PNode::writeState );
    521 
    522   SYNCHELP_READ_STRINGM( modelFileName );
    523   SYNCHELP_READ_FLOAT( scaling );
     520  SYNCHELP_READ_FKT( PNode::writeState, NWT_WE_PN_WRITESTATE );
     521
     522  SYNCHELP_READ_STRINGM( modelFileName, NWT_WE_PN_MODELFILENAME );
     523  SYNCHELP_READ_FLOAT( scaling, NWT_WE_PN_SCALING );
    524524  //check if modelFileName is relative to datadir or absolute
    525525
     
    562562  SYNCHELP_WRITE_BEGIN();
    563563
    564   SYNCHELP_WRITE_FKT( PNode::readState );
     564  SYNCHELP_WRITE_FKT( PNode::readState, NWT_WE_PN_WRITESTATE );
    565565
    566566  if ( getModel(0) && getModel(0)->getName() )
     
    573573    }
    574574
    575     SYNCHELP_WRITE_STRING( name );
     575    SYNCHELP_WRITE_STRING( name, NWT_WE_PN_MODELFILENAME );
    576576  }
    577577  else
    578578  {
    579     SYNCHELP_WRITE_STRING("");
    580   }
    581 
    582   SYNCHELP_WRITE_FLOAT( scaling );
     579    SYNCHELP_WRITE_STRING("", NWT_WE_PN_MODELFILENAME);
     580  }
     581
     582  SYNCHELP_WRITE_FLOAT( scaling, NWT_WE_PN_SCALING );
    583583  /*if ( this->md2TextureFileName!=NULL && strcmp(this->md2TextureFileName, "") )
    584584  {
Note: See TracChangeset for help on using the changeset viewer.