Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6963 in orxonox.OLD for branches


Ignore:
Timestamp:
Feb 1, 2006, 5:07:36 PM (19 years ago)
Author:
rennerc
Message:

playable: sync score

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

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/playable.cc

    r6959 r6963  
    286286{
    287287  SYNCHELP_READ_BEGIN();
    288 
     288 
     289  byte b;
     290  SYNCHELP_READ_BYTE( b, NWT_PL_B );
     291 
    289292  byte flags;
    290 
    291   SYNCHELP_READ_BYTE( flags, NWT_PL_FLAGS );
    292 
    293   bFire = (flags & FLAGS_bFire) != 0;
     293 
     294  if ( b == DATA_FLAGS )
     295  {
     296    SYNCHELP_READ_BYTE( flags, NWT_PL_FLAGS );
     297
     298    bFire = (flags & FLAGS_bFire) != 0;
     299   
     300    return SYNCHELP_READ_N;
     301  }
     302 
     303  if ( b == DATA_SCORE )
     304  {
     305    int newScore;
     306    SYNCHELP_READ_BYTE( newScore, NWT_PL_SCORE );
     307    setScore( newScore );
     308   
     309    return SYNCHELP_READ_N;
     310  }
    294311
    295312  return SYNCHELP_READ_N;
     
    299316{
    300317  SYNCHELP_WRITE_BEGIN();
     318 
     319  if ( score != oldScore && isServer() )
     320  {
     321    SYNCHELP_WRITE_BYTE( DATA_SCORE, NWT_PL_B);
     322    SYNCHELP_WRITE_INT( score, NWT_PL_SCORE );
     323    oldScore = score;
     324   
     325    return SYNCHELP_WRITE_N;
     326  }
     327 
    301328  byte flags = 0;
    302329
     
    314341bool Playable::needsReadSync( )
    315342{
    316   //if ( score != oldScore )
    317   //  return true;
     343  if ( score != oldScore && isServer() )
     344    return true;
    318345
    319346  byte flags = 0;
  • branches/network/src/world_entities/space_ships/space_ship.cc

    r6959 r6963  
    761761    }
    762762
    763     if ( Playable::needsReadSync() )
     763    while ( Playable::needsReadSync() )
    764764    {
    765765      sentSomething = true;
Note: See TracChangeset for help on using the changeset viewer.