Changeset 2031 for code/branches
- Timestamp:
- Oct 28, 2008, 9:11:02 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/Synchronisable.cc
r2028 r2031 142 142 // update data and create object/entity... 143 143 bool b = no->updateData(mem, mode, true); 144 assert(b); 145 b = no->create(); 146 assert(b); 144 // assert(b); 145 if (b) 146 { 147 b = no->create(); 148 assert(b); 149 } 147 150 return no; 148 151 } -
code/branches/objecthierarchy/src/network/packet/Gamestate.cc
r1990 r2031 46 46 #define HEADER GAMESTATE_HEADER(data_) 47 47 48 48 49 49 #define PACKET_FLAG_GAMESTATE ENET_PACKET_FLAG_RELIABLE 50 50 51 51 Gamestate::Gamestate() 52 52 { … … 85 85 return false; 86 86 } 87 87 88 88 #ifndef NDEBUG 89 89 std::list<Synchronisable*> slist; … … 115 115 slist.push_back(*it); 116 116 #endif 117 117 118 118 //if(it->doSelection(id)) 119 119 dataMap_[mem-data_]=(*it); // save the mem location of the synchronisable data … … 165 165 { 166 166 bool b = s->updateData(mem, mode); 167 assert(b);167 // assert(b); 168 168 //if(!s->updateData(mem, mode)) 169 169 //return false; … … 339 339 assert(data_); 340 340 std::map<unsigned int, Synchronisable *>::iterator it; 341 341 342 342 // allocate memory for new data 343 343 uint8_t *gdata = new uint8_t[HEADER->datasize+sizeof(GamestateHeader)]; … … 346 346 uint8_t *newdata = gdata + sizeof(GamestateHeader); 347 347 uint8_t *origdata = GAMESTATE_START(data_); 348 348 349 349 //copy the GamestateHeader 350 350 *(GamestateHeader*)gdata = *HEADER; 351 351 352 352 synchronisableHeader *oldobjectheader, *newobjectheader; 353 353 unsigned int objectOffset; 354 354 355 355 //copy in the zeros 356 356 for(it=dataMap_.begin(); it!=dataMap_.end(); it++){ … … 390 390 assert(!HEADER->compressed); 391 391 assert(!HEADER->diffed); 392 392 393 393 //preparations 394 394 std::map<unsigned int, Synchronisable *>::iterator it; 395 395 uint8_t *origdata, *basedata, *destdata, *ndata; 396 396 unsigned int objectOffset, streamOffset=0; //data offset 397 unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 397 unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 398 398 synchronisableHeader *origheader; 399 399 synchronisableHeader *destheader; 400 400 401 401 origdata = GAMESTATE_START(this->data_); 402 402 basedata = GAMESTATE_START(base->data_); 403 403 ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)]; 404 404 destdata = ndata + sizeof(GamestateHeader); 405 405 406 406 // do the diff 407 407 for(it=dataMap_.begin(); it!=dataMap_.end(); it++){ … … 410 410 origheader = (synchronisableHeader *)(origdata+streamOffset); 411 411 destheader = (synchronisableHeader *)(destdata+streamOffset); 412 412 413 413 //copy and partially diff the object header 414 414 assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool)); … … 420 420 }else{ 421 421 *(uint32_t*)(destdata+sizeof(uint32_t)+sizeof(bool)) = 0; 422 *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0; 422 *(uint32_t*)(destdata+2*sizeof(uint32_t)+sizeof(bool)) = 0; 423 423 } 424 424 objectOffset=sizeof(synchronisableHeader); 425 425 streamOffset+=sizeof(synchronisableHeader); 426 426 427 427 //now handle the object data or fill with zeros 428 428 while(objectOffset<origheader->size ){ 429 429 430 430 if(sendData && streamOffset<minsize) 431 431 *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor … … 434 434 else 435 435 *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered 436 436 437 437 objectOffset++; 438 438 streamOffset++; … … 442 442 basedata+=objectOffset; 443 443 } 444 444 445 445 //copy over the gamestate header and set the diffed flag 446 446 *(GamestateHeader *)ndata = *HEADER; //copy over the header … … 458 458 assert(!HEADER->compressed); 459 459 assert(HEADER->diffed); 460 460 461 461 //preparations 462 462 std::map<unsigned int, Synchronisable *>::iterator it; 463 463 uint8_t *origdata, *basedata, *destdata, *ndata; 464 464 unsigned int objectOffset, streamOffset=0; //data offset 465 unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 465 unsigned int minsize = (HEADER->datasize < GAMESTATE_HEADER(base->data_)->datasize) ? HEADER->datasize : GAMESTATE_HEADER(base->data_)->datasize; 466 466 synchronisableHeader *origheader; 467 467 synchronisableHeader *destheader; 468 468 469 469 origdata = GAMESTATE_START(this->data_); 470 470 basedata = GAMESTATE_START(base->data_); 471 471 ndata = new uint8_t[HEADER->datasize + sizeof(GamestateHeader)]; 472 472 destdata = ndata + sizeof(GamestateHeader); 473 473 474 474 // do the undiff 475 475 for(it=dataMap_.begin(); it!=dataMap_.end(); it++){ … … 478 478 destheader = (synchronisableHeader *)(destdata+streamOffset); 479 479 bool sendData; 480 480 481 481 //copy and partially diff the object header 482 482 assert(sizeof(synchronisableHeader)==3*sizeof(unsigned int)+sizeof(bool)); … … 489 489 }else{ 490 490 *(unsigned int*)(destdata+sizeof(unsigned int)+sizeof(bool)) = 0; 491 *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0; 491 *(unsigned int*)(destdata+2*sizeof(unsigned int)+sizeof(bool)) = 0; 492 492 } 493 493 objectOffset=sizeof(synchronisableHeader); 494 494 streamOffset+=sizeof(synchronisableHeader); 495 495 496 496 //now handle the object data or fill with zeros 497 497 while(objectOffset<origheader->size ){ 498 498 499 499 if(sendData && streamOffset<minsize) 500 500 *(destdata+objectOffset)=*(basedata+objectOffset)^*(origdata+objectOffset); // do the xor … … 503 503 else 504 504 *(destdata+objectOffset)=0; // set to 0 because this object should not be transfered 505 505 506 506 objectOffset++; 507 507 streamOffset++; … … 511 511 basedata+=objectOffset; 512 512 } 513 513 514 514 //copy over the gamestate header and set the diffed flag 515 515 *(GamestateHeader *)ndata = *HEADER; //copy over the header -
code/branches/objecthierarchy/src/orxonox/objects/infos/Level.cc
r2019 r2031 52 52 53 53 this->registerVariables(); 54 this->xmlfilename_ = this->getFilename() ;54 this->xmlfilename_ = this->getFilename().substr(Settings::getDataPath().length()); 55 55 56 56 COUT(0) << "created Level" << std::endl; -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc
r2029 r2031 69 69 70 70 this->getNode()->attachObject(this->debugBillboard_.getBillboardSet()); 71 this->setObjectMode(0x0); 71 72 } 72 73 -
code/branches/objecthierarchy/src/orxonox/tools/Timer.cc
r1968 r2031 112 112 void TimerBase::run() const 113 113 { 114 bool temp = this->bKillAfterCall_; // to avoid errors with bKillAfterCall_=false and an exutors which destroy the timer 115 114 116 (*this->executor_)(); 115 117 116 if (t his->bKillAfterCall_)118 if (temp) 117 119 delete this; 118 120 }
Note: See TracChangeset
for help on using the changeset viewer.