Changeset 7565 in orxonox.OLD for branches/network/src/lib/network/synchronizeable.cc
- Timestamp:
- May 10, 2006, 1:13:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/synchronizeable.cc
r7559 r7565 41 41 this->networkStream = NULL; 42 42 this->bSynchronize = false; 43 this->mLeafClassId = getLeafClassID(); 43 44 44 45 if( State::isOnline()) … … 50 51 } 51 52 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" ) ); 52 58 this->registerVar( new SynchronizeableString( &this->objectName, &this->objectName, "objectName" ) ); 53 59 } … … 175 181 i += n; 176 182 } 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 } 177 195 else 178 196 { … … 212 230 * @param fromStateId id of the base state id 213 231 * @return true on success 232 * @todo check for permissions 214 233 */ 215 234 bool Synchronizeable::setStateDiff( int userId, byte* data, int length, int stateId, int fromStateId ) … … 264 283 stateFrom = (*it); 265 284 285 std::list<int> changes; 286 266 287 //apply diff 267 288 for ( int i = 0; i<length; i++ ) … … 271 292 else 272 293 stateTo->data[i] = data[i]; 294 295 if ( data[i] != 0 ) 296 changes.push_back(i); 273 297 } 274 298 … … 282 306 i += (*it)->readFromBuf( stateTo->data + i, stateTo->dataLength - i ); 283 307 } 308 309 this->varChangeHandler( changes ); 284 310 285 311 assert( i == length -1 );
Note: See TracChangeset
for help on using the changeset viewer.