Changeset 2062 for code/branches
- Timestamp:
- Oct 29, 2008, 5:19:02 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/Synchronisable.cc
r2041 r2062 147 147 synchronisableHeader *header = (synchronisableHeader *)mem; 148 148 149 if(!header->dataAvailable) 150 { 151 mem += header->size; 152 return 0; 153 } 154 149 155 COUT(4) << "fabricating object with id: " << header->objectID << std::endl; 150 156 … … 314 320 } 315 321 // if the variable gets synchronised bidirectional, then add the reference to the bytestream 316 if( ( (*i)->mode & direction::bidirectional ) )322 if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional ) 317 323 { 318 324 *(uint8_t*)mem = (*i)->varReference; 319 325 mem += sizeof( (*i)->varReference ); 326 tempsize += sizeof( (*i)->varReference ); 320 327 } 321 328 switch((*i)->type){ … … 323 330 memcpy( (void *)(mem), (void*)((*i)->var), (*i)->size); 324 331 mem+=(*i)->size; 325 tempsize+=(*i)->size + sizeof( (*i)->varReference );332 tempsize+=(*i)->size; 326 333 break; 327 334 case STRING: … … 332 339 COUT(5) << "synchronisable: char: " << (const char *)(mem) << " data: " << data << " string: " << *(std::string *)((*i)->var) << std::endl; 333 340 mem+=(*i)->size; 334 tempsize+=(*i)->size + sizeof( (*i)->varReference ) + sizeof(size_t);341 tempsize+=(*i)->size + sizeof(size_t); 335 342 break; 336 343 } … … 381 388 switch((*i)->type){ 382 389 case DATA: 383 if( ( (*i)->mode & direction::bidirectional ) )390 if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional ) 384 391 { 385 392 if( ( mode == 0x1 && (*i)->mode == direction::serverMaster ) || \ … … 406 413 break; 407 414 case STRING: 408 if( ( (*i)->mode & direction::bidirectional ) )415 if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional ) 409 416 { 410 417 if( ( mode == 0x1 && (*i)->mode == direction::serverMaster ) || \ … … 469 476 break; 470 477 } 471 if( ( (*i)->mode & direction::bidirectional ) != 0)478 if( ( (*i)->mode & direction::bidirectional ) == direction::bidirectional ) 472 479 { 473 480 tsize+=sizeof( (*i)->varReference ); -
code/branches/objecthierarchy/src/network/packet/Gamestate.cc
r2041 r2062 357 357 assert(it->second->objectID==oldobjectheader->objectID); 358 358 *newobjectheader = *oldobjectheader; 359 objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableDat evariables in the objectheader359 objectOffset=sizeof(uint8_t)+sizeof(bool); //skip the size and the availableData variables in the objectheader 360 360 if(it->second->doSelection(HEADER->id)){ 361 361 newobjectheader->dataAvailable=true; //TODO: probably not neccessary -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/ControllableEntity.cc
r2048 r2062 163 163 if (!Core::isMaster()) 164 164 { 165 this->client_overwrite_ = this->server_overwrite_; 165 166 COUT(0) << "CE: bidirectional synchronization" << std::endl; 166 167 this->setObjectMode(network::direction::bidirectional); … … 248 249 { 249 250 REGISTERSTRING(this->cameraPositionTemplate_, network::direction::toclient); 251 252 253 REGISTERDATA(this->client_overwrite_, network::direction::toserver); 254 REGISTERDATA(this->server_overwrite_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite)); 250 255 251 256 REGISTERDATA(this->server_position_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition)); … … 253 258 REGISTERDATA(this->server_orientation_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation)); 254 259 255 REGISTERDATA(this->server_overwrite_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));256 260 257 261 REGISTERDATA(this->client_position_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition)); … … 259 263 REGISTERDATA(this->client_orientation_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation)); 260 264 261 REGISTERDATA(this->client_overwrite_, network::direction::toserver);262 265 263 266 REGISTERDATA(this->playerID_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID)); … … 302 305 this->server_position_ = this->client_position_; 303 306 } 307 else 308 COUT(2) << "callback: not setting client position" << endl; 304 309 } 305 310 … … 453 458 else if (this->bControlled_) 454 459 { 455 this->node_->lookAt(target, relativeTo, localDirectionVector);460 // this->node_->lookAt(target, relativeTo, localDirectionVector); 456 461 this->client_orientation_ = this->node_->getOrientation(); 457 462 }
Note: See TracChangeset
for help on using the changeset viewer.