Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 10, 2006, 1:13:49 PM (18 years ago)
Author:
rennerc
Message:

reimplemented NetworkStream

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/synchronizeable.cc

    r7559 r7565  
    4141  this->networkStream = NULL;
    4242  this->bSynchronize = false;
     43  this->mLeafClassId = getLeafClassID();
    4344
    4445  if( State::isOnline())
     
    5051  }
    5152
     53  /* make sure loadClassId is first synced var because this is read by networkStream */
     54  assert( syncVarList.size() == 0 );
     55  this->registerVar( new SynchronizeableInt( &this->mLeafClassId, &this->mLeafClassId, "leafClassId" ) );
     56 
     57  this->registerVar( new SynchronizeableInt( &this->owner, &this->owner, "owner" ) );
    5258  this->registerVar( new SynchronizeableString( &this->objectName, &this->objectName, "objectName" ) );
    5359}
     
    175181      i += n;
    176182    }
     183    else if ( ! (
     184                 this->isServer() && (*it)->checkPremission( PERMISSION_SERVER ) ||
     185                 this->owner == this->hostID && (*it)->checkPremission( PERMISSION_OWNER ) ||
     186                 (*it)->checkPremission( PERMISSION_ALL )
     187                ) )
     188    {
     189      for ( int j = 0; j < (*it)->getSize(); it++ )
     190      {
     191        stateTo->data[i] = 0;
     192        i++;
     193      }
     194    }
    177195    else
    178196    {
     
    212230 * @param fromStateId id of the base state id
    213231 * @return true on success
     232 * @todo check for permissions
    214233 */
    215234bool Synchronizeable::setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId )
     
    264283    stateFrom = (*it);
    265284
     285  std::list<int> changes;
     286 
    266287  //apply diff
    267288  for ( int i = 0; i<length; i++ )
     
    271292    else
    272293      stateTo->data[i] = data[i];
     294   
     295    if ( data[i] != 0 )
     296      changes.push_back(i);
    273297  }
    274298
     
    282306    i += (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i );
    283307  }
     308 
     309  this->varChangeHandler( changes );
    284310
    285311  assert( i == length -1 );
Note: See TracChangeset for help on using the changeset viewer.